This extends Jasmine so that the code under test can be compiled using Sprockets. This allows for declarative dependency management and preprocessing.
Installation with Bundler
In the Gemfile
add:
...
gem 'jasmine-sprockets'
...
By default jasmine-sprockets will add the directory vendor
to the load path for resolving dependencies. This is useful if the code under test requires external dependencies that are not part of the library. To change this behaviour edit jasmine.yml
and add:
# sprocket_dirs
#
# Return an array of directories used by sprockets to resolve dependencies
sprocket_dirs:
- vendor
In the Gemfile
add:
...
gem 'coffee-script'
gem 'tilt'
...
And in jasmine_runner.rb
add:
...
::Tilt::CoffeeScriptTemplate.default_bare = true
...