The Path to Rails 8 -Remediate Code Coverage Issue Introduced by the 7.1 Upgrade @StatelessCode
The Path to Rails 8 -Remediate Code Coverage Issue Introduced by the 7.1 Upgrade  @StatelessCode
Uploaded May 2025 | Updated September 2026, 3 weeks ago
We use the SimpleCov gem and our GitHub Action to report code coverage information to Coveralls, which provides code coverage metrics reporting for open source projects for free. In Rails 7.1, a feature was introduced where bin/rails test now runs test:prepare task. In most cases this provides a benefit, but when it comes to our test coverage measurement and reporting, this change poses a problem.

We explore an issue in the SimpleCov GitHub repo that supports a similar issue with coverage reporting starting with Rails 7.1. We attempt to implement the solution offered, but it doesn't quite get things to the levels where they were before the upgrade.

After reviewing the line-level coverage, it turns out that the lines newly marked as uncovered aren't actually being tested, so the coverage reporting is more accurate now.

At the end, we inspect things, and the upgrade from 7.1 to 7.2 erased most of the inaccuracy anyway. We'll take it in stride and move on to the next video.

This video covers:
0:00:00 Introduction and overview of the problem
0:02:10 Demonstrate the issue using the local version of SimpleCov's HTML output files
0:03:02 Review the SimpleCov GitHub issue about coverage dropping on the Rails 7.1 upgrade
0:03:47 Update the config/boot.rb file to require the SimpleCov code there instead of the beginning of the test_helper
0:04:14 Add parallelization code to test_helper
0:04:26 Re-run test suite and evaluate results: Coverage not up to previous level but appears more accurate
0:05:19 Attempt variant ways to invoke the tests: No effect on coverage reporting, but number of hits per line changes
0:06:25 Try moving the SimpleCov.start block into the config/boot.rb file. Negligible difference but left in.
0:07:56 Decide it's good enough and commit the changes, fixing a weird whitespace issue in the process.
0:09:09 Verify that the coverage registers properly in the GitHub action and Coveralls after pushing
0:10:59 Concluding remarks and looking forward to the upcoming videos

#ruby #rails8 #simplecov #coveralls #rails #rubyonrails #rubygems #codecast #screencast #github #opensource #minitest #TDD #agile #NerdDice #DnD #roleplaying #softwaredevelopment #learntocode #tailwind #postgresql #rubocop #devise #turbo #controllers #views #selenium #capybara #systemtest

See other related StatelessCode videos:
- youtu.be/pztMKLIBFJ8
- youtu.be/Me53nwJu0K8
- youtu.be/QbeSvdAxknk
- youtu.be/RGmj7QcCVmM
- youtu.be/RR31ztGtrhA
- youtu.be/JimjiXQoGJ8
- youtu.be/FoCoBd2fZk4

Resources that we relied upon for this solution:
- Coverage dropped in Rails 7.1 (fixed) issue on SimpleCov repo github.com/simplecov-ruby/simplecov/issues/1082
- Upgrading Ruby on Rails guide (section on test:prepare) guides.rubyonrails.org/upgrading_ruby_on_rails.html#bin-rails-test-now-runs-test-prepare-task
- Rails 7.1 release notes guides.rubyonrails.org/7_1_release_notes.html
- Coveralls coveralls.io
- Coveralls Reborn github.com/tagliala/coveralls-ruby-reborn
- SimpeCov-Lcov github.com/fortissimo1997/simplecov-lcov

GitHub Commit for this Video:
- github.com/statelesscode/nerd_dice_dot_com/commit/a7da170

This video is CC0 - No rights reserved. (YouTube doesn't allow this option when publishing.) All code is released under the UNLICENSE. Stateless Code denies the concept of "intellectual property". Copying is not stealing.
The Path to Rails 8 -Remediate Code Coverage Issue Introduced by the 7.1 UpgradeRemove the Webdrivers Gem from a Rails 7 App and Update Selenium WebdriverCodecast: statelesscode.com WordPress 14: Add Finishing Touches and Launch the SiteCodecast: Getting Started with Rails 7 06: Resourceful Routes for Articles and the link_to HelperCodecast: Create a RubyGem 80: Refactor ConvenienceMethods - Part 2Codecast: Create a RubyGem 83: Ensure Adequate Commenting for ConvenienceMethods ModuleCodecast: Getting Started with Rails 7 14: Refactor into Comment PartialsCreate a RubyGem 92: Add Contributing Guidelines to the ProjectUpgrade a Rails 7 Application to Ruby 3.2.2Codecast: statelesscode.com WordPress 13: Upload Theme and Plugins to Real SiteNerdDice.com Retrospective 3 - The Retro that THEY Dont Want You to SeeChange RuboCop Config to Enable New Cops By Default for a Rails Application
Stateless Code |

The Path to Rails 8 -Remediate Code Coverage Issue Introduced by the 7.1 Upgrade

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER