diff --git a/.gitignore b/.gitignore index 8f784de9f..bc97d1d63 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,6 @@ yarn-debug.log* .yarn-integrity .env + +# Code coverage results +/coverage diff --git a/Gemfile b/Gemfile index 5ba5edb6d..1d895073c 100644 --- a/Gemfile +++ b/Gemfile @@ -30,6 +30,7 @@ group :development, :test do gem "factory_bot_rails" gem "pry-byebug" gem "selenium-webdriver" + gem "simplecov" %w[rspec-core rspec-expectations rspec-mocks rspec-rails rspec-support].each do |lib| gem lib, git: "https://github.com/rspec/#{lib}.git", branch: "main" end diff --git a/Gemfile.lock b/Gemfile.lock index 18b43466a..46a7f1ad1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -129,6 +129,7 @@ GEM crass (1.0.6) deep_merge (1.2.1) diff-lcs (1.4.4) + docile (1.4.0) dotenv (2.7.6) dotenv-rails (2.7.6) dotenv (= 2.7.6) @@ -280,6 +281,12 @@ GEM childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) semantic_range (3.0.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.3) sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -346,6 +353,7 @@ DEPENDENCIES rubocop-rails scss_lint-govuk selenium-webdriver + simplecov tzinfo-data web-console (>= 4.1.0) webpacker (~> 5.0) diff --git a/spec/controllers/case_logs_controller_spec.rb b/spec/controllers/case_logs_controller_spec.rb index 798074466..75c80705c 100644 --- a/spec/controllers/case_logs_controller_spec.rb +++ b/spec/controllers/case_logs_controller_spec.rb @@ -33,7 +33,6 @@ RSpec.describe CaseLogsController, type: :controller do describe "GET #edit" do it "returns a success response" do get :edit, params: { id: id } - puts response expect(response).to be_successful end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index efc2ff51f..e559ad024 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -15,6 +15,18 @@ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration require "factory_bot" +require "simplecov" + +SimpleCov.start "rails" do + add_filter "/bin/" + add_filter "/db/" + add_filter "/spec/" + add_filter "app/channels/application_cable/channel.rb" + add_filter "app/jobs/application_job.rb" + add_filter "app/mailers/application_mailer.rb" + add_filter "app/controllers/application_controller.rb" + add_filter "app/channels/application_cable/connection.rb" +end RSpec.configure do |config| # rspec-expectations config goes here. You can use an alternate