How to spec a render:update call

Hi folks.

I’m trying to work out how to verify that a controller has called a
render:update block similar to:
render :update do |page|
page.replace_html ‘edit’, :partial => ‘form’, :locals => {
=> ‘edit’, :submit_button_value => ‘Update’ }

We used to test this with something like:
response.should render_template("_form")
response.should have_rjs(:replace_html, ‘edit’)
… which works, but doesn’t validate the parameters.

Then I discovered we could do:
controller.expect_render(:partial => ‘form’, :locals => { :operation
‘edit’, :submit_button_value => ‘Update’ })
This will check the parameters, but doesn’t confirm how the response
rendered - there is no checking of ‘:replace_html’, and I’m not sure how
check for any other rjs calls that don’t render a partial. And, as it
mocking out the call to “render”, “should have_rjs” no longer works.

Any thoughts? Anyone got a suggestion for a way to check both the
parameters, and the kind of render:update call made?


  • Korny