Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Undefined variable in Cucumber step definition triggers SystemStackError in rspec #67
In a Rails 3.0.5 application with Ruby 1.9.2p180, rspec-expectations 2.5.0 and Cucumber 0.10.2, I am experiencing that SystemStackError is raised from within RSpec. The trigger is to refer to an undefined variable within a Cucumber step definition, like so:
This results in SystemStackError from line 7 of /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rspec-expectations-2.5.0/lib/rspec/matchers/method_missing.rb.
See my IRC conversation with Aslak Hellesøy for reference.
No, that's the correct way to use the latest rspec-core from git.
So here's the deal...this is a bug in ruby 1.9. Any module that includes a method that calls
We fixed this in rspec-core (see the commit I referenced above) by changing the point in time we include RSpec::Matchers so that it is included in RSpec::Core::ExampleGroup before RSpec::Core::ExampleGroup is subclassed. I don't know much about how cucumber uses rspec-expectations, but my guess is that it is using it on its own (without using RSpec::Core::ExampleGroup), so it makes sense that my fix above wouldn't affect cucumber. I think we're going to need to fix this in cucumber itself by changing the way it includes RSpec::Matchers (just like we did in rspec-core).
Can you come up with a minimal failing case? Just a bit of code that uses cucumber and demonstrates this bug will suffice. Based on that, I'll take a look at coming up with a fix in cucumber and see if i can submit it as a pull request.
If it's ok to make it public, you can just put it on github, and post the link. If you do this, it'd be good to make a branch for this so you can continue developing on your master branch and I have a point to work off that is known to demonstrate the bug.
If you can't make it public, but are ok with me having access to it to troubleshoot this, feel free to make a zip or tar archive file of the whole project, and send me an email with it attached.
Also, instructions of how to get a dev enviroment and how to repro the bug would be helpful.