如何让 rspec-2 提供与测试失败相关的完整跟踪? [英] How to get rspec-2 to give the full trace associated with a test failure?

查看:42
本文介绍了如何让 rspec-2 提供与测试失败相关的完整跟踪?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,如果我使用 rake spec 运行我的测试套件,我会收到一个错误:

<前>1) SegmentsController GET 'index' 应该可以工作失败/错误:获取索引"#的未定义方法`locale'# ./spec/controllers/segments_controller_spec.rb:14:在'块(3级)中'

这是正常的,因为我确实有错误:)

问题是跟踪不是很有帮助.我知道它在 segments_controller_spec.rb,第 14 行中断,但这正是我调用测试的地方:

###segments_controller_spec.rb:14获取索引"

我更喜欢实际的换行和完整的跟踪,而不是 spec 文件夹中的部分.

使用 --trace 运行没有帮助.

解决方案

您必须使用 -b 选项运行 rspec 以查看完整的回溯

Right now if I run my test suite using rake spec I get an error:

1) SegmentsController GET 'index' should work
   Failure/Error: get 'index'
   undefined method `locale' for #
   # ./spec/controllers/segments_controller_spec.rb:14:
      in `block (3 levels) in '

This is normal as I do have an error :)

The problem is that the trace isn't very helpful. I know it broke in segments_controller_spec.rb, line 14, but this is just where I call the test:

### segments_controller_spec.rb:14
get 'index'

I would prefer to have the actual line breaking and the complete trace, not the part in the spec folder.

Running with --trace doesn't help.

解决方案

You must run rspec with -b option to see full backtraces

这篇关于如何让 rspec-2 提供与测试失败相关的完整跟踪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆