Mocha is broken out right on Ruby 1.9.1 in some cases
Reported by Chad Humphries | 2009-05-15 11:28:47 UTC
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:
mocha/lib/mocha.rb:47:in remove_method': methodrun'
not defined in Test::Unit::TestCase (NameError)
Comments and changes to this ticket
-

Chad Humphries 2009-05-15 11:30:11 UTC
Let me also say before it comes up that I do not wish to install the test-unit gem in 1.9.1 if at all possible. It causes issues with some of the projects I'm prototyping at the moment.
-

James Mead 2009-05-16 17:07:51 UTC
Hmm. Thanks for letting me know. I'm looking into this now. Sorry I didn't see your ticket earlier. I think I need to sort out Lighthouse notifications. Cheers, James.
-

James Mead 2009-05-17 12:50:39 UTC
Hi Chad.
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.
Cheers, James.
-

Chad Humphries 2009-05-17 13:20:48 UTC
- 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.
-

James Mead 2009-05-18 16:27:35 UTC
Hi Chad,
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 [1] 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.
Cheers, James.
[1] http://github.com/floehopper/mocha/commit/213ce2187a84c25eeb7040238...
-

James Mead 2009-07-01 10:03:34 UTC
Hi Chad,
There is now a release [1] 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.
Thanks, James.
[1] http://blog.floehopper.org/articles/2009/06/29/mocha-release-0-9-6
-

Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
A mocking & stubbing library for Ruby.