[rspec-users] controller.expect_render has me beat!
Hans de Graaff
hans at degraaff.org
Tue Sep 25 14:54:54 EDT 2007
On Fri, 2007-09-14 at 17:51 -0400, sinclair bain wrote:
>
> 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
> 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
I'm not sure what do_update is doing? I assume it is doing a post? In
any case params are normally strings, so doing
controller.expect_render(:action => :edit, :id => '1').once
will most likely work.
Kind regards,
Hans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://rubyforge.org/pipermail/rspec-users/attachments/20070925/0bb90090/attachment-0001.bin
More information about the rspec-users
mailing list