How do I shorten the backtrace for a test failure in RSpec 2? -
when specs hit error, message this:
vendor should reject duplicate names failure/error: user_with_duplicate_email.should_not be_valid expected valid? return false, got true # /home/kevin/.rvm/gems/ruby-1.9.2-p136@rails3tutorial/gems/rspec-expectations-2.3.0/lib/rspec/expectations/fail_with.rb:29:in `fail_with' # /home/kevin/.rvm/gems/ruby-1.9.2-p136@rails3tutorial/gems/rspec-expectations-2.3.0/lib/rspec/expectations/handler.rb:44:in `handle_matcher' # /home/kevin/.rvm/gems/ruby-1.9.2-p136@rails3tutorial/gems/rspec-expectations-2.3.0/lib/rspec/expectations/extensions/kernel.rb:50:in `should_not' . . 15 more lines . . # /home/kevin/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/drb/drb.rb:1592:in `block (2 levels) in main_loop' # /home/kevin/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/drb/drb.rb:1588:in `loop' # /home/kevin/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop'
i'm running ruby 1.0.2, rails (3.0.3), , rspec (2.3.0). m .rspec configuration file has 2 options specified:
--drb --colour
how turn off extended trace?
in spec_helper.rb
can filter backtrace using following code snippet:
rspec.configure |config| # rspec automatically cleans stuff out of backtraces; # annoying when trying debug e.g. gem # rspec 3: # config.backtrace_exclusion_patterns = [ # rspec 2: config.backtrace_clean_patterns = [ /\/lib\d*\/ruby\//, /bin\//, /gems/, /spec\/spec_helper\.rb/, /lib\/rspec\/(core|expectations|matchers|mocks)/ ] end
Comments
Post a Comment