A very simple example of using jasmine for JavaScript testing and a couple of tools that make test driven development easier.
-
Install Homebrew
-
Install git
brew install git
-
Install Qt
brew install qt
-
Install RVM
Be sure to modify your shell rc file as instructed.
-
Install ruby-1.9.2-p290
rvm install ruby-1.9.2-p290
rvm use ruby-1.9.2-p290
ruby -v
# should report "ruby 1.9.2p290..." -
Checkout the project
git clone git://github.com/christiannelson/jasmine-testing-example.git
-
CD into project (and switch to the right ruby version and gemset)
cd jasmine-testing-example
Say yes to trusting the .rvmrc
-
Install bundler
gem install bundler --pre
-
Install dependencies using bundler
bundle
bundle exec jasmine-headless-webkit
TBD: the jasmine gem only provide a rake task (no jasmine command line) and it pulls in countless unnecessary dependencies.
Guard will monitor changes to the js or the tests. When a change is detected, the tests are run automatically.
bundle exec guard
Make a change to the js or tests, watch guard do its thing. It'll notify via growl if it's installed. Press enter to manually kick off a test run.