Skip to content

Instantly share code, notes, and snippets.

@fhwang
Created February 22, 2012 20:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fhwang/1887192 to your computer and use it in GitHub Desktop.
Save fhwang/1887192 to your computer and use it in GitHub Desktop.
Rake tasks for running spec files that match a pattern. Developed for the good folks at HowAboutWe.
namespace :spec do
namespace :units do
desc "Run unit specs with PATTERN in the spec file name"
RSpec::Core::RakeTask.new(:selective => "db:test:prepare") do |t|
t.pattern = FileList["spec/**/*#{ENV['PATTERN']}*_spec.rb"].exclude("spec/integration/**/*_spec.rb")
end
end
namespace :integration do
desc "Run integration specs with PATTERN in the spec file name"
RSpec::Core::RakeTask.new(:selective => "db:test:prepare") do |t|
t.pattern = FileList["spec/integration/**/*#{ENV['PATTERN']}*_spec.rb"]
end
end
desc "Run all specs with PATTERN in the spec file name"
task :selective => ["spec:units:selective", "spec:integration:selective"]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment