1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
require File.expand_path('../spec_suite_configuration', __FILE__)
require 'ostruct'
class DefinesSpecSuiteTasks
extend Rake::DSL
def self.configuration
@configuration ||= SpecSuiteConfiguration.build
end
def self.call
desc 'Run all tests'
task :spec do
results = []
DefinesSpecSuiteTasks.configuration.each_matching_suite.each do |suite|
puts "=== Running #{suite.desc} tests ================================================"
results << suite.run
puts
end
if results.any? { |result| not result.success? }
raise 'Spec suite failed!'
end
end
namespace :spec do
DefinesSpecSuiteTasks.configuration.each_matching_suite do |suite|
desc "Run #{suite.desc} tests"
task suite.name => "appraisal:#{suite.appraisal_name}:install" do
result = suite.run
if not result.success?
raise "#{suite.desc} suite failed!"
end
end
end
require 'rspec/core/rake_task'
desc "Run the unit tests"
RSpec::Core::RakeTask.new(:unit) do |t|
t.pattern = 'spec/suites/rspec_2/unit/**/*_spec.rb'
end
desc "Run the functional (API) tests"
RSpec::Core::RakeTask.new(:functional) do |t|
t.pattern = 'spec/suites/rspec_2/functional/**/*_spec.rb'
end
end
namespace :travis do
desc 'Regenerate .travis.yml'
task :regenerate_config do
DefinesSpecSuiteTasks.configuration.generate_travis_config
end
end
end
end
|