diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/controllers/projects/commit_controller_spec.rb | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) | |
download | gitlab-ce-3cccd102ba543e02725d247893729e5c73b38295.tar.gz |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/controllers/projects/commit_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/commit_controller_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/controllers/projects/commit_controller_spec.rb b/spec/controllers/projects/commit_controller_spec.rb index 72fee40a6e9..a72c98552a5 100644 --- a/spec/controllers/projects/commit_controller_spec.rb +++ b/spec/controllers/projects/commit_controller_spec.rb @@ -60,6 +60,22 @@ RSpec.describe Projects::CommitController do end end + context 'with valid page' do + it 'responds with 200' do + go(id: commit.id, page: 1) + + expect(response).to be_ok + end + end + + context 'with invalid page' do + it 'does not return an error' do + go(id: commit.id, page: ['invalid']) + + expect(response).to be_ok + end + end + it 'handles binary files' do go(id: TestEnv::BRANCH_SHA['binary-encoding'], format: 'html') @@ -212,6 +228,21 @@ RSpec.describe Projects::CommitController do end end + context 'when the revert commit is missing' do + it 'renders the 404 page' do + post(:revert, + params: { + namespace_id: project.namespace, + project_id: project, + start_branch: 'master', + id: '1234567890' + }) + + expect(response).not_to be_successful + expect(response).to have_gitlab_http_status(:not_found) + end + end + context 'when the revert was successful' do it 'redirects to the commits page' do post(:revert, @@ -269,6 +300,21 @@ RSpec.describe Projects::CommitController do end end + context 'when the cherry-pick commit is missing' do + it 'renders the 404 page' do + post(:cherry_pick, + params: { + namespace_id: project.namespace, + project_id: project, + start_branch: 'master', + id: '1234567890' + }) + + expect(response).not_to be_successful + expect(response).to have_gitlab_http_status(:not_found) + end + end + context 'when the cherry-pick was successful' do it 'redirects to the commits page' do post(:cherry_pick, |