Skip to content

Commit

Permalink
Add SimpleCov support to calculate code coverage
Browse files Browse the repository at this point in the history
This will add a new dependency to the test group and require SimpleCov if COVERAGE=true when running the test suite.
  • Loading branch information
etagwerker committed Sep 26, 2022
1 parent baa0ff6 commit d878647
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ group :test do
gem "launchy"
gem "selenium-webdriver"
gem "shoulda-matchers"
gem "simplecov"
gem "timecop"
gem "webdrivers"
gem "webmock"
Expand Down
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ GEM
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
diff-lcs (1.4.4)
docile (1.4.0)
dotenv (2.8.1)
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
Expand Down Expand Up @@ -286,6 +287,12 @@ GEM
faraday (>= 1.0)
shoulda-matchers (5.1.0)
activesupport (>= 5.2.0)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
smart_properties (1.17.0)
sprockets (4.1.1)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -355,6 +362,7 @@ DEPENDENCIES
selenium-webdriver
sentry-raven
shoulda-matchers
simplecov
timecop
uglifier
unicorn
Expand Down
9 changes: 9 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
if ENV["COVERAGE"] == "true"
puts "Calculating Code Coverage with SimpleCov"

require "simplecov"
SimpleCov.start "rails"

puts "Required SimpleCov"
end

# http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
Expand Down

0 comments on commit d878647

Please sign in to comment.