Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
rspec不提供任何回溯_Rspec_Rspec Rails - Fatal编程技术网

rspec不提供任何回溯

rspec不提供任何回溯,rspec,rspec-rails,Rspec,Rspec Rails,我试图用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)>' # ./s

我试图用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)>'
命名错误:
未定义的方法'after_create='用于#
#./spec/models/stripe\u event\u processor\u spec.rb:63:in`block(2级)in'
#./spec/models/stripe\u event\u processor\u spec.rb:69:in`block(2级)in'
#./spec/models/stripe\u event\u processor\u spec.rb:81:in`block(2级)in'
举个例子,在我的一个gem中,FactoryGirl方法有一个问题,但是rspec给我的只是我自己测试中触发它的那一行。不是很有帮助

我已尝试将
--backtrace
添加到我的
rspec
命令中,但它不再进行跟踪

我怀疑这可能是因为默认的rspec配置在堆栈跟踪进入
gems/
文件夹时过滤了堆栈跟踪

这篇文章建议手动覆盖rspec配置,这有点粗糙,但可能是最好的解决方案。如果这是真的:那么所说的rspec配置在我的计算机上的什么地方?它不在我的
bundler
目录中,也不在我的所有其他gem目录中

有什么想法吗?我怎样才能让rspec给我一个真正的回溯,
gems
等等?

结果表明,我不需要找出我的计算机上哪里定义了
config.backtrace\u clean\u模式
,因为我可以在
spec\u helper.rb
中覆盖它,如下所示:

RSpec.configure do |config|
  # RSpec automatically cleans stuff out of backtraces;
  # sometimes this is annoying when trying to debug something e.g. a gem
  config.backtrace_clean_patterns = [
    /\/lib\d*\/ruby\//,
    /bin\//,
    /gems/,
    /spec\/spec_helper\.rb/,
    /lib\/rspec\/(core|expectations|matchers|mocks)/
  ]
end
是默认值,只需将以下内容放入spec_helper.rb文件即可覆盖:

RSpec.configure do |config|
  # RSpec automatically cleans stuff out of backtraces;
  # sometimes this is annoying when trying to debug something e.g. a gem
  config.backtrace_clean_patterns = [
  ]
end
现在我可以看到完整的痕迹了