Skip to content

Instantly share code, notes, and snippets.

@fhwang
Created February 22, 2012 20:55
Embed
What would you like to do?
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