Sha256: 2c8c4bd35eb2cf394f7897bab7c870c9b8a53040129c53a6caa4883aead5d276
Contents?: true
Size: 1.63 KB
Versions: 4
Compression:
Stored size: 1.63 KB
Contents
begin require "simplecov" def set_coverage_dir coverage_dir report = File.join(coverage_dir, 'index.html') if File.exists?(report) SimpleCov.coverage_dir coverage_dir else RakeNBake::AssistantBaker.log_warn "SimpleCov report could not be found at #{report}" fail end end def check_coverage_level_above level coverage = SimpleCov.result.covered_percent if coverage >= level RakeNBake::AssistantBaker.log_passed "Feature coverage is at #{coverage}%" else RakeNBake::AssistantBaker.log_warn "Spec coverage was only #{coverage}%" fail end end namespace :bake do namespace :coverage do COVERAGE_PERCENT = ENV['COVERAGE_PERCENT'] || 100.0 desc 'Check coverage from RSpec' task :check_specs do RakeNBake::AssistantBaker.log_step 'Checking spec coverage' coverage_dir = 'log/coverage/spec' set_coverage_dir(coverage_dir) check_coverage_level_above COVERAGE_PERCENT end desc 'Check coverage from Cucumber' task :check_cucumber do RakeNBake::AssistantBaker.log_step 'Checking feature coverage' coverage_dir = 'log/coverage/features' set_coverage_dir(coverage_dir) check_coverage_level_above COVERAGE_PERCENT 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rake-n-bake-1.4.1 | tasks/coverage.rake |
rake-n-bake-1.4.0 | tasks/coverage.rake |
rake-n-bake-1.3.3 | tasks/coverage.rake |
rake-n-bake-1.3.1 | tasks/coverage.rake |