Note that there are some explanatory texts on larger screens.

plurals
  1. POstack level too deep (SystemStackError) when using both rspec and cucumber with ruby and rails
    primarykey
    data
    text
    <p>This is a question about what debugging strategy I should use when encountering a stack level too deep (SystemStackError) using Ruby and Rails.</p> <p>I am seeing these errors when using either rspec or cucumber</p> <pre><code>perrys-MacBook-Pro:pc perry_mac$ cucumber stack level too deep (SystemStackError) /Users/perry_mac/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:240 perrys-MacBook-Pro:pc perry_mac$ rspec /Users/perry_mac/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:240: stack level too deep (SystemStackError) perrys-MacBook-Pro:pc perry_mac$ </code></pre> <p>I suspect the problem I have introduced here is independent of both rspec and cucumber. I'm not sure how to narrow down the problem. What should I try next?</p> <p>I have already tried <code>bundle update</code>, which ran fine.</p> <p>The app runs fine under <code>rails s</code> , but I'd like to make use of the rspec and cucumber tests I've written.</p> <p>ADDENDUM:</p> <p>I see this with the simplest of tests, for instance:</p> <pre><code>perrys-MacBook-Pro:pc perry_mac$ cat ./spec/controllers/page_controller_spec.rb require 'spec_helper' describe PageController do end perrys-MacBook-Pro:pc perry_mac$ rspec ./spec/controllers/page_controller_spec.rb /Users/perry_mac/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:240: stack level too deep (SystemStackError) perrys-MacBook-Pro:pc perry_mac$ </code></pre> <p>ADDENDUM 2: pastebin of spec_helper is here: <a href="http://pastebin.com/ePdGyHQh" rel="nofollow">http://pastebin.com/ePdGyHQh</a></p> <p>ADDENDUM 3: pastebin of Gemfile is here: <a href="http://pastebin.com/xkLYGjsY" rel="nofollow">http://pastebin.com/xkLYGjsY</a></p> <p>ADDENDUM 4: I have determined that this is the line in spec_helper.rb that leads to the error</p> <pre><code>require File.expand_path("../../config/environment", __FILE__) </code></pre> <p>If I put a deliberate syntax error right before that line, I get a 'syntax error' If I put the same syntax error after the line, I get the 'stack too deep error.'</p> <p>Seems like some progress. Should <code>require File.expand_path("../../config/environment", __FILE__)</code> be written some other way?</p> <p>ADDENDUM 5: I added this to spec_helper.rb:</p> <pre><code>puts File.path("../../config/environment") puts __FILE__ require File.expand_path("../../config/environment", __FILE__) </code></pre> <p>and now see this:</p> <pre><code>perrys-MacBook-Pro:pc perry_mac$ rspec ./spec/controllers/page_controller_spec.rb ../../config/environment /Users/perry_mac/rails_projects/pc/spec/spec_helper.rb /Users/perry_mac/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:240: stack level too deep (SystemStackError) perrys-MacBook-Pro:pc perry_mac$ </code></pre> <p>... but am not sure what the implications are based on the output.</p> <p>ADDENDUM 6:<br> Using pry, I stepped through the code. A pastebin of the output just before failure is here: <a href="http://pastebin.com/c6ZfPmVn" rel="nofollow">http://pastebin.com/c6ZfPmVn</a> Is this helpful or should I include something else? Looks like execution continues up until this point:</p> <pre><code>/Users/perry_mac/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.13.1/lib/rspec/core.rb @ line 69 RSpec.reset </code></pre> <p>ADDENDUM 7: I just confirmed I can checkout an older git branch that has working rspec and cucumber. Could having a working branch help me debug the more recent broken branch in any way? </p> <p>Addendum 8: According to the Pry execution trace, the error happens immediately after a call to Rspec.reset </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload