summaryrefslogtreecommitdiff
path: root/spec/serializers
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-09-12 14:58:44 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-04 22:49:41 +0200
commit3e6dd7d88daaac2dbafc234753942086e0ba0403 (patch)
treee80888fc0580c78e71db4b0b57c4b088c9c64d0c /spec/serializers
parent960559aa6889a0b5ac1d46b84b7f7977a57d50ca (diff)
downloadgitlab-ce-3e6dd7d88daaac2dbafc234753942086e0ba0403.tar.gz
Use same response-body in groups-dashboard as we do for group-home
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/group_child_serializer_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/serializers/group_child_serializer_spec.rb b/spec/serializers/group_child_serializer_spec.rb
index 7a87c1adc8f..e5896f54dd7 100644
--- a/spec/serializers/group_child_serializer_spec.rb
+++ b/spec/serializers/group_child_serializer_spec.rb
@@ -49,6 +49,22 @@ describe GroupChildSerializer do
expect(subgroup1_json[:id]).to eq(subgroup1.id)
expect(subsub_group1_json[:id]).to eq(subsub_group1.id)
end
+
+ context 'without a specified parent' do
+ subject(:serializer) do
+ described_class.new(current_user: user).expand_hierarchy
+ end
+
+ it 'can render a tree' do
+ subgroup = create(:group, parent: parent)
+
+ json = serializer.represent([subgroup])
+ parent_json = json.first
+
+ expect(parent_json[:id]).to eq(parent.id)
+ expect(parent_json[:children].first[:id]).to eq(subgroup.id)
+ end
+ end
end
context 'for projects' do