Javascript Developer Plugin
This plugin makes it easy to do TDD and/or BDD Javascript development.
Included
are generators to facilitate building Javascript tests and applications,
along with
Rake tasks for easily running these tests in a browser of your choice.
Many thanks to the javascript_test plugin. If you want
Script.taculo.us’s
unittest.js,
then please go use this plugin. I’ve taken it and converted to use
JSUnit.
== Generators ==
-
js_class / js_file
create public/javascripts/
create test/javascripts/unit/
create public/javascripts/[classname].js
create test/javascripts/unit/[classname]_test.html
These generators accept relative paths as well as plain class names, so
script/generate js_class my_js_app/my_class
will produce:
create public/javascripts/
create test/javascripts/unit/my_js_app
create public/javascripts/my_js_app/my_class.js
create test/javascripts/unit/my_js_app/my_class_test.html
There’s only a slight difference from js_class and js_file: js_class
gives
you an
Object template, while js_file gives you an empty .js file.
== Rake tasks ==
rake test:javascripts - Runs all javascript tests
This task takes a couple of command-line arguments:
-
KEEP_ALIVE=true will keep the test server up for current development
use -
BROWSER=[browser name] lets you select which browser to run the tests
under:- firefox
- safari
- ie
- konqueror
default is firefox