summaryrefslogtreecommitdiff
path: root/spec/controllers/projects/branches_controller_spec.rb
diff options
context:
space:
mode:
authorGeorge Andrinopoulos <geoandri@gmail.com>2017-03-05 21:45:19 +0200
committerGeorge Andrinopoulos <geoandri@gmail.com>2017-03-06 11:48:40 +0200
commit905a2993e93c99c85b8b41d4959494c798262ed5 (patch)
treeb21bec0f6418f881a7412d9dd25f916caa183559 /spec/controllers/projects/branches_controller_spec.rb
parenta69aa3dad51d5e881b3c92f3ac09c689edc00ab3 (diff)
downloadgitlab-ce-905a2993e93c99c85b8b41d4959494c798262ed5.tar.gz
Fix json response in branches controller
Diffstat (limited to 'spec/controllers/projects/branches_controller_spec.rb')
-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