[mocha-developer] Fwd: [ mocha-Bugs-5892 ] Using a setup method in test_case_class destroys subsequent test cases

James Mead jamesmead44 at gmail.com
Wed Apr 11 10:36:44 EDT 2007


---------- Forwarded message ----------
From: noreply at rubyforge.org <noreply at rubyforge.org>
Date: 11-Apr-2007 15:24
Subject: [ mocha-Bugs-5892 ] Using a setup method in test_case_class
destroys subsequent test cases
To: noreply at rubyforge.org

Bugs item #5892, was opened at 2006-09-25 07:49
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7477&aid=5892&group_id=1917

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Craig Ambrose (craigambrose)
Assigned to: Nobody (None)
Summary: Using a setup method in test_case_class destroys subsequent test
cases

Initial Comment:
Using a method called setup within a Test::Unit::TestCase derived class
works as expected once you start using mocha and stubba, providing that you
run only that test file. If you run several such files, subsequent ones
throw exceptions because the Stubba method setup_stubs is no longer getting
called (your test case  setup method has overwritten it) and thus $stubba is
nil.



The error you actually see, if you are usings @your_objects.stubs().... is
something like:



NoMethodError: You have a nil object when you didn't expect it!

The error occurred while evaluating nil.stub





----------------------------------------------------------------------

>Comment By: James Mead (jamesmead)
Date: 2007-04-11 14:24

Message:
I've just tried to reproduce this bug with both recent and old versions of
Mocha, but without success. Can you  let me know if you are still seeing the
bug? Thanks.

----------------------------------------------------------------------

Comment By: James Mead (jamesmead)
Date: 2006-11-01 11:32

Message:
Sorry for the late response - I didn't get any notification. You'd get a
faster response on the developer mailing list (
http://rubyforge.org/mailman/listinfo/mocha-developer).



With what version of Mocha do you see this issue? The setup/teardown
mechanism has changed significantly in HEAD and I hope to do a new release
soon. I suspect you won't see the problem with the latest version. Let me
know either way.

----------------------------------------------------------------------

You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7477&aid=5892&group_id=1917


-- 
James.
http://blog.floehopper.org


More information about the mocha-developer mailing list