[rspec-users] controller.expect_render has me beat!
sinclair bain
rspec.user at gmail.com
Mon Oct 1 10:56:14 EDT 2007
Hans that did it!
Thanks for that one!
Cheers!
sinclair
On 9/25/07, Hans de Graaff <hans at degraaff.org> wrote:
>
> 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
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071001/1168e781/attachment-0001.html
More information about the rspec-users
mailing list