Activate your free membership today | Log-in

Friday, January 4th, 2008

Autotesting JavaScript in Rails

Category: Articles, Testing

<>p>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.

Related Content:

  • Ajax on Rails
    In this interview Ruby on Rails creator David Heinemeier Hansson, he talks about how Ajax has become part of its "full stack" in the new Rails 1.1....
  • Ruby on Rails update aims at Ajax
    Ruby on Rails 1.1 offers RJS as an alternative to JavaScript for coding Ajax applications. "It's the perfect antidote for your JavaScript blues,"...
  • Mustang beta ready to roll
    Sun has released the beta version of Java Standard Edition 6, code named Mustang, complete with enhanced diagnostics, a bundled Web services client...
  • FAQ: Lotus Notes, Domino and JavaScript
    Caught in a JavaScript jam? Before posing a question to our SearchDomino.com experts, check out our list of frequently asked questions on JavaScript...
  • Web services with Ruby on Rails
    The Ruby on Rails framework has added REST support, making it a Web service alternative to SOAP stack...

Posted by Dion Almaer at 7:56 am
1 Comment

+++--
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.