Created
March 20, 2014 11:42
-
-
Save rdark/9661974 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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