Commit 0d9158b2 authored by Addy Osmani's avatar Addy Osmani

Merge pull request #841 from NeilvB/controller-test-fix

Fake model now executes callback on getCount. Fixes failing tests.
parents a96ded27 14f5dba0
...@@ -11,14 +11,19 @@ describe('controller', function () { ...@@ -11,14 +11,19 @@ describe('controller', function () {
callback(todos); callback(todos);
}); });
model.getCount.andReturn({ model.getCount.andCallFake(function (callback) {
active: todos.filter(function (todo) {
return !todo.completed; var todoCounts = {
}).length, active: todos.filter(function (todo) {
completed: todos.filter(function (todo) { return !todo.completed;
return !!todo.completed; }).length,
}).length, completed: todos.filter(function (todo) {
total: todos.length return !!todo.completed;
}).length,
total: todos.length
};
callback(todoCounts);
}); });
model.remove.andCallFake(function (id, callback) { model.remove.andCallFake(function (id, callback) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment