Testing RJS with ARTS
Posted by marcel May 31, 2006 @ 02:51 PM
An Achilles’ heal of Rails is no good way to test your RJS. As the presentation behavior gets more and more sophisticated, the inability to test it becomes a real problem. Not anymore.
Kevin Clark has released ARTS, a mechanism to test RJS. His API is simple yet flexible. A single point of entry let’s you test a considerable amount of the RJS you can generate. Here’s an idea of what you can do:
assert_rjs :alert, 'Hi!'
assert_rjs :assign, 'a', '2'
assert_rjs :call, 'foo', 'bar', 'baz'
assert_rjs :draggable, 'draggable_item'
assert_rjs :drop_receiving, 'receiving_item'
assert_rjs :hide, "post_1", "post_2", "post_3"
assert_rjs :insert_html, :bottom, 'posts'
assert_rjs :redirect_to, :action => 'list'
assert_rjs :remove, "post_1", "post_2", "post_3"
assert_rjs :replace, 'completely_replaced_div', '<p>This replaced the
div</p>'
assert_rjs :replace_html, 'replaceable_div', "This goes inside the
div"
assert_rjs :show, "post_1", "post_2", "post_3"
assert_rjs :sortable, 'sortable_item'
assert_rjs :toggle, "post_1", "post_2", "post_3"
assert_rjs :visual_effect, :highlight, "posts", :duration => '1.0'
He’s written up an extensive tutorial to get you up and running.

Now i’ll make an audio layer and call it Rails… come on..
Minor typo alert: that should be “Achilles’ heel,” not “Achilles heal.”
But thanks for the very informative link!
Dave: rjs_assertions was taken ;) It’s Another RJS Testing System.
why does thos blog look like sh*t on IE on windoze XP? I use firefox on my mac from home, but this is ridiculous.
For me the achilles’ heel is postgres testing support :D
Nice work!
But, it would have been better to just fix the existing rjs asertion plugin instead of making another one.
Wasted, that won’t be very DRY, that is why its always better to create a new plugin. Fixing the old code is sooo yesterday and NON_DRY! HELLLOOOOO! Pluse if we leverage the broadband with the web 2.0 and whip the eyeballs with the long tail, we should be able to do a startup with more joy and less pain.
P.S. Please fix the firkin flagship site, its horrible on IE.
Another voice crying out in pain on the IE issue.
Wish I could use Firefox at work but my IT department has locked down my machine
bust on ie. kill it now.
See my original post on the IE issue and some responses here (http://www.ruby-forum.com/topic/67202#83341). A couple of people suggested fixes. Not sure who needs to implement one or the other of them.