I have the following task in lib/tasks:
task :cuke_test_db_constraints do puts 'cuke_test_db_constraints' ENV['TEST_DB_CONSTRAINTS'] = '1' Rake::Task['cucumber'].reenable Rake::Task['cucumber'].invoke end task :default => :cuke_test_db_constraints
As you see, I want to run cucumber again after setting an env variable. However, while cuke_test_db_constraints task runs, cucumber doesn't run scenarios. The cucumber task itself runs, I checked it with adding debug output under :cucumber task in lib/tasks/cucumber.rake.
Any ideas? Thanks.
You should declare that the cucumber
task depends on cuke_test_db_constraints
instead of imperatively invoking the task.
task :cuke_test_db_constraints do
puts 'cuke_test_db_constraints'
ENV['TEST_DB_CONSTRAINTS'] = '1'
end
task :default => :cucumber
task :cucumber => :cuke_test_db_constraints
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With