抑制Rspec 3的回溯 [英] Suppress backtrace for Rspec 3
本文介绍了抑制Rspec 3的回溯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用rspec 3.2.0和capybara 2.4.4,并在我的spec_helper.rb文件中具有以下内容
I am using rspec 3.2.0 and capybara 2.4.4 and have in my spec_helper.rb file as below
config.full_backtrace=false
在大多数错误中,我正在回溯,例如
On most errors, I am getting a backtrace, e.g.
Failure/Error: check 'un_student_3'
Capybara::ElementNotFound:
Unable to find checkbox "un_student_3"
# /Users/115698/.rvm/gems/ruby-2.1.1@match_maker/gems/capybara-2.4.4/lib/capybara/node/finders.rb:41:in `block in find'
# /Users/115698/.rvm/gems/ruby-2.1.1@match_maker/gems/capybara-2.4.4/lib/capybara/node/base.rb:84:in `synchronize'
# /Users/115698/.rvm/gems/ruby-2.1.1@match_maker/gems/capybara-2.4.4/lib/capybara/node/finders.rb:30:in `find'
# /Users/115698/.rvm/gems/ruby-2.1.1@match_maker/gems/capybara-2.4.4/lib/capybara/node/actions.rb:82:in `check'
# /Users/115698/.rvm/gems/ruby-2.1.1@match_maker/gems/capybara-2.4.4/lib/capybara/session.rb:676:in `block (2 levels) in <class:Session>'
# /Users/115698/.rvm/gems/ruby-2.1.1@match_maker/gems/capybara-2.4.4/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
# ./spec/features/students/student_spec.rb:56:in `block (2 levels) in <top (required)>'
如何关闭此功能?
推荐答案
基于此问题的正文(或注释)之间的阅读:如何在RSpec 2中缩短测试失败的回溯?,执行此操作的方法放在spec_helper.rb文件中
Based in a reading between the lines (or comments) of this question: How do I shorten the backtrace for a test failure in RSpec 2?, the way to do this is put in your spec_helper.rb file
config.backtrace_exclusion_patterns = [
/\/lib\d*\/ruby\//,
/bin\//,
/gems/,
/spec\/spec_helper\.rb/,
/lib\/rspec\/(core|expectations|matchers|mocks)/
]
这篇关于抑制Rspec 3的回溯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文