Patch #37883

Limit mocha version to < 2.0.0 when Ruby version is < 2.7 to avoid test error

Added by Ko Nagase about 1 month ago. Updated about 1 month ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Gems support
Target version:4.2.9

Description

Today, I encountered the following "LoadError: cannot load such file -- ruby2_keywords" error, when executing test with ruby 2.6.
% bundle exec rails test
/Users/sanak/Build/rb/redmine42/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.8.1/lib/active_support/dependencies.rb:291:in `require': cannot load such file -- ruby2_keywords (LoadError)
    from /Users/sanak/Build/rb/redmine42/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.8.1/lib/active_support/dependencies.rb:291:in `block in require'
    from /Users/sanak/Build/rb/redmine42/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.8.1/lib/active_support/dependencies.rb:257:in `load_dependency'
    from /Users/sanak/Build/rb/redmine42/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.8.1/lib/active_support/dependencies.rb:291:in `require'
    from /Users/sanak/Build/rb/redmine42/vendor/bundle/ruby/2.6.0/gems/mocha-2.0.0/lib/mocha/mock.rb:1:in `<top (required)>'
:
The same test was no problem at 2022/10/29, and from checking the installed gem diff, the cause seems to be mocha 2.0.0 which was released at 2022/11/01. From the following mocha document, the latest 2.0.0 only supports ruby >= 2.7,

so, when ruby < 2.7, mocha should be < 2.0.0.

I upload a patch for that, but I am not sure whether it is enough, so reviewing it is helpful.

01-Limit-mocha-less-than-2_0_0-when-ruby-less-than-2_7_0.patch Magnifier (416 Bytes) Ko Nagase, 2022-11-03 03:29

Associated revisions

Revision 21945
Added by Go MAEDA about 1 month ago

Limit mocha version to < 2.0.0 when Ruby version is < 2.7 to avoid test error "cannot load such file -- ruby2_keywords" (#37883).

Patch by Ko Nagase.

Revision 21946
Added by Go MAEDA about 1 month ago

Merged r21945 from trunk to 5.0-stable (#37883).

Revision 21947
Added by Go MAEDA about 1 month ago

Merged r21945 from trunk to 4.2-stable (#37883).

History

#1 Updated by Go MAEDA about 1 month ago

  • Subject changed from Limit mocha < 2.0.0 when ruby < 2.7 to avoid test error to Limit mocha version to < 2.0.0 when Ruby version is < 2.7 to avoid test error
  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Target version set to 4.2.9

Committed the fix. Thank you for your contribution.

Also available in: Atom PDF