[rspec-users] response is null when using should_render_rjs

Michael Johnston lastobelus at mac.com
Thu Nov 30 08:07:19 EST 2006

I had tried it without :page and got the same error, and I also  
switched to the syntax you suggested but still get the same error. So  
something else is going on there. When I have time I'll sandbox it  
and try to track it down.

For now unfortunately I have to switch from my newly burgeoning BDD  
mode to my tried-and-true SSCT* mode.


*show something [to the] client tomorrow

On 30-Nov-06, at 4:19 AM, David Chelimsky wrote:

> On 11/30/06, Michael Johnston <lastobelus at mac.com> wrote:
>> I'm trying to use rspec to test a controller that has ajax.
>> I have the following action:
>>    def change_ad_type_form
>>      render :update do |page|
>>        page.replace_html 'ad_sub_form', :partial => 'text'
>>      end
>>    end
>> and the following spec:
>>    specify "should return Text subform on AJAX request to
>> change_ad_type_form" do
>>      controller.should_render_rjs :page,
>> 'ad_sub_form', :replace_html, 'stuff'
>>      get 'change_ad_type_form'
>>    end
> Using :page in the should_render_rjs call is specifically for elements
> accessed via page[:element_name]. You need to either remove :page from
> your spec or change the implementation to read:
> page[:ad_sub_form].replace_html :partial => 'text'
> Cheers,
> David

More information about the rspec-users mailing list