Sha256: 14768187452805066977874d864455cc49ca63361203fc2c7a47a9e8b252ac22

Contents?: true

Size: 1.51 KB

Versions: 14

Compression:

Stored size: 1.51 KB

Contents

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rr-3.1.1 spec/defines_spec_suite_tasks.rb
rr-3.1.0 spec/defines_spec_suite_tasks.rb
rr-3.0.9 spec/defines_spec_suite_tasks.rb
rr-3.0.8 spec/defines_spec_suite_tasks.rb
rr-3.0.7 spec/defines_spec_suite_tasks.rb
rr-3.0.6 spec/defines_spec_suite_tasks.rb
rr-3.0.5 spec/defines_spec_suite_tasks.rb
rr-3.0.4 spec/defines_spec_suite_tasks.rb
rr-3.0.3 spec/defines_spec_suite_tasks.rb
rr-3.0.2 spec/defines_spec_suite_tasks.rb
rr-3.0.1 spec/defines_spec_suite_tasks.rb
rr-3.0.0 spec/defines_spec_suite_tasks.rb
rr-1.2.1 spec/defines_spec_suite_tasks.rb
rr-1.2.0 spec/defines_spec_suite_tasks.rb