app.user returns false instead of undefined if logged out, fix #2723
This commit is contained in:
parent
dbfbab3a4f
commit
51d1bbbd70
2 changed files with 7 additions and 1 deletions
|
|
@ -6,7 +6,7 @@ var app = {
|
||||||
|
|
||||||
user: function(user) {
|
user: function(user) {
|
||||||
if(user) { return this._user = user }
|
if(user) { return this._user = user }
|
||||||
return this._user
|
return this._user || false
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
|
|
||||||
|
|
@ -7,5 +7,11 @@ describe("app", function() {
|
||||||
|
|
||||||
expect(app.user()).toEqual({name: "alice"});
|
expect(app.user()).toEqual({name: "alice"});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("returns false if the current_user isn't set", function() {
|
||||||
|
app._user = undefined;
|
||||||
|
|
||||||
|
expect(app.user()).toEqual(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue