Fix 3-1-stable to work with Mocha >= v0.13.0 #8871

merged 1 commit into from Jan 16, 2013


None yet

4 participants


Backport of #8200. The equivalent of 17ccefc by @carlosantoniodasilva would fix Mocha deprecation warnings in Rails tests.


[triage] @floehopper it'd be helpful if you could squash your commits into 1 commit for this please.

@carlosantoniodasilva this one seems right up your alley :-)


@parndt Can you explain why you want me to squash the commits? A very similar set of commits got merged into 3-2-stable in #8200 as separate commits. Wouldn't it be more confusing to have these rolled up into a single commit here, but separate elsewhere?


@floehopper because that's what Rails core always ask for so I'm preempting the inevitable. It also helps to identify the set of changes as one discrete unit of changes which is helpful if we need to revert this or for git blame / history. It also appears like all of the changes require each-other so one single commit seems logical. ❤️


@parndt Ok. My plan is to remove 712db3528f85c7110f15341e51a83b8fa446380d (as @carlosantoniodasilva pointed out the equivalent commit was reverted in 3-2-stable) and squash the other 3 commits into a single commit. Does this sound ok to you?

Ruby on Rails member

Yes, please squash the commits

Ruby on Rails member
@floehopper floehopper Fix 3-1-stable to work with Mocha >= v0.13.0
A) Update code in ActiveSupport which monkey-patches Test::Unit to
include 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*.

B) 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.

C) Avoid a Mocha deprecation warning.


As planned, I've removed the commit mentioned above and squashed the remaining 3 commits into 1. I've also rebased against 3-1-stable.

@rafaelfranca rafaelfranca merged commit b0a2c67 into rails:3-1-stable Jan 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment