2014-06-11 05:23:38 -04:00
|
|
|
var controller;
|
|
|
|
|
|
|
|
module("controller:user-dropdown", {
|
|
|
|
setup: function() {
|
|
|
|
controller = testController('user-dropdown');
|
|
|
|
}
|
|
|
|
});
|
2014-02-11 20:56:49 -05:00
|
|
|
|
|
|
|
test("logout action logs out the current user", function () {
|
|
|
|
var logout_mock = sinon.mock(Discourse, "logout");
|
|
|
|
logout_mock.expects("logout").once();
|
|
|
|
|
2014-05-26 14:39:50 -04:00
|
|
|
var controller = controllerFor('user-dropdown');
|
2014-02-11 20:56:49 -05:00
|
|
|
controller.send("logout");
|
|
|
|
|
|
|
|
logout_mock.verify();
|
|
|
|
});
|
|
|
|
|
|
|
|
test("showAdminLinks", function() {
|
|
|
|
var currentUserStub = Ember.Object.create();
|
|
|
|
this.stub(Discourse.User, "current").returns(currentUserStub);
|
|
|
|
|
|
|
|
currentUserStub.set("staff", true);
|
|
|
|
equal(controller.get("showAdminLinks"), true, "is true when current user is a staff member");
|
|
|
|
|
|
|
|
currentUserStub.set("staff", false);
|
|
|
|
equal(controller.get("showAdminLinks"), false, "is false when current user is not a staff member");
|
|
|
|
});
|