2013-12-19 12:54:24 -05:00
|
|
|
module("Discourse.HasCurrentUser");
|
2013-09-30 15:46:42 -04:00
|
|
|
|
|
|
|
test("adds `currentUser` property to an object and ensures it is not cached", function() {
|
2014-06-19 16:00:01 -04:00
|
|
|
this.stub(Discourse.User, "current");
|
2013-09-30 15:46:42 -04:00
|
|
|
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");
|
|
|
|
});
|