2014-07-30 18:56:01 -04:00
|
|
|
moduleFor("controller:user-dropdown");
|
2014-02-11 20:56:49 -05:00
|
|
|
|
|
|
|
test("logout action logs out the current user", function () {
|
2015-02-26 12:25:25 -05:00
|
|
|
const logoutMock = sinon.mock(Discourse, "logout");
|
|
|
|
logoutMock.expects("logout").once();
|
2014-02-11 20:56:49 -05:00
|
|
|
|
2015-02-26 12:25:25 -05:00
|
|
|
this.subject().send('logout');
|
2014-02-11 20:56:49 -05:00
|
|
|
|
2015-02-26 12:25:25 -05:00
|
|
|
logoutMock.verify();
|
2014-02-11 20:56:49 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
test("showAdminLinks", function() {
|
2015-02-26 12:25:25 -05:00
|
|
|
const currentUser = Ember.Object.create({ staff: true });
|
|
|
|
const controller = this.subject({ currentUser });
|
2014-02-11 20:56:49 -05:00
|
|
|
equal(controller.get("showAdminLinks"), true, "is true when current user is a staff member");
|
|
|
|
|
2015-02-26 12:25:25 -05:00
|
|
|
currentUser.set("staff", false);
|
2014-02-11 20:56:49 -05:00
|
|
|
equal(controller.get("showAdminLinks"), false, "is false when current user is not a staff member");
|
|
|
|
});
|