diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 09:55:51 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 09:55:51 +0000 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /spec/controllers/projects/commit_controller_spec.rb | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) | |
download | gitlab-ce-e8d2c2579383897a1dd7f9debd359abe8ae8373d.tar.gz |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'spec/controllers/projects/commit_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/commit_controller_spec.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/controllers/projects/commit_controller_spec.rb b/spec/controllers/projects/commit_controller_spec.rb index c650d145bef..16bb33e95c8 100644 --- a/spec/controllers/projects/commit_controller_spec.rb +++ b/spec/controllers/projects/commit_controller_spec.rb @@ -483,7 +483,7 @@ RSpec.describe Projects::CommitController do end context 'when rendering a JSON format' do - it 'responds with serialized pipelines' do + it 'responds with serialized pipelines', :aggregate_failures do get_pipelines(id: commit.id, format: :json) expect(response).to be_ok @@ -491,6 +491,26 @@ RSpec.describe Projects::CommitController do expect(json_response['count']['all']).to eq 1 expect(response).to include_pagination_headers end + + context 'with pagination' do + let!(:extra_pipeline) { create(:ci_pipeline, project: project, ref: project.default_branch, sha: commit.sha, status: :running) } + + it 'paginates the result when ref is blank' do + allow(Ci::Pipeline).to receive(:default_per_page).and_return(1) + + get_pipelines(id: commit.id, format: :json) + + expect(json_response['pipelines'].count).to eq(1) + end + + it 'paginates the result when ref is present' do + allow(Ci::Pipeline).to receive(:default_per_page).and_return(1) + + get_pipelines(id: commit.id, ref: project.default_branch, format: :json) + + expect(json_response['pipelines'].count).to eq(1) + end + end end end end |