Skip to content

Commit 7a5b0f4

Browse files
committed
Bundle with support for SimpleCov
Add support for SimpleCov in `spec_helper.rb` so that it is loaded only when the COVERAGE environment variable is present
1 parent b3f3ef6 commit 7a5b0f4

File tree

2 files changed

+44
-16
lines changed

2 files changed

+44
-16
lines changed

Gemfile.lock

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,47 @@
11
PATH
22
remote: .
33
specs:
4-
next_rails (1.0.0)
4+
next_rails (1.0.2)
55
actionview
66
colorize (>= 0.8.1)
77

88
GEM
99
remote: https://rubygems.org/
1010
specs:
11-
actionview (5.2.3)
12-
activesupport (= 5.2.3)
11+
actionview (6.0.2.1)
12+
activesupport (= 6.0.2.1)
1313
builder (~> 3.1)
1414
erubi (~> 1.4)
1515
rails-dom-testing (~> 2.0)
16-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
17-
activesupport (5.2.3)
16+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
17+
activesupport (6.0.2.1)
1818
concurrent-ruby (~> 1.0, >= 1.0.2)
1919
i18n (>= 0.7, < 2)
2020
minitest (~> 5.1)
2121
tzinfo (~> 1.1)
22-
builder (3.2.3)
22+
zeitwerk (~> 2.2)
23+
builder (3.2.4)
2324
colorize (0.8.1)
2425
concurrent-ruby (1.1.5)
25-
crass (1.0.4)
26+
crass (1.0.6)
2627
diff-lcs (1.3)
27-
erubi (1.8.0)
28-
i18n (1.6.0)
28+
docile (1.3.2)
29+
erubi (1.9.0)
30+
i18n (1.8.2)
2931
concurrent-ruby (~> 1.0)
30-
loofah (2.2.3)
32+
json (2.3.0)
33+
loofah (2.4.0)
3134
crass (~> 1.0.2)
3235
nokogiri (>= 1.5.9)
3336
mini_portile2 (2.4.0)
34-
minitest (5.11.3)
35-
nokogiri (1.10.3)
37+
minitest (5.14.0)
38+
nokogiri (1.10.7)
3639
mini_portile2 (~> 2.4.0)
3740
rails-dom-testing (2.0.3)
3841
activesupport (>= 4.2.0)
3942
nokogiri (>= 1.6)
40-
rails-html-sanitizer (1.0.4)
41-
loofah (~> 2.2, >= 2.2.2)
43+
rails-html-sanitizer (1.3.0)
44+
loofah (~> 2.3)
4245
rake (10.5.0)
4346
rspec (3.8.0)
4447
rspec-core (~> 3.8.0)
@@ -53,10 +56,16 @@ GEM
5356
diff-lcs (>= 1.2.0, < 2.0)
5457
rspec-support (~> 3.8.0)
5558
rspec-support (3.8.2)
59+
simplecov (0.17.1)
60+
docile (~> 1.1)
61+
json (>= 1.8, < 3)
62+
simplecov-html (~> 0.10.0)
63+
simplecov-html (0.10.2)
5664
thread_safe (0.3.6)
5765
timecop (0.9.1)
58-
tzinfo (1.2.5)
66+
tzinfo (1.2.6)
5967
thread_safe (~> 0.1)
68+
zeitwerk (2.2.2)
6069

6170
PLATFORMS
6271
ruby
@@ -66,7 +75,8 @@ DEPENDENCIES
6675
next_rails!
6776
rake (~> 10.0)
6877
rspec (~> 3.0)
78+
simplecov (~> 0.17.1)
6979
timecop (~> 0.9.1)
7080

7181
BUNDLED WITH
72-
1.17.2
82+
1.17.3

spec/spec_helper.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
require "bundler/setup"
22
require "next_rails"
3+
if ENV['COVERAGE'] == 'true'
4+
require 'simplecov'
5+
SimpleCov.start do
6+
# Disambiguates individual test runs
7+
command_name "Job #{ENV["TEST_ENV_NUMBER"]}" if ENV["TEST_ENV_NUMBER"]
8+
9+
if ENV['CI']
10+
formatter SimpleCov::Formatter::SimpleFormatter
11+
else
12+
formatter SimpleCov::Formatter::MultiFormatter.new([
13+
SimpleCov::Formatter::SimpleFormatter,
14+
SimpleCov::Formatter::HTMLFormatter
15+
])
16+
end
17+
18+
track_files "lib/**/*.rb"
19+
end
20+
end
321

422
RSpec.configure do |config|
523
# Enable flags like --only-failures and --next-failure

0 commit comments

Comments
 (0)