Using Teaspoon

Teaspoon is a javascript test runner for Rails. You can use it to run tests in the browser or headless with PhantomJS, Selenium WebDriver or Capybara Webkit. In SEEK, we use Teaspoon together with Selenium WebDriver.

To run Teaspoon in browser, start your rails server and access:

http://localhost:3000/teaspoon

To run Teaspoon from rake task:

rake teaspoon

Mocha is used together with Teaspoon. Mocha is a javascript testing framework. We integrate Chai as the assertion library, and Sinon for stubing/spying/mocking request

To write javascript test in SEEK, add your *_spec.js file under spec/javascripts folder.

You can find an example here: upload_selection_spec.js