Skip to content

Commit 28caddb

Browse files
committed
1 parent 60dd19b commit 28caddb

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

spec/spec_helper.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# frozen_string_literal: true
22

3+
# For code coverage measurements to work properly, `SimpleCov` should be loaded
4+
# and started before any application code is loaded.
5+
if ENV.fetch('COVERAGE', nil) == 'true'
6+
require 'simplecov'
7+
SimpleCov.start
8+
end
9+
310
require 'rubocop-rails'
411
require 'rubocop/rspec/support'
512
require_relative 'support/file_helper'
@@ -9,11 +16,6 @@
916
# in ./support/ and its subdirectories.
1017
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
1118

12-
if ENV.fetch('COVERAGE', nil) == 'true'
13-
require 'simplecov'
14-
SimpleCov.start
15-
end
16-
1719
RSpec.configure do |config|
1820
config.shared_context_metadata_behavior = :apply_to_host_groups
1921
config.filter_run_when_matching :focus

0 commit comments

Comments
 (0)