cheers Tom. That worked. I'll go dig in the rspec source...<br><br><div><span class="gmail_quote">On 04/12/2007, <b class="gmail_sendername">Tom Stuart</b> <<a href="mailto:tom@experthuman.com">tom@experthuman.com</a>
> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On 4 Dec 2007, at 15:41, Andy Goundry wrote:<br>> I've created the following spec test to simply ensure that the
<br>> Account model receives a call to :new, but the spec is failing as it<br>> also receives a call to :save! and it isn't expecting it. I am using<br>> "@account = mock_model(Account)". If i replace this with "@account =
<br>> mock('account', :null_object => true)" the test passes, but i'm not<br>> sure that's really what i want. I'm pretty sure i need to us<br>> mock_model in this instance.<br><br>mock_model doesn't do anything magic -- it just creates a mock (with a
<br>conveniently-chosen name) and stubs out a few useful methods for you.<br>In your case you need to stub out #save! too, so that you don't get<br>the failure: @account = mock_model(Account, :save! => true).<br><br>
Cheers,<br>-Tom<br>_______________________________________________<br>rspec-users mailing list<br><a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/rspec-users">
http://rubyforge.org/mailman/listinfo/rspec-users</a><br></blockquote></div><br>