Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rspec stack level too deep

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.

like image 393
Jared Beck Avatar asked Nov 22 '25 23:11

Jared Beck


1 Answers

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

Apparently, includes go inside the describe

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

I have a lot to learn about rspec. :)

like image 141
Jared Beck Avatar answered Nov 25 '25 16:11

Jared Beck