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)
    c*ontroller.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
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to