README in js-test-driver-rails-0.1.0 vs README in js-test-driver-rails-0.2.0
- old
+ new
@@ -2,18 +2,58 @@
To take advantage of it, you should create a js_test_driver.rb file in your RAILS_ROOT/config/ directory.
The file may contain following directives:
+# the paths are relative to the current directory, but you can use absolute paths too
+# this is different from the JsTestDriver which does not allow you to use absolute paths in the config file
includes 'foo', 'bar', 'public/javascripts/*.js' # files to be included
excludes 'public/javascripts/fail.js' # files to be excluded, useful with globbing
host 'my-laptop' # the host to which the test runner will connect, by default 'localhost'
port 6666 # the port to which test runner will connect, and on which the test server will start, by default 4224
browser 'firefox' # you can specify the default browsers which will be captured
Note, that this is a ruby file, so the file/browser list can be generated dynamically - it's completely up to you.
+
+For example in our project we examine a list of known browsers to determine the ones installed on the developer's system,
+and define only those that were found.
+
+Similarly we get the list of .js files to include from our asset packaging solution.
+
+js-test-driver-rails also allows you to define HTML fixtures easily.
+
+Imagine you have a directory structure like this:
+
+RAILS_ROOT:
+ test/
+ js/
+ fixtures/
+ foo/
+ a.html
+ a.html
+
+Then by defining the fixtures directory in your config file:
+fixtures "test/js/fixtures"
+
+At runtime, your tests will have access to the contents of the fixture files:
+htmlFixtures.all["a"] // contents of the test/js/fixtures/a.html
+htmlFixtures.all["foo/a"] // contents of the test/js/fixtures/foo/a.html
+
+You can customize the namespace and fixture container name:
+fixtures "test/js/fixtures", :name => "html", :namespace => "myApp"
+
+By default JsTestDriver comes with a pretty simple Test::Unit like testing framework.
+However it supports a couple of other frameworks, including Jasmine (http://pivotal.github.com/jasmine/), which
+is an RSpec-like BDD framework.
+
+If you want to user Jasmine, simply add:
+enable_jasmine
+
+in your config file, somewhere before including your test files and you are golden:)
+
+# the fixtures will be accessible through myApp.html["<fixture name goes here>"]
This gem comes with 3 rake tasks:
# start the js test driver server
rake js_test_driver:start_server
\ No newline at end of file