2009/9/6 Christian Johansen <[email protected]> > > I recently set up an app on a new (old) computer, and I'm having > problems running my tests. For some reason, mocha is not behaving at > all. The first thing that happened was that all calls to stub > (Mocha::API#stub) failed with a > > "undefined method `stub' for #<AnyObjectTest:0xb68ae420>". > > After some investigation in irb and script/console I tried to "import > Mocha::API" in my test/test_helper.rb. That solved my initial problem, > but brought on > > "/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:426:in > `load_missing_constant': Expected > /usr/lib/ruby/gems/1.8/gems/mocha-0.9.7/lib/mocha/integration/test_unit.rb > to define Mocha::Integration::TestUnit (LoadError)" > > So, obviously something's amiss. I'm on Ubuntu. I installed Mocha > through RubyGems 1.3.5 (manually installed, not the apt one). > > Any ideas on how to fix this?
Hi Christian, I suspect this is a load order problem. After the release of 0.9.6 [1], Mocha no longer loads Test::Unit itself. Instead Mocha now needs you to load Test::Unit *before* you load Mocha. Exactly how you solve this depends on how you are currently loading Test::Unit and Mocha, but usually it may simply be a matter of moving a require 'mocha' statement below a require 'test/unit' statement. If you need any more help, please post to the Mocha mailing list [2]. Thanks, James. http://blog.floehopper.org [1] http://blog.floehopper.org/articles/2009/06/29/mocha-release-0-9-6 [2] http://groups.google.com/group/mocha-developer --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

