On 2010-06-14 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?

Any suggestions appreciated,

Marcelo.

I don't know if this is the "right" way to do it, but if I'm going to test this code:

            render :update do |page|
page.replace :flash_messages, :partial => '_partials/web/layouts/flash_messages'
            end

I use this:

            it 'should render update' do
                page = mock('page')
page.should_receive(:replace).with(:flash_messages, :partial => '_partials/web/layouts/flash_messages') controller.should_receive(:render).with(:update).and_yield(page)
                xhr :post, :create, <some params>
            end

Peace,
Phillip

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to