Skip to content

Instantly share code, notes, and snippets.

@crebma
Created January 23, 2013 22:15
Show Gist options
  • Save crebma/4614651 to your computer and use it in GitHub Desktop.
Save crebma/4614651 to your computer and use it in GitHub Desktop.
Using the prototype to isolation test backbone stuff
MyView = Backbone.View.extend({
initialize: function() {
//stuff I don't want to happen
},
render: function() {
this.yourMom();
},
yourMom: function() {
//whatevs
}
});
describe("MyView", function() {
it("renders your mom", function() {
var theThis = jasmine.createSpyObj('this', ['yourMom']);
MyView.prototype.render.call(theThis);
expect(theThis.yourMom).toHaveBeenCalled();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment