<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Thanks Aslak and Michael.<DIV><BR class="khtml-block-placeholder"></DIV><DIV>You were both right. Changing save! to save in my second context made that test pass. </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Michael also mentioned...</DIV><DIV>>First concern is that your mock objects got stubbed after it is</DIV><DIV>>returned by new method stub. I alway tend to prepair mock/stub</DIV><DIV>>completely before I use it as argument or any other way.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I'm not sure what you mean by prepair mock/stub completely. Can you provide a sample of how you would rspec a simple create action, such as:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>def create</DIV><DIV> @product = Product.new(params[:product])</DIV><DIV> if @product.save</DIV><DIV> flash[:notice] = 'Product was successfully created.'</DIV><DIV> redirect_to :action => 'list'</DIV><DIV> else</DIV><DIV> render :action => 'new'</DIV><DIV> end</DIV><DIV> end</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>>Second is that tyou try to check that your controller's setup creates</DIV><DIV>>a valid product, but you use mocks, it's up to you to decide whether</DIV><DIV>>your model is valid or not, what it expects to receive and what it</DIV><DIV>>returns. It looks like you get this idea from your models specs where</DIV><DIV>>such a check is useful.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I might be misunderstanding you, but I thought it was preferable to mock/stub all the ActiveRecord instances in your controller and only focus on the controller responsibilities.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>thanks for the help.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Steve</DIV><DIV><BR><DIV><DIV>On May 8, 2007, at 10:43 AM, Michael Klishin wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">t</FONT></P> </BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>