We'll respond shortly.
UPDATE – as of Rails 3.1.rc8 nothing in this post works at all. Once I figure it out I’ll post the results here.
To start, we looked into several existing solutions, including the following:
After looking through them, we decided:
So we decided to roll our own. At a high level, we hooked into the Jasmine::Config class to clear and regenerate the rails assets into a tmp directory, compile the coffee script specs into a tmp directory, then run jasmine off of the compiled files.
# Gemfile group :development, :test do gem 'jasmine', '188.8.131.52' gem 'headless', '0.1.0' end
At this point you can delete the generated js example files and specs.
The Rails internals are likely to change, so we decided to only use the high-level rake tasks provided.
Making that spec pass is pretty simple, and looks something like this:
To get the specs to run headlessly, we added the following task (thanks to Mike Gehard for the pointers):
# lib/tasks/headless_jasmine.rake namespace :jasmine do namespace :ci do desc "Run Jasmine CI build headlessly" task :headless do Headless.ly do puts "Running Jasmine Headlessly" Rake::Task['jasmine:ci'].invoke end end end end
And we added the following to our build script:
# build.sh bundle exec rake jasmine:ci:headless
One final step before committing was to ignore those generated files: