summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-03-06 11:14:13 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-03-06 11:14:13 +0000
commitae8a066597a38036feade1452243ff2b81117a4a (patch)
treecb17a95e17f9d96b77354b5796e242301e37d282 /spec/controllers
parent633aaf2b6123359e4c7bfce441022a68b2f21222 (diff)
parent905a2993e93c99c85b8b41d4959494c798262ed5 (diff)
downloadgitlab-ce-ae8a066597a38036feade1452243ff2b81117a4a.tar.gz
Merge branch '28898-fix-search-branches-in-cherry-picking' into 'master'
Fix json response in branches controller Closes #28898 See merge request !9710
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/branches_controller_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/controllers/projects/branches_controller_spec.rb b/spec/controllers/projects/branches_controller_spec.rb
index e70737376af..298a7ff179c 100644
--- a/spec/controllers/projects/branches_controller_spec.rb
+++ b/spec/controllers/projects/branches_controller_spec.rb
@@ -244,4 +244,27 @@ describe Projects::BranchesController do
end
end
end
+
+ describe "GET index" do
+ render_views
+
+ before do
+ sign_in(user)
+ end
+
+ context 'when rendering a JSON format' do
+ it 'filters branches by name' do
+ get :index,
+ namespace_id: project.namespace,
+ project_id: project,
+ format: :json,
+ search: 'master'
+
+ parsed_response = JSON.parse(response.body)
+
+ expect(parsed_response.length).to eq 1
+ expect(parsed_response.first).to eq 'master'
+ end
+ end
+ end
end