Skip to content

Commit e9c9544

Browse files
committed
DEV: Fix SimpleCov integration and add rake critique task
Move SimpleCov.start into spec_helper.rb so it loads before application code. The previous .simplecov file loaded too late for SimpleCov to detect RSpec, resulting in empty coverage data for RubyCritic. Add `rake critique` task that runs tests with coverage then RubyCritic.
1 parent b37af1e commit e9c9544

3 files changed

Lines changed: 15 additions & 9 deletions

File tree

.simplecov

Lines changed: 0 additions & 8 deletions
This file was deleted.

Rakefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,10 @@ task :fix do
1515
sh "bundle exec stree write '**/*.rb' '**/*.rake' Gemfile Rakefile *.gemspec"
1616
end
1717

18+
desc "Run RubyCritic with coverage (runs tests first)"
19+
task :critique do
20+
sh "COVERAGE=1 bundle exec rspec --format progress"
21+
sh "bundle exec rubycritic"
22+
end
23+
1824
task default: %i[fix spec]

spec/spec_helper.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# frozen_string_literal: true
22

3-
require "simplecov" if ENV["COVERAGE"]
3+
if ENV["COVERAGE"]
4+
require "simplecov"
5+
SimpleCov.start do
6+
command_name "RSpec"
7+
add_filter "/examples/"
8+
add_filter "/spec/"
9+
end
10+
end
11+
412
require "markbridge/all"
513

614
SPEC_ROOT = Pathname(__dir__)

0 commit comments

Comments
 (0)