This repository was archived by the owner on Oct 10, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
re-working a lot of specs to clean them up, consolidating mail router…
… specs in to one file
- Loading branch information
Derick Bailey
committed
Sep 21, 2012
1 parent
a24ef88
commit 7448513
Showing
6 changed files
with
97 additions
and
93 deletions.
There are no files selected for viewing
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
describe("mail router", function(){ | ||
"use strict"; | ||
|
||
var router, startMail, inbox; | ||
|
||
beforeEach(function(){ | ||
startHistory(); | ||
|
||
startMail = spyOn(BBCloneMail, "startSubApp"); | ||
|
||
inbox = BBCloneMail.module("MailApp.Inbox"); | ||
|
||
router = BBCloneMail.module("MailRouter"); | ||
router.start(); | ||
}); | ||
|
||
afterEach(function(){ | ||
router.stop(); | ||
delete inbox.controller; | ||
}); | ||
|
||
function mockControllerMethod(methodName){ | ||
var spy = jasmine.createSpy(methodName); | ||
|
||
inbox.controller = {}; | ||
inbox.controller[methodName] = spy; | ||
|
||
return spy; | ||
} | ||
|
||
describe("when navigating to the inbox (empty route)", function(){ | ||
var showInbox; | ||
|
||
beforeEach(function(){ | ||
showInbox = mockControllerMethod("showInbox"); | ||
|
||
Backbone.history.loadUrl(""); | ||
}); | ||
|
||
it("should start the mail app", function(){ | ||
expect(startMail).toHaveBeenCalledWith("MailApp"); | ||
}); | ||
|
||
it("should show the inbox", function(){ | ||
expect(showInbox).wasCalled(); | ||
}); | ||
|
||
}); | ||
|
||
describe("when routing to an individual email", function(){ | ||
var showMailById; | ||
|
||
beforeEach(function(){ | ||
showMailById = mockControllerMethod("showMailById"); | ||
|
||
Backbone.history.loadUrl("inbox/mail/1"); | ||
}); | ||
|
||
it("should start the mail app", function(){ | ||
expect(startMail).toHaveBeenCalledWith("MailApp"); | ||
}); | ||
|
||
it("should show the email by id", function(){ | ||
expect(showMailById).toHaveBeenCalled(); | ||
}); | ||
|
||
}); | ||
|
||
describe("when navigating to a mail category", function(){ | ||
var showMailByCategory; | ||
|
||
beforeEach(function(){ | ||
showMailByCategory = mockControllerMethod("showMailByCategory"); | ||
|
||
Backbone.history.loadUrl("categories/foo"); | ||
}); | ||
|
||
it("should start the mail app", function(){ | ||
expect(startMail).toHaveBeenCalledWith("MailApp"); | ||
}); | ||
|
||
it("should show the email by category", function(){ | ||
expect(showMailByCategory).toHaveBeenCalled(); | ||
}); | ||
|
||
}); | ||
|
||
}); |