Mocha is broken out right on Ruby 1.9.1 in some cases
Reported by Chad Humphries | May 15th, 2009 @ 11:28 AM
In particular, I have several projects which use mocha, and do not use test/unit, rspec, or bacon. On ruby 1.9.1 they all explode because:
not defined in Test::Unit::TestCase (NameError)
Comments and changes to this ticket
One problem is that Mocha's acceptance tests are all based on aspects of Test::Unit which are not available in Ruby 1.9.1 - I've just had another go at trying to get them to run in Ruby 1.9.1 without any gems installed, but I think it's going to take me a while.
In the meantime, I've tried writing a few tests using Mocha, but have been unable to reproduce your error. Do you have a simple test demonstrating this problem? Also can you tell me exactly what version of Ruby 1.9.1 you are using? I'm testing with ruby 1.9.1p0 (2009-01-30 revision 21907). I wonder whether something has changed since then.
Also are your tests inheriting from Test::Unit::TestCase or MiniTest::Unit::TestCase? Both are available without gems installed, but the former is actually just a thin wrapper around the latter.
One last thought, can you try requiring 'minitest/unit' before requiring 'mocha'? This should encourage Mocha to use the appropriate monkey-patching adapter.
- Assigned user set to James Mead
I'm on ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-darwin9.7.0]. I'm using Micronaut, which does not descend from MiniUnit/Test, or Test::Unit. I use the RSpec style of hooking in Mocha via an adapter.
Basically the issue from my end appears to be that it is trying to monkey patch something I'm not using or requiring. I can try requiring minitest/unit per your request and I'll you know what happens.
Sorry not to get back to you sooner - I've been visiting my parents and have had long periods with no reliable internet connection. Even now I'm relying on wifi on a train!
I've just committed a couple of changes  that will hopefully fix your problem.
Are you in a position to checkout HEAD, build and install the gem locally? If you can, let me know if it works and I'll try and get a release out asap.
There is now a release  incorporating the changes I mentioned above.
It would be really helpful if you could tell me whether the newly released version 0.9.6 of the Mocha gem solves your problem.