Created
January 23, 2013 22:15
-
-
Save crebma/4614651 to your computer and use it in GitHub Desktop.
Using the prototype to isolation test backbone stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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