From 44e345a9334385c478c54c9c5d83fee7f025e25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 6 Jan 2026 18:55:59 +0100 Subject: [PATCH] Add dependency on minitest-mock for MT6 compatibility This prevents test errors with minitest 6+ such as: ~~~ 2) Error: TestGem2Rpm#test_show_templates: NoMethodError: undefined method 'stub' for class Gem2Rpm::Distro test/test_gem2rpm.rb:40:in 'TestGem2Rpm#test_show_templates' ~~~ This is due to minitest-mock being extracted from Minitest 6+: https://github.com/minitest/minitest/commit/de9aac1d3f52224ae5d93a186d129c72d5ec979f This change unfortunately requies Bundler to be used to execute test suite, because: 1. RubyGems cannot load minitest-mock [[1]] 2. MT6 restrict support to Ruby 3.2+ [[2], [3]] I wish the use of Bundler can be reverted one day. [1]: https://github.com/ruby/rubygems/issues/9238 [2]: https://github.com/minitest/minitest-mock/issues/4 [3]: https://github.com/minitest/minitest/issues/1058 --- .github/workflows/ci.yml | 2 +- Gemfile | 8 +++++++- test/helper.rb | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9c7ba5..bf3ac66 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,4 +39,4 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - run: rake + - run: bundle exec rake diff --git a/Gemfile b/Gemfile index 2ed9522..15f3bcf 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,12 @@ source "https://www.rubygems.org" group :development do - gem 'minitest', '~> 5.0' + gem 'minitest', '> 5.0' + # MT6 restricts supported versions, therefore older Rubies sticks with MT5, + # which includes `minitest/mock` + if RUBY_VERSION >= "3.2" + gem 'minitest-mock' + else + end gem 'rake', '>= 12', '< 14' end diff --git a/test/helper.rb b/test/helper.rb index cb8fdd9..5ff21cd 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -4,6 +4,7 @@ require 'rubygems/version' require 'minitest/autorun' +require 'minitest/mock' # Ruby 2.0 + 2.1 compatibility. module Minitest