[rspec-users] mocking errors

David Smalley david.smalley.lists at googlemail.com
Sun Jun 24 14:58:22 EDT 2007


Thanks everyone for your replies on a Sunday!

On 24 Jun 2007, at 18:45, Moses Hohman wrote:

> Rupert: I assume David wants to do this because he wants to pass a  
> model object with errors to a view or a controller or something to  
> make sure it reacts properly to validation errors.

Bingo, you got that right in one.

> SImplest case:
>
> @mock_thing = mock_model(Thing, :errors => mock_model 
> (Errors, :full_messages => ["An error"]))

Cool - I'll start looking into this right now. It'll tidy up my  
current setup code.

Thanks guys,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070624/16147c9f/attachment.html 


More information about the rspec-users mailing list