How do I shorten the backtrace for a test failure in RSpec 2?

前端 未结 2 1096
别跟我提以往
别跟我提以往 2021-01-01 15:57

When my specs hit an error, I get a message like this:

Vendor should reject duplicate names
     Failure/Error: user_with_duplicate_email.should_not be_valid         


        
2条回答
  •  囚心锁ツ
    2021-01-01 16:20

    I updated it to work with with Rspec 3.2.3. In spec_helper.rb put:

    RSpec.configure do |config|
      config.backtrace_exclusion_patterns = [
        /\/lib\d*\/ruby\//,
        /bin\//,
        /gems/,
        /spec\/spec_helper\.rb/,
        /lib\/rspec\/(core|expectations|matchers|mocks)/
      ]
    end
    

    This is pure gold. Thank you luacassus!

提交回复
热议问题