mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Provide group name if not provided and save
This commit is contained in:
@@ -45,10 +45,33 @@ describe('Invite to Group Controller', function() {
|
||||
|
||||
describe('inviteNewUsers', function() {
|
||||
beforeEach(function() {
|
||||
scope.group = specHelper.newGroup();
|
||||
scope.group = specHelper.newGroup({
|
||||
$save: sinon.stub().returns({
|
||||
then: function(cb) { cb(); }
|
||||
})
|
||||
});
|
||||
sandbox.stub(groups.Group, 'invite');
|
||||
});
|
||||
|
||||
context('pre-invite', function() {
|
||||
it('saves the group', function() {
|
||||
scope.inviteNewUsers('uuid');
|
||||
expect(scope.group.$save).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('uses provided name', function() {
|
||||
scope.group.name = 'test party';
|
||||
scope.inviteNewUsers('uuid');
|
||||
expect(group.name).to.eql('test party');
|
||||
});
|
||||
|
||||
it('names the group if no name is provided', function() {
|
||||
scope.group.name = '';
|
||||
scope.inviteNewUsers('uuid');
|
||||
expect(group.name).to.eql(env.t('possessiveParty', {name: user.profile.name}));
|
||||
});
|
||||
});
|
||||
|
||||
context('email', function() {
|
||||
it('invites user with emails', function() {
|
||||
scope.emails = [
|
||||
|
||||
Reference in New Issue
Block a user