diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2019-06-18 17:20:11 +0300 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2019-06-28 16:22:35 +0300 |
commit | ca5cd7b7fb5108d30d0f6b74e31da736024592dd (patch) | |
tree | aec9468afa579b128b7e09f6e78e7357d6413b85 /spec/controllers/projects | |
parent | 546355f734f74c040d0ef0917ade50751fd90731 (diff) | |
download | gitlab-ce-ca5cd7b7fb5108d30d0f6b74e31da736024592dd.tar.gz |
Add endpoint for fetching diverging commit countsid-stale-branches
Extract diverging_commit_counts into a service class
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r-- | spec/controllers/projects/branches_controller_spec.rb | 23 |
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 cf201c9f735..287ea9f425d 100644 --- a/spec/controllers/projects/branches_controller_spec.rb +++ b/spec/controllers/projects/branches_controller_spec.rb @@ -507,4 +507,27 @@ describe Projects::BranchesController do end end end + + describe 'GET diverging_commit_counts' do + before do + sign_in(user) + + get :diverging_commit_counts, + format: :json, + params: { + namespace_id: project.namespace, + project_id: project, + names: ['fix', 'add-pdf-file', 'branch-merged'] + } + end + + it 'returns the commit counts behind and ahead of default branch' do + parsed_response = JSON.parse(response.body) + expect(parsed_response).to eq( + "fix" => { "behind" => 29, "ahead" => 2 }, + "branch-merged" => { "behind" => 1, "ahead" => 0 }, + "add-pdf-file" => { "behind" => 0, "ahead" => 3 } + ) + end + end end |