[mocha-developer] Fwd: Aliasing type method in Mocha

James Mead jamesmead44 at gmail.com
Tue Sep 12 04:28:45 EDT 2006


Sorry - forgot to send to mailing list.

---------- Forwarded message ----------
From: James Mead <jamesmead44 at gmail.com>
Date: 12-Sep-2006 09:20
Subject: Re: [mocha-developer] Aliasing type method in Mocha
To: Ed Howland <ed.howland at gmail.com>

Thanks for the positive feedback. There is a known issue with not being able
to mock the 'type' method. To date we haven't found it much of a problem -
the worst case we found was where we wanted to have a mock as an associated
AR model, but we got round that by stubbing the association methods
themselves.

This is on the todo list and I'll try to get to it as soon as possible, but
in the meantime can you do something like...

    col = stub(:primary => true, :name => 'id')
    class << col; def type; :integer; end; end

I know it's not very elegant, but you can probably refactor it into a
method.

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


More information about the mocha-developer mailing list