Friday, January 4th, 2008
Autotesting JavaScript in Rails
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:
-
-
testTruth: function() { with(this) {
-
assert(true);
-
}}
-
You can go further though with the autotest watching over files, and Nic shows some TDD in action.













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 :)