Functional Testing - page actions

Pretty simple question, I’ve tried to ajaxify some actions and the first
one I did was a delete -

def delete_job

render :update do |page|
page.remove “job_#{id}”
end

end

and in my functional test I call this function via post

def test…
post :delete_job, :id => 1
assert_response :success

end

after the assert_response, how do I test that the page is deleting the
job / div? I created some entries and ran this manually and it worked,
but I don’t know what the assert is for the test.

On 1 Apr 2008, at 16:55, Bob Br wrote:

after the assert_response, how do I test that the page is deleting the
job / div? I created some entries and ran this manually and it
worked,
but I don’t know what the assert is for the test.

There’s assert_select_rjs and i’ve also used a plugin called arts
Fred

Frederick C. wrote:

There’s assert_select_rjs and i’ve also used a plugin called arts
Fred

Forgot to say thank you eariler, that was exactly what I was looking
for.

Course heres a similar but new question -

Now I’ve gotten more ajax and javascript calls going on.
On one page there is a js function to remove an item from one list box,
and a function to add the item to a second list box.

render :update do |page|
page.call “addNewElement”, ‘listbox_a’, ‘id’, ‘text’, ‘value’
page.call “removeSelectedElemet”, ‘listbox_b’, ‘id’, ‘value’
end

where ‘value’ is the element id I’m working with.

The xhr call goes off without a hitch, but I’m stumped how to write the
functional test to make sure it works - it runs fine in a browser.

I originally tried the assert_select_rjs but since there isn’t a insert
or remove call in there, but a call to one of my own functions I’m not
sure what function I should be using.

In this same vein, how would you test that an alert box was fired?

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