Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-17 15:13:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-17 15:13:49 +0300
commit458b945df3652f3f42f3665ea2e39e745c8b05c6 (patch)
tree355810a602413a558e1f8edf19a17f14e604e062 /spec/requests
parente750680e89a6f98803709c172943962741eeb9e7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/commits_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb
index edf072e617d..68fe45cd026 100644
--- a/spec/requests/api/commits_spec.rb
+++ b/spec/requests/api/commits_spec.rb
@@ -979,6 +979,40 @@ RSpec.describe API::Commits do
end
end
+ context 'when action is missing' do
+ let(:params) do
+ {
+ branch: 'master',
+ commit_message: 'Invalid',
+ actions: [{ action: nil, file_path: 'files/ruby/popen.rb' }]
+ }
+ end
+
+ it 'responds with 400 bad request' do
+ post api(url, user), params: params
+
+ expect(response).to have_gitlab_http_status(:bad_request)
+ expect(json_response['error']).to eq('actions[0][action] is empty')
+ end
+ end
+
+ context 'when action is not supported' do
+ let(:params) do
+ {
+ branch: 'master',
+ commit_message: 'Invalid',
+ actions: [{ action: 'unknown', file_path: 'files/ruby/popen.rb' }]
+ }
+ end
+
+ it 'responds with 400 bad request' do
+ post api(url, user), params: params
+
+ expect(response).to have_gitlab_http_status(:bad_request)
+ expect(json_response['error']).to eq('actions[0][action] does not have a valid value')
+ end
+ end
+
context 'when committing into a fork as a maintainer' do
include_context 'merge request allowing collaboration'