[rspec-users] Testing render :update

David Chelimsky dchelimsky at gmail.com
Mon Jun 14 20:05:47 EDT 2010

On Jun 14, 2010, at 6:40 PM, Marcelo de Moraes Serpa wrote:

> Hey guys.
> I would like to test the following behavior:
>        render :update do |page|
>             page.replace_html 'errors', :partial => 'signup_errors', :locals => { :errors => 'errors'}
>           end
>         }
> I'm doing:
> controller.should_receive(:render).with(:update)
> But I am not sure on how to test the block. Maybe checking out what is the class of the page var and setting up an expection on it?

Hmmm. The common idiom for this is:

page = double('page')

This does not seem to work with rspec-2/rails-3. Don't know why yet (won't be able to look for a bit), but my guess is that something (like rspec :) ) is adding render() to the controller even later than this stub does. I'll follow up if I learn something.


More information about the rspec-users mailing list