Created
January 10, 2011 16:25
-
-
Save gmoeck/772982 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var mockedSetFunction, mockedFindFunction, setMockObject, findMockObject; | |
module("Todos.main", { | |
setup: function() { | |
mockedSetFunction = Todos.tasksController.set; //ADDED THIS | |
setMockObject = CoreTest.stub('Todos.tasksController.set', function() { return YES; }); //ADDED THIS | |
Todos.tasksController.set = setMockObject; //ADDED THIS | |
mockedFindFunction = Todos.store.find; | |
findMockObject = CoreTest.stub('Todos.store.find', function() { return YES; }); | |
Todos.store.find = findMockObject; | |
Todos.main(); | |
}, | |
teardown: function() { | |
Todos.getPath('mainPage.mainPane').remove(); | |
Todos.tasksController.set = mockedSetFunction;//ADDED THIS | |
Todos.store.find = mockedFindFunction; | |
} | |
}); | |
test("setup finding tasks", function() { | |
equals(findMockObject.callCount, 1, "Should delegate to the store to find the tasks"); | |
}); | |
test("setup tasksController content", function() { | |
equals(setMockObject.callCount, 1, "Should delegate to the tasksController to setup content"); //ADDED THIS | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment