I have a rails 3.1 project that I'd like to run some jasmine specs on. Problem is, my rails project requires some javascript files that are sourced from gems (most particularly backbone-rails), not my /assets directory.
Looking at the generated jasmine file's HTML, it's successfully including all assets from the JavaScripts /assets directory (compiled from coffeescript), but no javascript files generated by gems. Consequently I'm getting a bunch of 'class not found' errors.
So, any ideas on getting jasmine to require Rails 3.1 JavaScript files from gems, not just /assets? Current jasmine.yml included below. Any ideas appreciated
src_files:
- public/javascripts/prototype.js
- public/javascripts/effects.js
- public/javascripts/controls.js
- public/javascripts/dragdrop.js
- public/javascripts/application.js
- public/javascripts/**/*.js
- spec/**/*_spec.js
- "vendor/**/*.{js, coffee}"
- "lib/**/*.{js, coffee}"
- "app/**/*.{js, coffee}"
stylesheets:
- stylesheets/**/*.css
helpers:
- helpers/**/*.js
spec_files:
- '**/*[sS]pec.{js, coffee}'
src_dir: assets
spec_dir: spec/javascripts
I highly recommend using
jasmine-headless-webkit
to do jasmine testing in rails 3.1 apps. Here's myjasmine.yml
file:I'm using that with
jasmine-headless-webkit
to run my tests on the command-line (usingwatchr
to run them automatically when a file is changed)It's a wonderful way to test.