Pin minitest to < 6 to fix missing minitest/mock#154
Merged
Conversation
Minitest 6.0 moved mock.rb to a separate minitest-mock gem, breaking `require "minitest/mock"` in tests. Pin to < 6 to retain the built-in mock support.
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuidePins the minitest gem to a version lower than 6 in the test group to avoid breaking tests that rely on minitest/mock, which was moved to a separate gem starting with minitest 6. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Pinning
minitestto< 6is a brittle long-term workaround; consider updating the test code to use theminitest-mockgem (or adjusted requires) so you can stay compatible with newer Minitest versions. - If you keep the version pin, add a brief inline comment in
gems.rbexplaining theminitest/mockdependency so future upgrades to Minitest are less likely to reintroduce this issue.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Pinning `minitest` to `< 6` is a brittle long-term workaround; consider updating the test code to use the `minitest-mock` gem (or adjusted requires) so you can stay compatible with newer Minitest versions.
- If you keep the version pin, add a brief inline comment in `gems.rb` explaining the `minitest/mock` dependency so future upgrades to Minitest are less likely to reintroduce this issue.
## Individual Comments
### Comment 1
<location path="gems.rb" line_range="17-19" />
<code_context>
gem "capybara", ">= 3.26"
gem "mutex_m" # Needed for RubyMine debugging. Try removing it.
- gem "minitest", require: false
+ gem "minitest", "< 6", require: false
gem "minitest-stub-const", require: false
gem "simplecov", require: false
</code_context>
<issue_to_address>
**suggestion:** Consider adding a lower version bound or a narrower constraint for minitest
Using `< 6` alone could pull in very old `minitest` versions with missing features or known issues. To better match the versions you actually support and test with, use a narrower range like `"~> 5.0"` or `">= 5.0", "< 6"`.
```suggestion
gem "mutex_m" # Needed for RubyMine debugging. Try removing it.
gem "minitest", ">= 5.0", "< 6", require: false
gem "minitest-stub-const", require: false
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Comment on lines
17
to
19
| gem "mutex_m" # Needed for RubyMine debugging. Try removing it. | ||
| gem "minitest", require: false | ||
| gem "minitest", "< 6", require: false | ||
| gem "minitest-stub-const", require: false |
Contributor
There was a problem hiding this comment.
suggestion: Consider adding a lower version bound or a narrower constraint for minitest
Using < 6 alone could pull in very old minitest versions with missing features or known issues. To better match the versions you actually support and test with, use a narrower range like "~> 5.0" or ">= 5.0", "< 6".
Suggested change
| gem "mutex_m" # Needed for RubyMine debugging. Try removing it. | |
| gem "minitest", require: false | |
| gem "minitest", "< 6", require: false | |
| gem "minitest-stub-const", require: false | |
| gem "mutex_m" # Needed for RubyMine debugging. Try removing it. | |
| gem "minitest", ">= 5.0", "< 6", require: false | |
| gem "minitest-stub-const", require: false |
Contributor
Author
|
🔧 CI check |
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
minitestgem to< 6ingems.rbto fixLoadError: cannot load such file -- minitest/mockmock.rbto a separateminitest-mockgem, breaking tests thatrequire "minitest/mock"Test plan
SCREENSHOT_DRIVER=vips bin/rake test:unitSummary by Sourcery
Build: