diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2018-01-09 11:36:12 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-01-09 11:36:12 +0000 |
commit | f6c1d382591fd837e96e99ff115b7beb0e6b3f43 (patch) | |
tree | 664cec51e2cf931af4cc2efc1ef098857cefcd99 /spec/requests/api/v3 | |
parent | 4eae806af4874d5d2540a78f51fcbf72b9f69287 (diff) | |
download | gitlab-ce-f6c1d382591fd837e96e99ff115b7beb0e6b3f43.tar.gz |
Add option to disable commit stats to commit API
Diffstat (limited to 'spec/requests/api/v3')
-rw-r--r-- | spec/requests/api/v3/commits_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/requests/api/v3/commits_spec.rb b/spec/requests/api/v3/commits_spec.rb index 8b115e01f47..34c543bffe8 100644 --- a/spec/requests/api/v3/commits_spec.rb +++ b/spec/requests/api/v3/commits_spec.rb @@ -403,6 +403,33 @@ describe API::V3::Commits do expect(response).to have_gitlab_http_status(200) expect(json_response['status']).to eq("created") end + + context 'when stat param' do + let(:project_id) { project.id } + let(:commit_id) { project.repository.commit.id } + let(:route) { "/projects/#{project_id}/repository/commits/#{commit_id}" } + + it 'is not present return stats by default' do + get v3_api(route, user) + + expect(response).to have_gitlab_http_status(200) + expect(json_response).to include 'stats' + end + + it "is false it does not include stats" do + get v3_api(route, user), stats: false + + expect(response).to have_gitlab_http_status(200) + expect(json_response).not_to include 'stats' + end + + it "is true it includes stats" do + get v3_api(route, user), stats: true + + expect(response).to have_gitlab_http_status(200) + expect(json_response).to include 'stats' + end + end end context "unauthorized user" do |