Activate your free membership today | Log-in

Friday, January 4th, 2008

Autotesting JavaScript in Rails

Category: Articles, Testing

Dr Nic has written a tutorial on testing JavaScript in Rails using a new javascript_test plugin.

Once you ruby script/plugin install javascript_test you can ruby script/generate javascript_test maths. Then you can write a test a la:

JAVASCRIPT:
  1.  
  2. testTruth: function() { with(this) {
  3.   assert(true);
  4. }}
  5.  

You can go further though with the autotest watching over files, and Nic shows some TDD in action.

Posted by Dion Almaer at 7:56 am

+++--
3.6 rating from 8 votes

1 Comment »

Comments feed TrackBack URI

And of course, if you like rspec and BDD more than xUnit and TDD, you can use js-spec, in which I’ve been working for a while now :)

Comment by foca — January 4, 2008

Leave a comment

You must be logged in to post a comment.