JsSpec

The JsSpec ruby library is a server runner for the JsSpec javascript library.

code.google.com/p/jsspec/ jania.pe.kr/aw/moin.cgi/JSSpec

Installing JsSpec

You can use JsSpec as a gem or as a Rails plugin. To install the gem, run:

sudo gem install js_spec

To install the plugin, run:

script/plugin install svn://rubyforge.org/var/svn/pivotalrb/js_spec/trunk
script/generate js_spec

The Rails plugin gives you generators when using JsSpec in a Rails environment.

Using JsSpec

First you need to start your JsSpec server.

If you are using js_spec_server as a Rails plugin, you can simply run:

script/js_spec_server

If you are using the js_spec gem, you can run:

js_spec_server /path/to/your/javascript/spec/files /path/to/your/javascript/implementation/files

Once the server is started, there are two possibly ways to run your js spec:

* Open your browser to http://localhost:8080/specs
* Start the Selenium server by running `selenium` from the command line, then running `js_spec` from the command line

JsSpec on CI

JS spec uses the Selenium gem to automatically control browsers on different machines.

To use JsSpec in a CI environment,

* Install and run the selenium RC server on the machine that you want to run the browsers by using the command:
  selenium
* Run the js_spec_server on the machine that has the files.
  script/js_spec_server
* Run the js_spec client. The js_spec client has --selenium_browser_start_command, --selenium_host, --selenium_port, and --spec_url arguments to specify
  where the Selenium server is relative to the js_spec server, and where the js_spec server is relative to the browser.
* Running `script/js_spec_server` is equivalent to running `script/js_spec_server --selenium_browser_start_command *firefox --selenium_host localhost --selenium_port 4444 --spec_url http://localhost:8080/specs`