[rspec-users] Cucumber rake/webrat issue.

Matthew Van Horn mattvanhorn at gmail.com
Tue May 19 07:13:09 EDT 2009


On May 18, 2009, at 3:08 PM, Ben Mabey wrote:

> Matthew Van Horn wrote:
>> I'm probably missing something really obvious, but I just upgraded  
>> cucumber, rspec/rails, and webrat on a project, and for some  
>> reason, cucumber is not seeing any of the webrat steps (or bmabey's  
>> email steps) when running from rake.  It seems ok when running  
>> using the cucumb
>
>
> Did you read the History on how to upgrade?  If not see if it  
> helps.. here is the pertinent info:
>
> ** IMPORTANT UPGRADE NOTES FOR RAILS USERS **
>
> Running Cucumber features in the same Ruby interpreter as Rake  
> doesn't seem to work,
> so you have to explicitly tell the task to fork (like it was doing  
> by default in prior
> versions). In lib/tasks/cucumber.rake:
>
> Cucumber::Rake::Task.new(:features) do |t|
>   t.fork = true # Explicitly fork
>   t.cucumber_opts = %w{--format pretty}
> end
>
> (If you run script/generate cucumber this will be done for you).
> Alternatively you can omit forking and run features like this:
>
> RAILS_ENV=test rake features
>
> However, setting the RAILS_ENV is easy to forget, so I don't  
> recommend relying on this.
>
>
> -Ben

I posted this on the new list, but this is what I had, and it looks  
correct to me. (I re-ran the generator.)

>> Lib tasks cucumber.rake looks like:
>> $LOAD_PATH.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib') if  
>> File.directory?(RAILS_ROOT + '/vendor/plugins/cucumber/lib')
>>
>> begin
>>  require 'cucumber/rake/task'
>>
>>  Cucumber::Rake::Task.new(:features) do |t|
>>    t.fork = true
>>    t.cucumber_opts = %w{--format pretty}
>>  end
>>  task :features => 'db:test:prepare'
>> rescue LoadError
>>  desc 'Cucumber rake task not available'
>>  task :features do
>>    abort 'Cucumber rake task is not available. Be sure to install  
>> cucumber as a gem or plugin'
>>  end
>> end


More information about the rspec-users mailing list