-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
In a recent project we kicked off with raygun
I turned on simple cov and because the default spec was broken into spec:without_features and spec:features, I think the coverage reports were getting clobbered.
I fixed it on my local project with new tasks like so (maybe not the best way...)
# in lib/tasks/cane.rake
begin
require 'cane/rake_task'
desc "Run cane to check quality metrics"
Cane::RakeTask.new(:quality) do |cane|
cane.abc_max = 10
cane.add_threshold 'coverage/covered_percent', :>=, 98
cane.no_style = true
cane.abc_exclude = %w()
cane.doc_exclude = %w(lib/templates/**/*)
end
task :default => :quality
rescue LoadError
# warn "cane not available, quality task not provided."
end# in lib/tasks/coverage.rake
namespace :spec do
task :enable_coverage do
ENV['COVERAGE'] = '1'
end
desc "Executes specs with code coverage reports"
task coverage: :enable_coverage do
Rake::Task[:'spec:all'].invoke
end
end# in lib/tasks/spec.rake
namespace :spec do
desc "Run the code examples in spec/ except those in spec/features"
RSpec::Core::RakeTask.new('without_features' => 'db:test:prepare') do |t|
file_list = FileList['spec/**/*_spec.rb'].exclude('spec/features/**/*_spec.rb')
t.pattern = file_list
end
RSpec::Core::RakeTask.new('all' => 'db:test:prepare') do |t|
file_list = FileList['spec/**/*_spec.rb']
t.pattern = file_list
end
desc 'Runs specs with coverage and cane checks'
task cane: ['spec:enable_coverage', 'spec:coverage', 'quality']
endMetadata
Metadata
Assignees
Labels
No labels