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 => {
:operation
=> ‘edit’, :submit_button_value => ‘Update’ }
end

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
was
rendered - there is no checking of ‘:replace_html’, and I’m not sure how
to
check for any other rjs calls that don’t render a partial. And, as it
is
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?

Thanks.

  • Korny

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs