Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-10-04 17:57:33 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-05 12:10:57 +0300
commit57bd3bb34a19bf812fd6a74f394a69c491b05dd0 (patch)
tree1407f3824a3d0b22bd64fefdfd8a2b4e6ee2c8f2 /spec/serializers
parent06e00913f505268e0a45f4f1516a93a84600c242 (diff)
Force parents to be preloaded for building a hierarchy
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/group_child_serializer_spec.rb8
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)