Skip to content

Commit

Permalink
Added simplecov to get spec coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
luccastera committed Feb 8, 2024
1 parent d3aeed7 commit dcdca70
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@

node_modules

coverage

# Ignore the build directory
/app/assets/builds
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ group :development do
gem 'annotate'
end

group :test do
gem "simplecov"
gem "simplecov-tailwindcss"
end

# Used to soft delete records
gem "discard"

Expand Down
11 changes: 11 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ GEM
diff-lcs (1.5.1)
discard (1.3.0)
activerecord (>= 4.2, < 8)
docile (1.4.0)
dotenv (2.8.1)
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
Expand Down Expand Up @@ -276,6 +277,14 @@ GEM
ruby2_keywords (0.0.5)
shoulda-matchers (6.1.0)
activesupport (>= 5.2.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov-tailwindcss (2.2.0)
simplecov (~> 0.16)
simplecov_json_formatter (0.1.4)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
Expand Down Expand Up @@ -346,6 +355,8 @@ DEPENDENCIES
rubocop (~> 1.27.0)
rubocop-rails
shoulda-matchers
simplecov
simplecov-tailwindcss
sprockets-rails
stimulus-rails
tailwindcss-rails
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To install and run the application locally:
1. `bin/rails db:migrate`
1. Edit your credentials/secrets using `bin/rails credentials:edit`.
1. Install foreman: `gem install foreman`
1. Run the specs with `bin/ci`
1. Run the specs with `bin/ci` and check spec coverage with `open coverage/index.html`
1. Start the application in development mode with `bin/dev`
1. Visit [http://localhost:3009/](http://localhost:3009)

Expand Down
15 changes: 15 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@
# a separate helper file that requires the additional dependencies and performs
# the additional setup, and require it from the spec files that actually need
# it.

require 'simplecov'
require 'simplecov-tailwindcss'

SimpleCov.start 'rails' do
enable_coverage :branch
primary_coverage :branch
minimum_coverage line: 80, branch: 75
maximum_coverage_drop 5
add_group 'Blueprints', 'app/blueprints'
end
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::TailwindFormatter
])

#
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
Expand Down

0 comments on commit dcdca70

Please sign in to comment.