diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-04 16:57:33 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-05 11:10:57 +0200 |
commit | 57bd3bb34a19bf812fd6a74f394a69c491b05dd0 (patch) | |
tree | 1407f3824a3d0b22bd64fefdfd8a2b4e6ee2c8f2 /spec/serializers | |
parent | 06e00913f505268e0a45f4f1516a93a84600c242 (diff) | |
download | gitlab-ce-57bd3bb34a19bf812fd6a74f394a69c491b05dd0.tar.gz |
Force parents to be preloaded for building a hierarchy
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/group_child_serializer_spec.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/spec/serializers/group_child_serializer_spec.rb b/spec/serializers/group_child_serializer_spec.rb index e5896f54dd7..30333386058 100644 --- a/spec/serializers/group_child_serializer_spec.rb +++ b/spec/serializers/group_child_serializer_spec.rb @@ -27,7 +27,7 @@ describe GroupChildSerializer do subgroup = create(:group, parent: parent) subsub_group = create(:group, parent: subgroup) - json = serializer.represent(subsub_group) + json = serializer.represent([subgroup, subsub_group]).first subsub_group_json = json[:children].first expect(json[:id]).to eq(subgroup.id) @@ -41,7 +41,7 @@ describe GroupChildSerializer do subgroup2 = create(:group, parent: parent) subsub_group2 = create(:group, parent: subgroup2) - json = serializer.represent([subsub_group1, subsub_group2]) + json = serializer.represent([subgroup1, subsub_group1, subgroup1, subgroup2]) subgroup1_json = json.first subsub_group1_json = subgroup1_json[:children].first @@ -58,7 +58,7 @@ describe GroupChildSerializer do it 'can render a tree' do subgroup = create(:group, parent: parent) - json = serializer.represent([subgroup]) + json = serializer.represent([parent, subgroup]) parent_json = json.first expect(parent_json[:id]).to eq(parent.id) @@ -89,7 +89,7 @@ describe GroupChildSerializer do subgroup2 = create(:group, parent: parent) project2 = create(:project, namespace: subgroup2) - json = serializer.represent([project1, project2]) + json = serializer.represent([project1, project2, subgroup1, subgroup2]) project1_json, project2_json = json.map { |group_json| group_json[:children].first } expect(json.size).to eq(2) |