Fix 3-2-stable to work with Mocha v0.13.0 #8200

Merged
merged 4 commits into from Nov 13, 2012

Conversation

Projects
None yet
6 participants
@floehopper
Contributor

floehopper commented Nov 13, 2012

Two commits (716bdfc & c3e186e) are fixes for problems that existed prior to the release of Mocha v0.13.0, but have remained unnoticed.

The other two commits (5573c1d & 3791cac) fix Rails v3.2 to work with Mocha v0.13.0.

floehopper added some commits Aug 26, 2012

Copy Mocha bug fix.
A bug was fixed [1] in Mocha's integration with Test::Unit, but this
monkey-patching code was copied before the fix. We need to copy the
fixed version.

The bug meant that an unexpected invocation against a mock within the
teardown method caused a test *error* and not a test *failure*.

[1]
freerange/mocha@f1ff647#diff-5
Use MiniTest in Ruby 1.8 if it is available.
ActiveSupport::TestCase was always inheriting from Test::Unit::TestCase.
This works fine in Ruby 1.9 where Test::Unit::TestCase is a thin wrapper
around MiniTest::Unit::TestCase, but does not work in Ruby 1.8 if the
MiniTest gem is used. What happens is that ActiveSupport inherits from
the Test::Unit::TestCase provided by the standard library, but then
since Minitest is defined, it then seems to proceed on the assumption
that ActiveSupport::TestCase has MiniTest::Unit::TestCase in its
ancestor chain. However, in this case it does not.

The fix is simply to choose which test library TestCase to inherit from
using the same logic used elsewhere to detect MiniTest.

I noticed this bug causing issues when using MiniTest and Mocha
in Ruby 1.8, but there may well be other issues.
Fix for Test::Unit Mocha compatibility.
Mocha is now using a single AssertionCounter which needs a reference to
the testcase as opposed to the result.

This change is an unfortunate consequence of the copying of a chunk of
Mocha's internal code in order to monkey-patch Test::Unit.

carlosantoniodasilva added a commit that referenced this pull request Nov 13, 2012

@carlosantoniodasilva carlosantoniodasilva merged commit 0ed585a into rails:3-2-stable Nov 13, 2012

@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment

Thanks!

@floehopper

This comment has been minimized.

Show comment
Hide comment
@floehopper

floehopper Nov 13, 2012

Contributor

Great! No problem.

Contributor

floehopper commented Nov 13, 2012

Great! No problem.

carlosantoniodasilva added a commit that referenced this pull request Nov 13, 2012

@floehopper floehopper referenced this pull request in blowmage/minitest-rails Dec 1, 2012

Merged

Avoid deprecation warning in Mocha 0.13.0. #85

@floehopper

This comment has been minimized.

Show comment
Hide comment
@floehopper

floehopper Jan 4, 2013

Contributor

Any idea when this might be released? Thanks.

Contributor

floehopper commented Jan 4, 2013

Any idea when this might be released? Thanks.

@floehopper floehopper referenced this pull request in freerange/mocha Jan 4, 2013

Closed

Impossible to boot mocha properly with rspec-rails? #115

@steveklabnik

This comment has been minimized.

Show comment
Hide comment
@steveklabnik

steveklabnik Jan 7, 2013

Member

Whenever it does. There's no direct plans for a 3.2.x release that I'm aware of right now.

Member

steveklabnik commented Jan 7, 2013

Whenever it does. There's no direct plans for a 3.2.x release that I'm aware of right now.

@pboling

This comment has been minimized.

Show comment
Hide comment
@pboling

pboling Jan 25, 2013

Contributor

Please release a non security release of rails 3.2.X so we can get these non-security fixes! 👍

Contributor

pboling commented Jan 25, 2013

Please release a non security release of rails 3.2.X so we can get these non-security fixes! 👍

@mattscilipoti

This comment has been minimized.

Show comment
Hide comment
@mattscilipoti

mattscilipoti Feb 8, 2013

YARR (Yet another release request). Please release a version that will remove this deprecation noise.

YARR (Yet another release request). Please release a version that will remove this deprecation noise.

@sbleon

This comment has been minimized.

Show comment
Hide comment

sbleon commented Feb 21, 2013

+1

@floehopper

This comment has been minimized.

Show comment
Hide comment
@floehopper

floehopper Feb 21, 2013

Contributor

It's worth noting that the equivalent changes have already been (possibly inadvertently) released in the 3.0.20 & 3.1.11 security releases. However, these changes are not in the 3.2.12 release. It seems odd that there is such a discrepancy.

I do understand that this is because the recent 3-2-stable releases have been security fixes, however there hasn't been a non-security release of 3-2-stable for some months now.

I'd be really grateful if there could be a non-security release of 3-2-stable - the Mocha deprecation warnings are causing a lot of confusion.

Contributor

floehopper commented Feb 21, 2013

It's worth noting that the equivalent changes have already been (possibly inadvertently) released in the 3.0.20 & 3.1.11 security releases. However, these changes are not in the 3.2.12 release. It seems odd that there is such a discrepancy.

I do understand that this is because the recent 3-2-stable releases have been security fixes, however there hasn't been a non-security release of 3-2-stable for some months now.

I'd be really grateful if there could be a non-security release of 3-2-stable - the Mocha deprecation warnings are causing a lot of confusion.

@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Feb 21, 2013

Member

@floehopper yeah those changes were released because they were merged into those branches just to work with latest mocha, but since the merge policy for those branches is "security fixes only", they were supposedly ready to be released as is - so they went out with the changes. 3-2, on the other way, branched out to release the sec fixes on top of the last stable version (not the branch), and thus not including anything in 3-2-stable branch.

This was probably unfortunate but it is how it happened. In any case, we're not merging anything else in 3.0/3.1 branches anymore. And about a new 3-2 release, I agree it's been a while but it had to wait due to the latest sec releases. Lets see if we can get something out soon, thanks!

@floehopper yeah those changes were released because they were merged into those branches just to work with latest mocha, but since the merge policy for those branches is "security fixes only", they were supposedly ready to be released as is - so they went out with the changes. 3-2, on the other way, branched out to release the sec fixes on top of the last stable version (not the branch), and thus not including anything in 3-2-stable branch.

This was probably unfortunate but it is how it happened. In any case, we're not merging anything else in 3.0/3.1 branches anymore. And about a new 3-2 release, I agree it's been a while but it had to wait due to the latest sec releases. Lets see if we can get something out soon, thanks!

@floehopper

This comment has been minimized.

Show comment
Hide comment
@floehopper

floehopper Feb 21, 2013

Contributor

Thanks. I appreciate all your efforts.

Contributor

floehopper commented Feb 21, 2013

Thanks. I appreciate all your efforts.

bobbus pushed a commit to bobbus/minitest-rails that referenced this pull request May 19, 2014

Avoid deprecation warning in Mocha 0.13.0.
I'm not entirely sure why this code is duplicated from ActiveSupport,
but this deprecation warning has been fixed in 3-2-stable [1] and in
master [2].

[1] rails/rails#8200
[2] rails/rails#8180
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment