Patch #32592

Require 'mocha/minitest' instead of deprecated 'mocha/setup'

Added by Go MAEDA 4 months ago. Updated 4 months ago.

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

0%

Category:Gems support
Target version:3.4.13

Description

The following deprecation warning is shown when running tests if mocha 1.10.0 or later is installed.

Mocha deprecation warning at /path/to/gems/ruby/2.3.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require': Require 'mocha/test_unit', 'mocha/minitest' or 'mocha/api' instead of 'mocha/setup'.

It can be fixed with the following patch.

diff --git a/test/test_helper.rb b/test/test_helper.rb
index 68e292848..0c1217fea 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -35,7 +35,7 @@ require File.expand_path(File.dirname(__FILE__) + '/object_helpers')
 include ObjectHelpers

 require 'net/ldap'
-require 'mocha/setup'
+require 'mocha/minitest'
 require 'fileutils'

 Redmine::SudoMode.disable!

32592-v2.patch Magnifier (710 Bytes) Go MAEDA, 2019-12-11 02:41

Associated revisions

Revision 19358
Added by Go MAEDA 4 months ago

Require 'mocha/minitest' instead of deprecated 'mocha/setup' (#32592).

Patch by Go MAEDA.

Revision 19359
Added by Go MAEDA 4 months ago

Merged r19358 from trunk to 4.1-stable (#32592).

Revision 19360
Added by Go MAEDA 4 months ago

Merged r19358 from trunk to 4.0-stable (#32592).

Revision 19361
Added by Go MAEDA 4 months ago

Merged r19358 from trunk to 3.4-stable (#32592).

History

#1 Updated by Go MAEDA 4 months ago

Since mocha prior to 1.4.0 does not have 'mocha/minitest', I think it is better to specify the minimum version in Gemfile.
https://github.com/freerange/mocha/blob/master/RELEASE.md#140

Attaching an updated patch.

#2 Updated by Go MAEDA 4 months ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patch.

Also available in: Atom PDF