Ben Men
2008-Jun-05 17:29 UTC
[rspec-users] RSpec Story - SystemStackError: stack level too deep
I have a story that executes the following (as an example to show the bug I''m experiencing): ---------------------------------------------- Given "I have a fake post saved" do @postCount = Post.find(:all).length @post = Post.new @post.employee_id = 123 @post.name = "Name of the Post" @post.description = "Description of the Post" @post.save end Given "I have visited some page" do get("/posts/") end When "I get some other page" do get(''/posts/''+ at post.id) end Then "my variable should still be set" do Post.find(:all).length.should == 1 + @postCount end ---------------------------------------------- It fails with "SystemStackError: stack level too deep" on the "When I get some other page" bit. If I remove the + at post.id bit, OR if I switch the order execution of the Given statements, the story works. What''s going on? Is this a bug, or am I just missing something? Additionally, I''ve tried updating to RSpec Edge by running "script/plugin install git://github.com/dchelimsky/rspec", but I keep receiving Plugin not found: ["git://github.com/dchelimsky/rspec"]. -- Posted via http://www.ruby-forum.com/.
Willem van den Ende
2008-Jun-08 12:56 UTC
[rspec-users] RSpec Story - SystemStackError: stack level too deep
Hi Ben, This is probably not an rspec issue, but a rails defect ( http://dev.rubyonrails.org/ticket/10896 ).>From your code, I am assuming you are story testing a Rails app. I wasbitten by this too recently... Took me a while to figure it out. The workaround is to replace post.id by post[:id] Looks ugly, but it works. On your second question, my guess is the script/install plugin from git only works as of rails 2.1.0 . At least that is what I understood from reading http://github.com/dchelimsky/rspec-rails/wikis/home I followed the steps under "Install an RSpec release >= 1.1.4:" and that worked on 2.0.2 . Hope this helps, Willem van den Ende p.s. I just joined the mailing list and found Ben''s question in the archive. it didn''t seem to have an answer yet. apologies for double posting if it already has p.s II. I got hooked on story testing after seeing David Chelimsky''s presentation at qcon london this spring. On June 5, Ben Men Wrote:> I have a story that executes the following (as an example to show the > bug I''m experiencing): > > ---------------------------------------------- > > Given "I have a fake post saved" do > @postCount = Post.find(:all).length > @post = Post.new > @post.employee_id = 123 > @post.name = "Name of the Post" > @post.description = "Description of the Post" > @post.save > end > > Given "I have visited some page" do > get("/posts/") > end > > When "I get some other page" do > get(''/posts/''+ at post.id) > end > > Then "my variable should still be set" do > Post.find(:all).length.should == 1 + @postCount > end > > ---------------------------------------------- > > It fails with "SystemStackError: stack level too deep" on the "When I > get some other page" bit. If I remove the + at post.id bit, OR if I switch > the order execution of the Given statements, the story works. What''s > going on? Is this a bug, or am I just missing something? > > Additionally, I''ve tried updating to RSpec Edge by running > "script/plugin install git://github.com/dchelimsky/rspec", but I keep > receiving Plugin not found: ["git://github.com/dchelimsky/rspec"]. > -- > Posted via http://www.ruby-forum.com/.
Ben Men
2008-Jun-10 17:18 UTC
[rspec-users] RSpec Story - SystemStackError: stack level too deep
Willem van den Ende wrote:> Hi Ben, > > This is probably not an rspec issue, but a rails defect > ( http://dev.rubyonrails.org/ticket/10896 ). > >>From your code, I am assuming you are story testing a Rails app. I was > bitten by this too recently... Took me a while to figure it out. The > workaround is to replace > > post.id > > by > > post[:id] > >Thank you so much Willem, I only just saw your post and it did indeed fix my issue. -- Posted via http://www.ruby-forum.com/.