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.

On Sep 14, 2007, at 7:35 PM, sinclair bain wrote:

Hi,


A controller has a method with the following


 def update
    ...
    if @config.update_attributes ( params[:new_config] )
      redirect_to :action => :index
    else
render :action => :edit, :id => params[:id] # this line here
    end
  ...
end


The example has the following


  it 'should render the "edit" config url on an unsuccessful save' do
    @config.should_receive(:update_attributes).once.and_return(false)
controller.expect_render ( :action => :edit, :id => 1 ).once # my prob
    do_update
  end


This fails with
...
Mock 'expect_render_mock_proxy' expected :render with ({:action=>:edit, :id=>1}) once, but received it 0 times


I have tried
    controller.expect_render( :action => :edit ).once


Am I using #expect_render correctly?


Thanks for all and any help!


Cheers!
sinclair
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to