<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Look at your test.log and you can see exactly what was rendered. That should explain why the example is failing. This works best if you can silence the logs for all examples other than the one you are testing.<DIV><BR><DIV><DIV>On Sep 14, 2007, at 7:35 PM, sinclair bain wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite">Hi,<DIV><BR> </DIV><DIV>A controller has a method with the following</DIV><DIV><BR> </DIV><DIV><DIV> def update</DIV><DIV> ...</DIV><DIV> if @config.update_attributes ( params[:new_config] )</DIV><DIV> redirect_to :action => :index </DIV><DIV> else</DIV><DIV> <B> render :action => :edit, :id => params[:id] # this line here</B></DIV><DIV> end</DIV></DIV><DIV> ...</DIV><DIV>end</DIV><DIV><BR> </DIV><DIV>The example has the following </DIV><DIV><BR> </DIV><DIV><DIV> it 'should render the "edit" config url on an unsuccessful save' do</DIV><DIV> @config.should_receive(:update_attributes).once.and_return(false)</DIV><DIV> c<B>ontroller.expect_render ( :action => :edit, :id => 1 ).once # my prob</B></DIV><DIV> do_update</DIV><DIV> end</DIV><DIV><BR> </DIV><DIV>This fails with</DIV><DIV>...</DIV><DIV>Mock 'expect_render_mock_proxy' expected :render with ({:action=>:edit, :id=>1}) once, but received it 0 times </DIV><DIV><BR> </DIV><DIV>I have tried</DIV><DIV><DIV> controller.expect_render( :action => :edit ).once</DIV><DIV><DIV><BR> </DIV><DIV>Am I using #expect_render correctly?</DIV><DIV><BR> </DIV><DIV>Thanks for all and any help! </DIV><DIV><BR> </DIV><DIV>Cheers!</DIV><DIV>sinclair</DIV></DIV></DIV></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">rspec-users mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://rubyforge.org/mailman/listinfo/rspec-users">http://rubyforge.org/mailman/listinfo/rspec-users</A></DIV> </BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>