【发布时间】:2013-06-13 05:00:44
【问题描述】:
我正在尝试使用 rspec 调试某些东西,但堆栈跟踪没有帮助:它们不够深入。
NoMethodError:
undefined method `after_create=' for #<Spree::Calculator::FlatRate:0x007ffc988d1868>
# ./spec/models/stripe_event_processor_spec.rb:63:in `block (2 levels) in <top (required)>'
# ./spec/models/stripe_event_processor_spec.rb:69:in `block (2 levels) in <top (required)>'
# ./spec/models/stripe_event_processor_spec.rb:81:in `block (2 levels) in <top (required)>'
例如,在这里,我的一个 gem 中的 FactoryGirl 方法存在问题,但 rspec 给我的只是我自己的测试中触发它的行。不是很有帮助。
我尝试将--backtrace 添加到我的rspec 命令中,但它不再进行跟踪!
我怀疑,查看 this article,这可能是因为默认的 rspec 配置在堆栈跟踪进入 gems/ 文件夹时会对其进行过滤。
文章建议手动覆盖 rspec 配置,这有点 hacky,但可能是最好的解决方案。如果这是真的:那么所说的 rspec 配置驻留在我的计算机上的什么位置?它不在我的 bundler 目录中,还有我所有的其他 gem。
有什么想法吗?我怎样才能让 rspec 给我一个 real 回溯,gems 等等?
【问题讨论】:
标签: rspec rspec-rails