Sha256: 61e82486cfa89d8032d43b7facde71ea0a06e8515a13df55bbec842c3e285e31
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
require "bundler/gem_tasks" require "rspec/core/rake_task" require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |t| t.pattern = "./spec/**/*_spec.rb" ENV['COVERAGE'] = 'true' end namespace :commitment do task :configure_test_for_code_coverage do ENV['COVERAGE'] = 'true' end task :code_coverage do require 'json' $stdout.puts "Checking code_coverage" lastrun_filename = File.expand_path('../coverage/.last_run.json', __FILE__) if File.exist?(lastrun_filename) coverage_percentage = JSON.parse(File.read(lastrun_filename)).fetch('result').fetch('covered_percent').to_i EXPECTED_COVERAGE_GOAL = 98 if coverage_percentage < EXPECTED_COVERAGE_GOAL abort("ERROR: Code Coverage Goal Not Met:\n\t#{coverage_percentage}%\tExpected\n\t#{EXPECTED_COVERAGE_GOAL}%\tActual") else $stdout.puts "Code Coverage Goal Met (at least #{EXPECTED_COVERAGE_GOAL}% coverage)" end else abort "Expected #{lastrun_filename} to exist for code coverage" end end end task(default: ['commitment:configure_test_for_code_coverage', :spec, 'commitment:code_coverage']) task(build: :default) task(release: :default)
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gm-notepad-0.0.17 | Rakefile |
gm-notepad-0.0.10 | Rakefile |
gm-notepad-0.0.9 | Rakefile |