[mocha-developer] Mocha + Selenium-on-rails loading problem ?

James Mead jamesmead44 at gmail.com
Mon Sep 18 13:39:08 EDT 2006


On 18/09/06, Peter Fitzgibbons <peter.fitzgibbons at gmail.com> wrote:
>
> HI James,
>
> I put the requires in test_helper.rb for simplicity.
>
> Now on the .rsel (without the require call) I get :
>
> c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.3.2/lib/stubba/object.rb:47:in `stubs': You have a nil object when you didn't expect it!
>
> The error occured while evaluating nil.stub
>
> Extracted source (around line *#0*):
>
> 1:
> 2: SalesConfigWork.stubs(:load_work_data)
> 3: SalesConfigWork.stubs(:delete_work_data)
>
>
> If there's a puts or a breakpoint inspect you'd like to see, tell me.
>

I'm pretty sure this will be because of interference between setup methods.
I'm working on a way of making Mocha play better with other test frameworks,
but to be honest its a general problem of the way Test::Unit itself works.

I'm guessing Selenium-on-Rails defines setup method & teardown methods for
TestCase. You could try adding the following code (assuming mocha and stubba
have already been required)...

def setup
  setup_stubs
  # existing code here
end

def teardown
  # existing code here
  teardown_mocks
  teardown_stubs
end

You should be warned that I'm guessing a bit and haven't tested this at all!

-- 
James.
http://blog.floehopper.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mocha-developer/attachments/20060918/a893a47c/attachment.html 


More information about the mocha-developer mailing list