Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- });
Add Comment
Please, Sign In to add comment