Lots of work on tests

This commit is contained in:
Robin Ward
2014-07-30 18:56:01 -04:00
parent b6684e7168
commit 6f36d5996d
43 changed files with 248 additions and 311 deletions

View File

@ -1,4 +1,4 @@
module("controller:header", "Header Controller");
moduleFor("controller:header", "controller:header");
test("showNotifications action", function() {
var resolveRequestWith;
@ -6,17 +6,15 @@ test("showNotifications action", function() {
resolveRequestWith = resolve;
});
var controller = controllerFor('header');
var controller = this.subject();
var viewSpy = {
showDropdownBySelector: sinon.spy()
};
this.stub(Discourse, "ajax").withArgs("/notifications").returns(request);
this.stub(Discourse.User, "current").returns(Discourse.User.create({
sandbox.stub(Discourse, "ajax").withArgs("/notifications").returns(request);
sandbox.stub(Discourse.User, "current").returns(Discourse.User.create({
unread_notifications: 1
}));
Ember.run(function() {
controller.send("showNotifications", viewSpy);
});
@ -25,7 +23,6 @@ test("showNotifications action", function() {
equal(Discourse.User.current().get("unread_notifications"), 1, "current user's unread notifications count is not zeroed before data has finished loading");
ok(viewSpy.showDropdownBySelector.calledWith("#user-notifications"), "dropdown with loading glyph is shown before data has finished loading");
Ember.run(function() {
resolveRequestWith(["notification"]);
});