Skip to content
Dan Knox edited this page Sep 12, 2013 · 2 revisions

Setting Up The Development Environment

1. Clone the project.

git clone git@github.com:websocket-rails/websocket-rails.git

If you are planning on submitting a pull request, fork the project to your own account first and clone it from there.

2. Install the gems from the Gemfile

cd websocket-rails
bundle install

3. Run the full test suite with Rake

bundle exec rake

The full test suite includes the Jasmine tests for the JavaScript client. The default rake task will open up firefox in a browser window for a second or two and then close it after the rspec suite has finished.

You can run the Jasmine suite headlessly using the rake jasmine:ci command.

4. Start up Guard

bundle exec guard
[1] guard(main)>

The Guardfile included with the repository is configured to automatically run any specs related to the file you are editing after you save that file.

It is also configured to compile the CoffeeScript specs to plain JavaScript so Jasmine can read them. As soon as you save one of the Jasmine specs in spec/javascripts/websocket_rails, Guard will regenerate the compiled file in the correct location for Jasmine.

5. Start The Jasmine Server

If you are making any changes to the JavaScript client you will need to start the Jasmine server.

rake jasmine
your tests are here:
  http://localhost:8888/

Make sure to start Guard and run it once by pressing <enter> in order to compile the CoffeeScript files to JavaScript. If you do not do this, Jasmine will show zero specs when visiting the Jasmine URL for the first time. Leave Guard running to automatically recompile the CoffeeScript files after you save a file.

Once the Jasmine server has started, browse to the location listed in your console to view the spec output. You will need to manually refresh this page after making any changes to the JavaScript client or specs. Ensure you followed step #4 so that your changes are compiled upon save of the file.

6. Dev Away

Write a spec. Watch it fail. Add the code to make it pass. Rinse. Repeat.

Happy coding!