[mocha-developer] New error?

Ned Wolpert ned.wolpert at gmail.com
Wed Feb 6 10:48:12 EST 2008


After more testing, the problem is the mocha changes conflict with a
suggestion made by Ola Bini
http://ola-bini.blogspot.com/2007/12/your-ruby-tests-are-memory-leaks.html
We added his suggestion (which for some reason actually made the tests
run faster) and by removing it causes the latest mocha changes to not
fail on our code. Bini's code removes (forceably) all instance
variables set during the unit test... so its basically killing the
Mocha variables simply because its not referenced in his code-base.

So, its not a bug with Mocha, but an assumption of the variables that
exist within the TestCase framework that Bini's code makes... I do
appreciate your help. I find it difficult to figure out what
'sandboxes' are safe to play in with the Rails project and its
plugins... and initial introspection into Bini's code did not seem
like a bad thing. Seems like there should be a better 'discovery'
technique on necessary variables though.  (Side note, this is the
first time Mocha added an instance variable to the test case itself,
right? It would explain why this just happened recently.)

Thanks again.


On Feb 6, 2008 7:34 AM, James Mead <jamesmead44 at gmail.com> wrote:
> On 06/02/2008, Ned Wolpert <ned.wolpert at gmail.com> wrote:
> >
> > Yeah, I use the head of Mocha... so my tests auto-update to the lasted
> > and execute on svn checkins. I need to track Mocha back to 251 because
> > after this error, tests just stop...
> >
> > It seems like when my rails environment is loaded (Rails 2.0.2) the
> > mocha_setup doesn't occur so 'mockery' doesn't get built in the
> > mocha_setup. Again, no clue why. Runs fine within just a ruby call and
> > the library without the rails framework... so something isn't playing
> > well there it seems.
> >
>
> I've just created a fresh Rails project using Rails 2.0.2. I added the Mocha
> plugin from HEAD (revision 254).
>
> I added the following unit test...
>
> require File.dirname(__FILE__) + '/../test_helper'
>
> class TempTest < Test::Unit::TestCase
>
>   def test_me
>     assert true
>   end
>
> end
>
> When I run this test, I get the following output (i.e. the test passes)...
>
> $ ruby test/unit/temp_test.rb
> Loaded suite test/unit/temp_test
> Started
> .
> Finished in 0.025527 seconds.
>
> 1 tests, 1 assertions, 0 failures, 0 errors
>
> Can you tell me if *anything* I've done sounds different from you? e.g. are
> you using fixtures?
>
> The call to require 'stubba' is not necessary and should make no difference.
>
> Running script/about gives the following output...
>
> $ script/about
> About your application's environment
> Ruby version              1.8.6 (i686-darwin8.10.3)
> RubyGems version          0.9.4
> Rails version             2.0.2
> Active Record version     2.0.2
> Action Pack version       2.0.2
> Active Resource version   2.0.2
> Action Mailer version     2.0.2
> Active Support version    2.0.2
> Application root          /Users/jamesmead/projects/temp
> Environment               development
> Database adapter          mysql
>
> Settings in test/test_helper.rb are the defaults...
>
>   self.use_transactional_fixtures = true
>   self.use_instantiated_fixtures  = false
>   fixtures :all
>
> Thanks.
> --
>
> James.
> http://blog.floehopper.org
> http://tumble.floehopper.org
> _______________________________________________
> mocha-developer mailing list
> mocha-developer at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mocha-developer
>



-- 
Virtually, Ned Wolpert
http://www.codeheadsystems.com/blog/

"Settle thy studies, Faustus, and begin..."   --Marlowe


More information about the mocha-developer mailing list