Fwd: Please help in regard with Mocha

30 views
Skip to first unread message

James Mead

unread,
Feb 15, 2011, 3:41:38 PM2/15/11
to vivek dhayalan, mocha-d...@googlegroups.com
Hi Vivek,

I hope you don't mind, but I'm copying this email to the Mocha mailing list. I don't have a lot of time to help you, so I thought it would increase your chances of getting help.

Regards, James.
----
http://jamesmead.org/

From: vivek dhayalan <dvv...@gmail.com>
Date: 15 February 2011 12:43:21 GMT
Subject: Please help in regard with Mocha

Hi James,

I am new to Rails platform, I am in the process of re-writing unit test case for and web application (for which unit cases where not updated for 2 years :( ). 

My problem is when I start running unit test case I am getting the following:

Loaded suite ../install/local/ruby-1.8.7-p299/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started

Finished in 0.000178 seconds.

0 tests, 0 assertions, 0 failures, 0 errors

with the following code in test_helper.rb

ENV["RAILS_ENV"] = "test"
#require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'rubygems'
require 'test/unit'
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'mocha'
#require 'test_help'

And when I un-comment the require 'test_help' I get 

`load_missing_constant': uninitialized constant Mocha::Integration (NameError)

Note:
I am using mocha 0.9.10. And the application has been upgraded to Rails 2.3.8 a month ago.

Please give me your suggestions on this issue.

-- 
Thanks & Regards
Vivek Dhayalan

floehopper

unread,
Feb 15, 2011, 4:01:55 PM2/15/11
to mocha-developer, vivek dhayalan


On Feb 15, 8:41 pm, James Mead <jamesmea...@gmail.com> wrote:
> From: vivek dhayalan <dvvi...@gmail.com>
Hi Vivek,

It's difficult to diagnose this without more information. The error
doesn't seem familiar to me and there are so many variations to
consider.

The important things are to ensure that Mocha is only loaded *after*
any Test::Unit related stuff. I have a feeling the Rails test_help
file loads Test::Unit, so I wonder whether it would be worth *not*
requiring "test/unit" explicitly, and requiring "test_help" before
"mocha".

A good way to get more help on this would be to create a blank Rails
project using the same version of Rails and a similar environment. You
could add a single test which uses Mocha and see whether you can
reproduce the problem. If you can, then put the whole project in a
Gist so we can clone it and see if we get the same problem. Then we'd
be in a good position to diagnose what's wrong.
Reply all
Reply to author
Forward
0 new messages