cheers Tom. That worked. I&#39;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> &lt;<a href="mailto:tom@experthuman.com">tom@experthuman.com</a>
&gt; 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>&gt; I&#39;ve created the following spec test to simply ensure that the
<br>&gt; Account model receives a call to :new, but the spec is failing as it<br>&gt; also receives a call to :save! and it isn&#39;t expecting it. I am using<br>&gt; &quot;@account = mock_model(Account)&quot;. If i replace this with &quot;@account =
<br>&gt; mock(&#39;account&#39;, :null_object =&gt; true)&quot; the test passes, but i&#39;m not<br>&gt; sure that&#39;s really what i want. I&#39;m pretty sure i need to us<br>&gt; mock_model in this instance.<br><br>mock_model doesn&#39;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&#39;t get<br>the failure: @account = mock_model(Account, :save! =&gt; 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>