refactor isMemberOfGroup and tests

This commit is contained in:
Blade Barringer
2015-04-16 07:58:35 -05:00
parent 68486f7c42
commit 1d95784dde
2 changed files with 4 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
'use strict'; 'use strict';
describe.only('Groups Controller', function() { describe('Groups Controller', function() {
var scope, ctrl, groups, user, guild, $rootScope; var scope, ctrl, groups, user, guild, $rootScope;
beforeEach(function() { beforeEach(function() {
@@ -34,7 +34,7 @@ describe.only('Groups Controller', function() {
return [guild]; return [guild];
}); });
expect(scope.isMemberOfGroup(user._id, guild)).to.be.eql(true); expect(scope.isMemberOfGroup(user._id, guild)).to.be.ok;
expect(myGuilds).to.be.called expect(myGuilds).to.be.called
}); });
@@ -48,7 +48,7 @@ describe.only('Groups Controller', function() {
return []; return [];
}); });
expect(scope.isMemberOfGroup(user._id, guild)).to.be.eql(false); expect(scope.isMemberOfGroup(user._id, guild)).to.not.be.ok;
expect(myGuilds).to.be.called expect(myGuilds).to.be.called
}); });
}); });

View File

@@ -20,7 +20,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
// If the group is a guild, just check for an intersection with the // If the group is a guild, just check for an intersection with the
// current user's guilds, rather than checking the members of the group. // current user's guilds, rather than checking the members of the group.
if(group.type === 'guild') { if(group.type === 'guild') {
return _.detect(Groups.myGuilds(), function(g) { return g._id === group._id }) ? true : false; return _.detect(Groups.myGuilds(), function(g) { return g._id === group._id });
} }
if (!group.members) return false; if (!group.members) return false;