stephenmurdoch
stephenmurdoch

Reputation: 34623

Guardfile's spork block expects a cucumber environment to exist... should it?

I've got guard, spork, cucumber and rspec working away on my system. All my specs and features run nicely but one thing puzzles me.

When I run guard init spork, the Guardfile that is created contains the following:

guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'cucumber' }, :rspec_env => { 'RAILS_ENV' => 'test' } do

But this causes an error because I do not have a cucumber.rb file in my enironments folder. So to get this working I change the code to

guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do

Now my question is, why does guard/spork subsume that my application would have a cucumber.rb file in config/environments? Should I be running cucumber in it's own environment? Should I create a cucumber.rb file by hand? I'd have thought that rails g cucumber:install would have done that for me if it was so important.

Using the latest released versions of cucumber, rspec and guard-* gems

Upvotes: 2

Views: 393

Answers (1)

Pan Thomakos
Pan Thomakos

Reputation: 34350

The reason is that in earlier versions of cucumber, the cucumber:install generator actually created its own cucumber environment. This is no longer the case in the later versions of the gem, but the guard-spork gem still assumes the RAILS_ENV is cucumber instead of test. I use the same gem and made the same configuration change and everything is working as I would expect.

Upvotes: 2

Related Questions