I needed to stub out a Backbone collection’s fetch method and make it return success. I’m using Jasmine BDD for the testing framework and Sinon.js for stubbing the methods. Here’s how I did it: (more…)
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. I’ve gone through the new Rspec book (review to come) and used Cucumber and Rspec on my Rails app. 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 was rolling happily along writing tests for my Backbone.js controllers, collections and models with Jasmine/Sinon.js. Then I got to views and hit a wall. Why? Well, I’m using Jammit to package my assets for production. This is cool and all for individual javascript files as I’m also adding them to my jasmine.yml config file. 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. (more…)
I just finished quickly putting up a simple, compilation site. This was a business was a group of successful blogs, who had recently moved all their emails addresses to be under one header. As a consequence, people were occasionally hitting the email url. At the time the url just redirected to the flagship site, but the owner wanted the site to be a bit more informative without too much effort.
All that was needed was an intro and an RSS feed for each of the sites. I used the Google Feed API and jQuery and it was pretty simple. The one snafu had to do with javascript closures and the Google Feed API callback.
Now that you’ve got the background, let’s get started. (more…)





