From Jasmine-Rails Github Homepage :
The jasmine rail gem fully supports the Rails pipeline, which means you can:
- use coffee_script or other Javascript precompilers for source or test files
- use sprockets directives to control the inclusion / exclusion of dependent files
- use asset conveyor search paths to include assets from different sources / gems.
If you decide to use asset pipeline support, many jasmine.yml configurations become unnecessary , and you can rely on the Rails resource pipeline to do the tricky job of controlling which files are included in your testuite.
# minimalist jasmine.yml configuration when leveraging asset pipeline spec_files: - "**/*[Ss]pec.{js,coffee}"
This defines a name pattern for specification files. That is, zero or more characters, followed by Spec or Spec , and with the extension js or coffee .
Add the Jasmine-Rails route configuration to config/routes.rb .
mount JasmineRails::Engine => "/specs" if defined?(JasmineRails)
Now you can write the specification for checking Foo in spec / javascripts / my_spec.coffee.
describe 'Foo', -> it 'does something', -> expect(1 + 1).toBe(2)
The RoR project structure should be partially as follows:
RailsApp/ |---app/ |---config/ | |---routes.rb |---... |---spec/ |---javascripts/ |---my_spec.coffee |---support/ |---jasmine.yml
You can check the characteristics with:
bundle exec rake spec:javascript
Or you can start the rails server and check the path for Jasmine-Rails ( /specs ).