rspec 堆栈级别太深 [英] rspec stack level too deep

查看:53
本文介绍了rspec 堆栈级别太深的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我分别运行模型规格和控制器规格时,没问题.当我一起运行它们时,我得到了堆栈溢出,字面意思是 :)

When I run my model specs and controller specs separately, it's fine. When I run them together, I get a stack overflow, literally :)

$ bundle exec rspec --fail-fast spec/models
........

Finished in 0.44274 seconds
8 examples, 0 failures

$ bundle exec rspec --fail-fast spec/controllers
..

Finished in 0.99339 seconds
2 examples, 0 failures

$ bundle exec rspec --fail-fast spec
F

Failures:

  1) HerpController derp derp example
     Failure/Error: Unable to find matching line from backtrace
     SystemStackError:
       stack level too deep
     # /Users/jared/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.1/lib/abstract_controller/layouts.rb:359

Finished in 0.02241 seconds
1 example, 1 failure

我该如何开始调试?谢谢.

How do I even begin to debug this? Thanks.

推荐答案

一次删除一半的规范出现了问题.我想这是二等分调试的一个例子.感谢 Frederick Cheung,他的评论建议了这种方法.

Removing half of my specs at a time turned up the problem. I suppose this is an example of bisect debugging. Thanks to Frederick Cheung, whose comment suggested this approach.

对于后代来说,这就是问题所在.

For posterity, this was the problem.

include Rails.application.routes.url_helpers
describe "Attendee#next_page" do
end

显然,包括进入describe

describe "Attendee#next_page" do 
  include Rails.application.routes.url_helpers
end

关于rspec,我有很多东西要学习.:)

I have a lot to learn about rspec. :)

这篇关于rspec 堆栈级别太深的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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