mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-18 03:25:31 -05:00
12 lines
576 B
JavaScript
12 lines
576 B
JavaScript
module("Discourse.HasCurrentUser");
|
|
|
|
test("adds `currentUser` property to an object and ensures it is not cached", function() {
|
|
sinon.stub(Discourse.User, "current");
|
|
var testObj = Ember.Object.createWithMixins(Discourse.HasCurrentUser, {});
|
|
|
|
Discourse.User.current.returns("first user");
|
|
equal(testObj.get("currentUser"), "first user", "on the first call property returns initial user");
|
|
|
|
Discourse.User.current.returns("second user");
|
|
equal(testObj.get("currentUser"), "second user", "if the user changes, on the second call property returns changed user");
|
|
});
|