From 558bc6b746928a1fcdb2773b0447ea4a57aa7419 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Thu, 31 Mar 2022 12:06:19 +0100 Subject: [PATCH] DEV: Fix flaky specs (#16340) `group_permissions` are not serialized in a consistent order Follow-up to dfaf9831f7e6f545b25b7ce00db5e0816a1414fb --- spec/serializers/category_serializer_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/serializers/category_serializer_spec.rb b/spec/serializers/category_serializer_spec.rb index f54be956dd0..a224861140e 100644 --- a/spec/serializers/category_serializer_spec.rb +++ b/spec/serializers/category_serializer_spec.rb @@ -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