Add mutant gem for open-source mutation testing#506
Merged
Conversation
Install mutant and mutant-rspec in the development/test group and add a config/mutant.yml configured for open-source usage with the rspec integration. Enables running mutation testing against models, e.g. `bundle exec mutant run -- 'InspectorCompany'`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CLseCgvqE2jdan8K57ENJn
CI runs bin/brakeman with --ensure-latest, which fails once a newer brakeman is released. Bump to the current latest so the security scan passes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CLseCgvqE2jdan8K57ENJn
stefan-burke
enabled auto-merge
July 3, 2026 14:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Installs the mutant mutation-testing engine in open-source mode and wires it up for the RSpec suite, then runs it against several core models to measure how thoroughly their tests actually pin down behaviour.
Mutation testing mutates the source (e.g.
>→>=, deleting an argument, flipping a boolean) and re-runs the covering tests. A mutation that survives means no test noticed the change — a genuine gap even when line coverage is 100%.Changes
Gemfile— addmutantandmutant-rspec(require: false) to thedevelopment, :testgroup.Gemfile.lock— resolved dependencies (mutant 0.13.1, unparser, etc.).config/mutant.yml— project config:usage: opensource, rspec integration, requires./config/environment, setsRAILS_ENV=test, and lists example subjects.bin/mutant— bundler binstub.Usage
Mutation results
Run against three core models and their specs:
TextReplacementInspectorCompanyEventHigher is better — surviving ("alive") mutations are behaviours no test asserts on.
TextReplacementis very well covered;Eventhas the most gaps (notablyEvent.log,Event#resource_object, andEvent#description). These highlight where the existing tests could be strengthened.Credentialwas also configured but has no mutable subjects — it declares only validation macros, no method bodies for mutant to mutate.Notes
usage: opensource) requires no licence key for public repositories.🤖 Generated with Claude Code
https://claude.ai/code/session_01CLseCgvqE2jdan8K57ENJn
Generated by Claude Code