# Functional Testing - page actions

**URL:** <https://www.ruby-forum.com/t/functional-testing-page-actions/133562>\
**Category:** Rails\
**Created:** [April 1, 2008, 5:55pm UTC](https://www.ruby-forum.com/t/functional-testing-page-actions/133562 "2008-04-01T17:55:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![syg6](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/439d5e/32.png) [@syg6](https://www.ruby-forum.com/u/syg6)\
**Post date:** [April 1, 2008, 5:55pm UTC](https://www.ruby-forum.com/t/functional-testing-page-actions/133562/1 "2008-04-01T17:55:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![syg6](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/439d5e/32.png) [@syg6](https://www.ruby-forum.com/u/syg6)\
**Post date:** [April 1, 2008, 6:11pm UTC](https://www.ruby-forum.com/t/functional-testing-page-actions/133562/2 "2008-04-01T18:11:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![syg6](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/439d5e/32.png) [@syg6](https://www.ruby-forum.com/u/syg6)\
**Post date:** [May 9, 2008, 10:36pm UTC](https://www.ruby-forum.com/t/functional-testing-page-actions/133562/3 "2008-05-09T22:36:57Z")

</div>

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?
