diff options
| author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-13 15:13:52 +0200 |
|---|---|---|
| committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-13 15:15:45 +0200 |
| commit | 4d79159973d7b51230ceb9efd33bb1cbb191621b (patch) | |
| tree | 2e8d8b8d9a57e63ed1cbe43e348224aa611b610e /spec/controllers/groups | |
| parent | a1bfdf76f25c273fa7e4a694d4934e7f4585d8d7 (diff) | |
| download | gitlab-ce-4d79159973d7b51230ceb9efd33bb1cbb191621b.tar.gz | |
Make sure we always return an array of hierarchies
Even when we pass an array of only a single object
Diffstat (limited to 'spec/controllers/groups')
| -rw-r--r-- | spec/controllers/groups/children_controller_spec.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/controllers/groups/children_controller_spec.rb b/spec/controllers/groups/children_controller_spec.rb index f15a12ef7fd..4262d474e59 100644 --- a/spec/controllers/groups/children_controller_spec.rb +++ b/spec/controllers/groups/children_controller_spec.rb @@ -141,6 +141,15 @@ describe Groups::ChildrenController do expect(response).to have_http_status(200) end + it 'returns an array with one element when only one result is matched' do + create(:project, :public, namespace: group, name: 'match') + + get :index, group_id: group.to_param, filter: 'match', format: :json + + expect(json_response).to be_kind_of(Array) + expect(json_response.size).to eq(1) + end + it 'returns an empty array when there are no search results' do subgroup = create(:group, :public, parent: group) l2_subgroup = create(:group, :public, parent: subgroup) |
