Sha256: 3d78b3bb67f911d39a3f3598f790e256eb3147a0f9e1bc50748a82904b31eade

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

begin
  require "simplecov"

  namespace :bake do
    namespace :coverage do
      desc 'Check coverage from RSpec'
      task :check_specs do
        RakeNBake::AssistantBaker.log_step 'Checking spec coverage'
        SimpleCov.coverage_dir 'log/coverage/spec'
        coverage = SimpleCov.result.covered_percent
        fail "Spec coverage was only #{coverage}%" if coverage < 100.0
        RakeNBake::AssistantBaker.log_passed "Spec coverage is at #{coverage}%"
      end

      desc 'Check coverage from Cucumber'
      task :check_cucumber do
        RakeNBake::AssistantBaker.log_step 'Checking feature coverage'
        SimpleCov.coverage_dir 'log/coverage/features'
        coverage = SimpleCov.result.covered_percent
        fail "Feature coverage was only #{coverage}%" if coverage < 100.0
        RakeNBake::AssistantBaker.log_passed "Feature coverage is at #{coverage}%"
      end
    end
  end

rescue LoadError

  namespace :bake do
    namespace :coverage do
      %w[check_specs check_cucumber].map(&:to_sym).each do |t|
        desc 'SimpleCov rake tasks are not available (gem not installed)'
        task t do
          RakeNBake::AssistantBaker.log_missing_gem 'simplecov', 'SimpleCov'
          abort
        end
      end
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rake-n-bake-1.3.0 tasks/coverage.rake
rake-n-bake-1.2.0 tasks/coverage.rake
rake-n-bake-1.1.5 tasks/coverage.rake
rake-n-bake-1.1.4 tasks/coverage.rake
rake-n-bake-1.1.3 tasks/coverage.rake