public/javascripts/backbone.viewhelper. spec/javascripts/support/jasmine-jquery-1.2.0.js spec/javascripts/support/jasmine-sinon.js spec/javascripts/support/sinon-1.1.0.js # Return an array of filepaths relative to src_dir to include before jasmine specs. Spec/javascripts/support/jasmine.yml file: By default, Jammit packages these into public/assets/app.js. Now in my jasmine.yml file, I need to include the filepath to the packages assets. My special assets_test.yml ONLY includes my jst templates. But while testing, I’d like to be able to debug those javascript files and have them individually included by Jasmine. Why? Well, in my real app it’s packaging and compressing ALL my javascript files, which is exactly what I want it to do. I’m sending Jammit a special config file here. Require Jammit and add to the Config class like so: Head to your spec/javascripts/support/jasmine_config.rb file. Basically, I’m having Jasmine run Jammit’s packager before it starts. The problem is that Jammit is packaging my haml templates into a global JST object and I need to access those templates, and more importantly, that global JST object when testing my view code.Īfter finding one or two posts on the topic, but none that I could make work, I have come up with a solution. This is cool and all for individual javascript files as I’m also adding them to my jasmine.yml config file. Why? Well, I’m using Jammit to package my assets for production. We tell Jammit to look in the tmp folder, which is where Sass and CoffeeScript are placing the generated JS files. I was rolling happily along writing tests for my Backbone.js controllers, collections and models with Jasmine/Sinon.js. We can put Guard to work along with Jammit, an asset packager which will combine our JS and CSS files into single files, with compression.n So we list our stylesheets that we want to combine, and we do the same with JS. I recently re-did the front-end with Backbone.js (and I am ready to marry it) and now I’m testing the javascript with Jasmine and Sinon.js. I’ve gone through the new Rspec book (review to come) and used Cucumber and Rspec on my Rails app. In my new job, I’m trying to start things out right - behavior-driven, test-driven, “cutting-edge” tools (whatever the hell that means), etc.