Permalink
Browse files

Added additional controller spec for fetching Todos

  • Loading branch information...
1 parent 3691929 commit 5d60428c0621253749af78724a0c9230dedf5d1a @froots committed Apr 21, 2011
@@ -10,6 +10,7 @@ var AppController = Backbone.Controller.extend({
this.todosView = new TodoListView({
collection: this.todos
});
+ this.todos.fetch();
},
todo: function(id) {
@@ -3,6 +3,8 @@ describe("AppController", function() {
beforeEach(function() {
this.controller = new AppController();
this.collection = new Backbone.Collection();
+ this.fetchStub = sinon.stub(this.collection, "fetch")
+ .returns(null);
this.todo = new Backbone.Model();
this.todoListViewStub = sinon.stub(window, "TodoListView")
.returns(new Backbone.View());
@@ -41,6 +43,11 @@ describe("AppController", function() {
});
});
+ it("fetches the Todo list from the server", function() {
+ expect(this.fetchStub).toHaveBeenCalledOnce();
+ expect(this.fetchStub).toHaveBeenCalledWith();
+ });
+
});
});

0 comments on commit 5d60428

Please sign in to comment.