Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Mocha is broken out right on Ruby 1.9.1 in some cases

#49

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)

Reported by Chad Humphries · May 15th, 2009 @ 11:28 AM

State: resolved
Milestone: none
Assigned to: James Mead James Mead

Activity

  1. Chad Humphries
    Chad Humphries

    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.

    May 15th, 2009 @ 11:30 AM

  2. James Mead
    James Mead

    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.

    May 16th, 2009 @ 05:07 PM

  3. James Mead
    James Mead

    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.

    May 17th, 2009 @ 12:50 PM

  4. Chad Humphries
    Chad Humphries
    • 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.

    May 17th, 2009 @ 01:20 PM

  5. James Mead
    James Mead

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

    May 18th, 2009 @ 04:27 PM

  6. James Mead
    James Mead

    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

    July 1st, 2009 @ 10:03 AM

  7. James Mead
    James Mead
    • State changed from new to resolved

    Believed fixed.

    July 24th, 2009 @ 11:59 PM

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.