From 89bdebac3c531395fa85d4927c95b1632ffa129c Mon Sep 17 00:00:00 2001 From: Wojciech Zawistowski Date: Thu, 19 Dec 2013 18:59:30 +0100 Subject: [PATCH] fixes HeaderController test --- .../controllers/header_controller_test.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/test/javascripts/controllers/header_controller_test.js b/test/javascripts/controllers/header_controller_test.js index 30c51b19553..e64842778ee 100644 --- a/test/javascripts/controllers/header_controller_test.js +++ b/test/javascripts/controllers/header_controller_test.js @@ -1,12 +1,4 @@ -module("Discourse.HeaderController", { - setup: function() { - sinon.stub(Discourse, "ajax"); - }, - - teardown: function() { - Discourse.ajax.restore(); - } -}); +module("Discourse.HeaderController"); test("showNotifications action", function() { var resolveRequestWith; @@ -19,10 +11,10 @@ test("showNotifications action", function() { var viewSpy = { showDropdownBySelector: sinon.spy() }; - Discourse.User.current().set("unread_notifications", 1); - Ember.run(function() { - Discourse.ajax.withArgs("/notifications").returns(request); - }); + this.stub(Discourse, "ajax").withArgs("/notifications").returns(request); + this.stub(Discourse.User, "current").returns(Discourse.User.create({ + unread_notifications: 1 + })); Ember.run(function() {