Fixes Bundler --pre issue that only arrises if cucumber-rails is included outside of group :test.
Its a real edge case, but the fix was pretty painless and actually makes the code base more robust.
Basically any require of lib/cucumber/rails.rb will be ignored unless the call is from env.rb.
I also added a warning message to admonish users to put cucumber-rails under group :test (if the edge case is triggered)
Created fix_bundler_pre feature and step definitions
Fixed rails.rb to only run setup if env.rb calls it, otherwise throw …
I did create a ticket for bundler btw: bundler/bundler#1448
The instructions in the warning message were not enough to prevent the warning for me.
Apart from moving cucumber-rails to a test-only bundler group, I had to prevent it being loaded by Bundler:
gem "cucumber-rails", "~> 1.0", require: false
Here's the backtrace of the warning I was getting prior to adding require: false:
/Users/paul/.rbenv/versions/1.9.3-rc1/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/runtime.rb:76:in `rescue in block in require'
/Users/paul/.rbenv/versions/1.9.3-rc1/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/runtime.rb:62:in `block in require'
/Users/paul/org/project/config/application.rb:7:in `<top (required)>'
/Users/paul/org/project/config/environment.rb:2:in `<top (required)>'
/Users/paul/org/project/spec/spec_helper.rb:8:in `<top (required)>'
/Users/paul/org/project/spec/models/example_spec.rb:1:in `<top (required)>'
/Users/paul/.rbenv/versions/1.9.3-rc1/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.0/lib/rspec/core/configuration.rb:459:in `block in load_spec_files'
/Users/paul/.rbenv/versions/1.9.3-rc1/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.0/lib/rspec/core/runner.rb:10:in `block in autorun'
WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being defered until env.rb is called.
To avoid this warning, move 'gem cucumber-rails' under only group :test in your Gemfile
same here, I already had the gem in the test group, but that didn't stop this message from showing up. using require: false solved this for now.
What kind of ruby syntax is require: false ? Is that a new way to make a Hash?
Yes, it's the Ruby 1.9 style of assigning values in a hash. See here for the best explanation on the entire web.
Sorry for taking so long to get back about this...
I'm guessing that since you use require: false the cucumber-rails lib isn't getting loaded by bundler.
Could you try it without the require: false and get back to me about whether it worked?
Folks, please open a new ticket. This is a closed pull request.