Skip to content

Instantly share code, notes, and snippets.

@gitkeeper
Created December 29, 2011 16:16
Show Gist options
  • Save gitkeeper/1534787 to your computer and use it in GitHub Desktop.
Save gitkeeper/1534787 to your computer and use it in GitHub Desktop.
General purpose RSpec Rake tasks - useful for most projects.
require "rspec/core/rake_task"
namespace :spec do
default_opts = ["--format progress", "--color"]
desc "Run all specs"
RSpec::Core::RakeTask.new(:all) do |t|
t.rspec_opts = [*default_opts]
end
desc "Run all specs that should pass"
RSpec::Core::RakeTask.new(:ok) do |t|
t.rspec_opts = [*default_opts, "--tag ~wip"]
end
desc "Run specs that are being worked on"
RSpec::Core::RakeTask.new(:wip) do |t|
t.rspec_opts = [*default_opts, "--tag wip"]
end
desc "Run all specs and show the ten slowest examples"
RSpec::Core::RakeTask.new(:profile) do |t|
t.rspec_opts = [*default_opts, "--profile", "--tag ~wip"]
end
end
desc "Alias for spec:ok"
task spec: "spec:ok"
RSpec.configure do |c|
c.treat_symbols_as_metadata_keys_with_true_values = true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment