Skip to content

Instantly share code, notes, and snippets.

@gitkeeper
Created December 29, 2011 16:17
Show Gist options
  • Save gitkeeper/1534790 to your computer and use it in GitHub Desktop.
Save gitkeeper/1534790 to your computer and use it in GitHub Desktop.
General purpose Cucumber Rake tasks - useful for most projects.
require "cucumber/rake/task"
namespace :cucumber do
default_opts = ["--format progress", "--color"]
Cucumber::Rake::Task.new(:all, "Run all features") do |t|
t.cucumber_opts = [*default_opts]
end
Cucumber::Rake::Task.new(:ok, "Run all features that should pass") do |t|
t.cucumber_opts = [*default_opts, "--strict", "--tags ~@wip"]
end
Cucumber::Rake::Task.new(:wip, "Run features that are being worked on") do |t|
t.cucumber_opts = ["--format pretty", "--color", "--wip", "--tags @wip"]
end
Cucumber::Rake::Task.new(:rerun, "Record and rerun failing features") do |t|
t.cucumber_opts = [*default_opts, "--strict", "--tags ~@wip",
"--format rerun", "--out rerun.txt"]
failing_features = File.exists?("rerun.txt") ? File.read("rerun.txt") : ""
t.cucumber_opts << failing_features unless failing_features.empty?
end
end
desc "Alias for cucumber:ok"
task cucumber: "cucumber:ok"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment