DEV: Fix flaky specs (#16340)

`group_permissions` are not serialized in a consistent order

Follow-up to dfaf9831f7
This commit is contained in:
David Taylor 2022-03-31 12:06:19 +01:00 committed by GitHub
parent 208534ea91
commit 558bc6b746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -76,28 +76,28 @@ describe CategorySerializer do
it "returns the right category group permissions for an anon user" do
json = described_class.new(category, scope: Guardian.new, root: false).as_json
expect(json[:group_permissions]).to eq([
expect(json[:group_permissions]).to contain_exactly(
{ permission_type: CategoryGroup.permission_types[:readonly], group_name: group.name },
])
)
end
it "returns the right category group permissions for a regular user" do
json = described_class.new(category, scope: Guardian.new(user), root: false).as_json
expect(json[:group_permissions]).to eq([
expect(json[:group_permissions]).to contain_exactly(
{ permission_type: CategoryGroup.permission_types[:readonly], group_name: group.name },
{ permission_type: CategoryGroup.permission_types[:full], group_name: user_group.name },
])
)
end
it "returns the right category group permission for a staff user" do
json = described_class.new(category, scope: Guardian.new(admin), root: false).as_json
expect(json[:group_permissions]).to eq([
expect(json[:group_permissions]).to contain_exactly(
{ permission_type: CategoryGroup.permission_types[:readonly], group_name: group.name },
{ permission_type: CategoryGroup.permission_types[:full], group_name: private_group.name },
{ permission_type: CategoryGroup.permission_types[:full], group_name: user_group.name }
])
)
end
end
end