discourse/test/javascripts/controllers/user-dropdown-test.js.es6

24 lines
757 B
Plaintext
Raw Normal View History

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 () {
var logout_mock = sinon.mock(Discourse, "logout");
logout_mock.expects("logout").once();
2014-07-30 18:56:01 -04:00
var controller = this.subject();
2014-02-11 20:56:49 -05:00
controller.send("logout");
logout_mock.verify();
});
test("showAdminLinks", function() {
var currentUserStub = Ember.Object.create();
2014-07-30 18:56:01 -04:00
sandbox.stub(Discourse.User, "current").returns(currentUserStub);
2014-02-11 20:56:49 -05:00
currentUserStub.set("staff", true);
2014-07-30 18:56:01 -04:00
var controller = this.subject();
2014-02-11 20:56:49 -05:00
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");
});