summaryrefslogtreecommitdiff
path: root/spec/controllers/projects/commit_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/projects/commit_controller_spec.rb')
-rw-r--r--spec/controllers/projects/commit_controller_spec.rb46
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,