summaryrefslogtreecommitdiff
path: root/spec/controllers/projects/merge_requests_controller_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-21 18:15:17 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-21 18:15:17 +0000
commit248492cc573e85aea19d7493c3a15d459be016c5 (patch)
treec25388f4af2e9a87e06121318982001b964e7573 /spec/controllers/projects/merge_requests_controller_spec.rb
parent97a128c1d1bf45bcc00d5fae037f840eff1ae4e0 (diff)
downloadgitlab-ce-248492cc573e85aea19d7493c3a15d459be016c5.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/projects/merge_requests_controller_spec.rb')
-rw-r--r--spec/controllers/projects/merge_requests_controller_spec.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb
index 9e18089bb23..fd77d07705d 100644
--- a/spec/controllers/projects/merge_requests_controller_spec.rb
+++ b/spec/controllers/projects/merge_requests_controller_spec.rb
@@ -575,6 +575,16 @@ RSpec.describe Projects::MergeRequestsController, feature_category: :code_review
it 'returns :failed' do
expect(json_response).to eq('status' => 'failed')
end
+
+ context 'for logging' do
+ let(:expected_params) { { merge_action_status: 'failed' } }
+ let(:subject_proc) { proc { subject } }
+
+ subject { post :merge, params: base_params }
+
+ it_behaves_like 'storing arguments in the application context'
+ it_behaves_like 'not executing any extra queries for the application context'
+ end
end
context 'when the sha parameter does not match the source SHA' do
@@ -585,6 +595,16 @@ RSpec.describe Projects::MergeRequestsController, feature_category: :code_review
it 'returns :sha_mismatch' do
expect(json_response).to eq('status' => 'sha_mismatch')
end
+
+ context 'for logging' do
+ let(:expected_params) { { merge_action_status: 'sha_mismatch' } }
+ let(:subject_proc) { proc { subject } }
+
+ subject { post :merge, params: base_params.merge(sha: 'foo') }
+
+ it_behaves_like 'storing arguments in the application context'
+ it_behaves_like 'not executing any extra queries for the application context'
+ end
end
context 'when the sha parameter matches the source SHA' do
@@ -606,6 +626,16 @@ RSpec.describe Projects::MergeRequestsController, feature_category: :code_review
merge_with_sha
end
+ context 'for logging' do
+ let(:expected_params) { { merge_action_status: 'success' } }
+ let(:subject_proc) { proc { subject } }
+
+ subject { merge_with_sha }
+
+ it_behaves_like 'storing arguments in the application context'
+ it_behaves_like 'not executing any extra queries for the application context'
+ end
+
context 'when squash is passed as 1' do
it 'updates the squash attribute on the MR to true' do
merge_request.update!(squash: false)
@@ -673,6 +703,16 @@ RSpec.describe Projects::MergeRequestsController, feature_category: :code_review
merge_when_pipeline_succeeds
end
+ context 'for logging' do
+ let(:expected_params) { { merge_action_status: 'merge_when_pipeline_succeeds' } }
+ let(:subject_proc) { proc { subject } }
+
+ subject { merge_when_pipeline_succeeds }
+
+ it_behaves_like 'storing arguments in the application context'
+ it_behaves_like 'not executing any extra queries for the application context'
+ end
+
context 'when project.only_allow_merge_if_pipeline_succeeds? is true' do
before do
project.update_column(:only_allow_merge_if_pipeline_succeeds, true)