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-13 16:13:52 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-13 16:15:45 +0300
commit4d79159973d7b51230ceb9efd33bb1cbb191621b (patch)
tree2e8d8b8d9a57e63ed1cbe43e348224aa611b610e /spec/serializers
parenta1bfdf76f25c273fa7e4a694d4934e7f4585d8d7 (diff)
Make sure we always return an array of hierarchies
Even when we pass an array of only a single object
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/group_child_serializer_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/serializers/group_child_serializer_spec.rb b/spec/serializers/group_child_serializer_spec.rb
index 566b235769e..5541ada3750 100644
--- a/spec/serializers/group_child_serializer_spec.rb
+++ b/spec/serializers/group_child_serializer_spec.rb
@@ -95,6 +95,15 @@ describe GroupChildSerializer do
expect(project1_json[:id]).to eq(project1.id)
expect(project2_json[:id]).to eq(project2.id)
end
+
+ it 'returns an array when an array of a single instance was given' do
+ project = create(:project, namespace: parent)
+
+ json = serializer.represent([project])
+
+ expect(json).to be_kind_of(Array)
+ expect(json.size).to eq(1)
+ end
end
end
end