Skip to content

Commit 2d3582e

Browse files
committed
Expand authority tests for GDS Editors and Admins
GDS Editors and Admins were already able to perform any action on historical content. This changes expands the tests for these users to more fully cover these permissions.
1 parent aea2960 commit 2d3582e

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

test/unit/lib/whitehall/authority/gds_admin_test.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ def non_gds_admin(id = 2)
3535
assert enforcer_for(gds_admin, normal_edition).can?(:mark_political)
3636
end
3737

38-
test "can modify historic editions" do
39-
assert enforcer_for(gds_admin, historic_edition).can?(:update)
38+
test "can do anything to historic editions" do
39+
Whitehall::Authority::Rules::EditionRules.actions.each do |action|
40+
assert enforcer_for(gds_admin, historic_edition).can?(action)
41+
end
4042
end
4143

4244
test "can create social media accounts" do

test/unit/lib/whitehall/authority/gds_editor_test.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,10 @@ def gds_editor(id = 1)
157157
assert enforcer_for(gds_editor, normal_edition).can?(:mark_political)
158158
end
159159

160-
test "can modify historic editions" do
161-
assert enforcer_for(gds_editor, historic_edition).can?(:update)
160+
test "can do anything to historic editions" do
161+
Whitehall::Authority::Rules::EditionRules.actions.each do |action|
162+
assert enforcer_for(gds_editor, historic_edition).can?(action)
163+
end
162164
end
163165

164166
test "can create social media accounts" do

0 commit comments

Comments
 (0)