[mocha-developer] how to install from svn?

James Mead jamesmead44 at gmail.com
Fri Dec 15 11:14:54 EST 2006

On 15/12/06, hemant <gethemant at gmail.com> wrote:
> When trying to run Chris samples I get error:

What exactly is "Chris samples"? Sorry I'm probably missing something obvious.

> /usr/lib/ruby/gems/1.8/gems/mocha-0.3.2/lib/smart_test_case.rb:3:
> uninitialized constant Test (NameError)
>         from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `require'
>         from /usr/lib/ruby/gems/1.8/gems/mocha-0.3.2/lib/mocha.rb:1
>         from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:33:in
> `require'
>         from spam_cannon_test.rb:2

Can you give a small snippet of code which generates this exception?
It's hard to give more help without a context. However, the most
likely issue is that you need to require 'test/unit' before you
require 'mocha' to use the 0.3.2 gem.

> So i figure there might be some problem with the mocha gem and its
> dependency upon Test::Unit, so I tried installing from SVN, but there
> doesn't seems to be a install/setup.rb there.

There is a run-time dependency on Test::Unit. Do you specifically not
want to use Test::Unit? If not, what test framework are you using?

There is no specific mechanism (install.rb/setup.rb) to install Mocha
as a library. You can checkout from svn into a lib directory within
your application if you want. Otherwise it's probably simpler to use
the gem or the Rails plugin.

> All, thats is there is, init.rb, which is for rails plugin.

You are correct - init.rb is for the Rails plugin.

> I am trying to use mocha for testing a three tier networking app. That
> accepts connections from clients, and in turn requests some external
> servers and returns back the data to the client. In between it does,
> some caching, session validation and stuff.
> I am having a hard time, unit testing this app, so though I can give mocha spin.

I hope you get it working and that it helps you with your unit testing.

More information about the mocha-developer mailing list