开发者

Ruby on Rails: How to run a rake task for the env.rb?

开发者 https://www.devze.com 2023-01-03 20:58 出处:网络
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.

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消