# Rspec on javascript links

**URL:** <https://www.ruby-forum.com/t/rspec-on-javascript-links/148863>\
**Category:** RSpec\
**Created:** [September 17, 2008, 8:46pm UTC](https://www.ruby-forum.com/t/rspec-on-javascript-links/148863 "2008-09-17T20:46:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsamildanach](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e0b2c6/32.png) [@jsamildanach](https://www.ruby-forum.com/u/jsamildanach)\
**Post date:** [September 17, 2008, 8:46pm UTC](https://www.ruby-forum.com/t/rspec-on-javascript-links/148863/1 "2008-09-17T20:46:20Z")

</div>

## I have a lot of AJAX calls that make new divs or update information on the page. Is there anyway to test and if the right infomation has been received or displayed after an onclick action? If that makes sense?..

View this message in context:  
[http://www.nabble.com/rspec-on-javascript-links-tp19383154p19383154.html](http://www.nabble.com/rspec-on-javascript-links-tp19383154p19383154.html)  
Sent from the rspec-users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![jsamildanach](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e0b2c6/32.png) [@jsamildanach](https://www.ruby-forum.com/u/jsamildanach)\
**Post date:** [September 17, 2008, 10:55pm UTC](https://www.ruby-forum.com/t/rspec-on-javascript-links/148863/2 "2008-09-17T22:55:27Z")

</div>

On Tue, Sep 9, 2008 at 1:21 AM, saltzmanjoelh [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I have a lot of AJAX calls that make new divs or update information on the  
> page. Is there anyway to test and if the right infomation has been received  
> or displayed after an onclick action? If that makes sense?..

If you use RJS on the server you can use response.should have\_rjs:  
[http://rspec.info/rdoc-rails/classes/Spec/Rails/Matchers.html#M000055](http://rspec.info/rdoc-rails/classes/Spec/Rails/Matchers.html#M000055)  
[http://rspec.info/rdoc-rails/](http://rspec.info/rdoc-rails/)

If not, take a look at Watir or Selenium-RC

Aslak
