Skip to content

Instantly share code, notes, and snippets.

@rdark
Created March 20, 2014 11:42
Show Gist options
  • Save rdark/9661974 to your computer and use it in GitHub Desktop.
Save rdark/9661974 to your computer and use it in GitHub Desktop.
require 'rspec/core/rake_task'
DEFAULT_SUITE = [
{ :id => :lib_rimbaud, :title => 'Default test', :files => %w(spec/rimbaud/*_spec.rb) },
]
DELUXE_SUITE = [
{ :id => :ssh, :title => 'SSH tests', :dirs => %w(spec/suite/ssh) }
]
namespace :spec do
namespace :default do
DEFAULT_SUITE.each do |suite|
desc "Run all specs in #{suite[:title]} spec suite"
RSpec::Core::RakeTask.new(suite[:id]) do |t|
spec_files = []
if suite[:files]
suite[:files].each { |glob| spec_files += Dir[glob] }
end
if suite[:dirs]
suite[:dirs].each { |glob| spec_files += Dir["#{glob}/**/*_spec.rb"] }
end
end
end
end
namespace :deluxe do
DELUXE_SUITE.each do |suite|
desc "Run all specs in #{suite[:title]} spec suite"
RSpec::Core::RakeTask.new(suite[:id]) do |t|
spec_files = []
if suite[:files]
suite[:files].each { |glob| spec_files += Dir[glob] }
end
if suite[:dirs]
suite[:dirs].each { |glob| spec_files += Dir["#{glob}/**/*_spec.rb"] }
end
end
end
end
end
task :default => 'spec:default:lib_rimbaud'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment