Mocha loading order

Manfred Stienstra, 23 Nov 2009, 14:07 in ruby on rails, testing, and broken (edit).

From version 0.9.8 onwards Mocha wants to be loaded after the test framework. I suspect this has something to do with detecting how to hook into the framework so it can run its expectations.

If you don’t do this, Mocha will not define its methods on the test case or context and you will get a load error.

NoMethodError: undefined method `mock' for #<#<Class>

Note that config.gem immediately loads the gem you’re configuring so you will also have to require those in the correct order.

config.gem 'test-spec'
config.gem 'mocha'

No comments yet

Apprise

Manfred Stienstra, 01 Nov 2009, 20:47 in ruby on rails and releases (edit).

Last friday Eloy and I participated in the Ruby en Rails Rails Rumble 2009, we had 8 hours to write an application which helped developers find out more information about the dependencies in their Rails application.

Our submission is called Apprise. Apprise is a tool to check gem dependencies and external repositories for newer versions of the currently installed ones in your Rails application.

To be more specific, it looks for three sources of dependencies. Git and Subversion externals in vendor/plugins and bundled Gems in the Gemfile. Checking for Gem dependencies is delegated to Bundler. If you don’t use Bundler to manage Gem dependencies you will still see outdated externals and submodules.

Outdated dependencies are listed and you can decide to update the externals, submodules or gems.

$ apprise                 
Outdated dependencies
 * forestwatcher (Subversion external)
 * risosu-san (Git submodule)
 * miso (Gem)

If you want to try it out you can easily install the gem and run the command in the root of your Rails application.

$ gem install apprise --source http://gemcutter.org

Unfortunately we did not win, but our patch for Bundler to list outdated gems was pulled by Yehuda Katz right after the competition.

3 comments