2017-06-14 13:57:58 -04:00
|
|
|
moduleFor("controller:group", {
|
|
|
|
needs: ["controller:application"]
|
|
|
|
});
|
2016-11-29 03:25:02 -05:00
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
QUnit.test("canEditGroup", function(assert) {
|
2016-11-29 03:25:02 -05:00
|
|
|
const GroupController = this.subject();
|
|
|
|
|
|
|
|
GroupController.setProperties({
|
|
|
|
model: { is_group_owner: true, automatic: true }
|
|
|
|
});
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
assert.equal(
|
|
|
|
GroupController.get("canEditGroup"),
|
|
|
|
false,
|
|
|
|
"automatic groups cannot be edited"
|
|
|
|
);
|
2016-11-29 03:25:02 -05:00
|
|
|
|
|
|
|
GroupController.set("model.automatic", false);
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
assert.equal(
|
|
|
|
GroupController.get("canEditGroup"),
|
|
|
|
true,
|
|
|
|
"owners can edit groups"
|
|
|
|
);
|
2016-11-29 03:25:02 -05:00
|
|
|
|
|
|
|
GroupController.set("model.is_group_owner", false);
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
assert.equal(
|
|
|
|
GroupController.get("canEditGroup"),
|
|
|
|
false,
|
|
|
|
"normal users cannot edit groups"
|
|
|
|
);
|
2016-11-29 03:25:02 -05:00
|
|
|
});
|