Skip to content

Pin minitest to < 6 to fix missing minitest/mock#154

Merged
pftg merged 2 commits into
masterfrom
twill/setup-the-dev-env-BHUM2M6c
Apr 11, 2026
Merged

Pin minitest to < 6 to fix missing minitest/mock#154
pftg merged 2 commits into
masterfrom
twill/setup-the-dev-env-BHUM2M6c

Conversation

@twill-hq

@twill-hq twill-hq Bot commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Pins minitest gem to < 6 in gems.rb to fix LoadError: cannot load such file -- minitest/mock
  • Minitest 6.0 moved mock.rb to a separate minitest-mock gem, breaking tests that require "minitest/mock"

Test plan

  • All 162 unit tests pass with SCREENSHOT_DRIVER=vips bin/rake test:unit
  • CI pipeline passes on this PR

Summary by Sourcery

Build:

  • Constrain the minitest dependency to versions lower than 6 in gems.rb to retain bundled mock support.

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.
@sourcery-ai

sourcery-ai Bot commented Apr 11, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Pins 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

Change Details Files
Constrain minitest dependency to < 6 in the test Gemfile to restore availability of minitest/mock for existing tests.
  • Updated the minitest gem declaration to include a version constraint < 6.
  • Left the require: false option unchanged to avoid auto-requiring minitest.
  • Kept all other test-related gem declarations unchanged to minimize impact.
gems.rb

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • 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.
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread gems.rb
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@twill-hq

twill-hq Bot commented Apr 11, 2026

Copy link
Copy Markdown
Contributor Author

🔧 CI check Ruby & YAML failed. I'm investigating the issue and will push a fix shortly. (Attempt 1/3)

@pftg pftg merged commit 4a65fd8 into master Apr 11, 2026
5 of 6 checks passed
@pftg pftg deleted the twill/setup-the-dev-env-BHUM2M6c branch April 11, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant