public

  • Download Gist
cucumber_with_selenium.rake
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
require 'cucumber/rake/task'
 
namespace :cucumber do
Cucumber::Rake::Task.new(:plain) do |t|
t.cucumber_opts = "--format pretty"
t.step_list = %w{features/support/env.rb features/support/plain.rb features/step_definitions}
t.feature_list = %w{features/plain}
end
task :plain => 'db:test:prepare'
 
Cucumber::Rake::Task.new(:selenium, "Run features with Cucumber+Selenium from features/selenium, inside browsers") do |t|
t.cucumber_opts = "--format pretty"
t.step_list = %w{features/support/env.rb features/support/selenium.rb features/step_definitions}
t.feature_list = %w{features/selenium}
end
task :selenium => 'db:test:prepare'
end
 
desc "shortcut for cucumber:plain"
task :features => 'cucumber:plain'
 
# features/support/env.rb is default from cucumber
features/support/plain.rb
Ruby
1 2 3 4 5 6 7 8
Job.destroy_all
Local.destroy_all
 
Cucumber::Rails.use_transactional_fixtures
 
Webrat.configure do |config|
config.mode = :rails
end
features/support/selenium.rb
Ruby
1 2 3 4 5 6 7 8 9 10
Webrat.configure do |config|
config.mode = :selenium
# Selenium defaults to using the selenium environment. Use the following to override this.
config.application_environment = :test
end
 
Before do
Job.destroy_all
Local.destroy_all
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.