views:

15

answers:

1

in features/support/env.rb in cucumber, i would like to have a rake task run everytime i start my tests... but not before each scenario.. just.. once.

This is what i need to run

Rake::Task["db:test:prepare"].reenable
Rake::Task["db:test:prepare"].invoke
A: 

Assuming a standard cucumber install with the rake file cucumber.rake in app/lib/tasks.

Something like this should work

task :data_prep
    Rake::Task["db:test:prepare"].reenable  
    Rake::Task["db:test:prepare"].invoke
end

task :all => [:data_prep,:ok,:wip]
task :default => [:data_prep,:cucumber]

All you do is define another task (:data_prep) and add a call to it for the existing cucumber tasks.

Not the cleanest of methods but I cannot remember if cucumber has a method to run on startup and not on a per scenario basis.

David Lyod