Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (23 sloc) 700 Bytes
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:test)
desc 'Check code coverage'
task :coverage do
require_relative 'ohm'
err = ''
{
'components' => '',
'arithmetic' => 'Æ',
'constants' => 'α',
'extras' => '·',
'time' => 'υ'
}.each do |str, char|
file = File.read("spec/#{str}_spec.rb", encoding: 'utf-8')
not_found = (
Ohm::COMPONENTS[char] ||
Ohm::COMPONENTS.reject {|_, h| h.keys.all? {|k| k.is_a?(String)}}
).keys.map {|c| char + c}.reject {|c| file.include?(c)}
err << "No tests found for #{not_found.join(', ')} in #{str} spec\n" unless not_found.empty?
end
abort err unless err.empty?
end
task default: [:test]
You can’t perform that action at this time.