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:
Diffstat (limited to 'qa/spec/git/repository_spec.rb')
-rw-r--r--qa/spec/git/repository_spec.rb62
1 files changed, 61 insertions, 1 deletions
diff --git a/qa/spec/git/repository_spec.rb b/qa/spec/git/repository_spec.rb
index 8355c77f493..2ac7a99d82f 100644
--- a/qa/spec/git/repository_spec.rb
+++ b/qa/spec/git/repository_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Git::Repository do
+RSpec.describe QA::Git::Repository do
include Helpers::StubENV
shared_context 'unresolvable git directory' do
@@ -117,6 +117,66 @@ describe QA::Git::Repository do
let(:call_method) { repository.push_changes(branch) }
end
end
+
+ context 'with push options' do
+ let(:command) { "git push #{push_options} #{repo_uri_with_credentials} #{branch}" }
+
+ context 'when set to create a merge request' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.create' }
+ let(:call_method) { repository.push_changes(push_options: { create: true }) }
+ end
+ end
+
+ context 'when set to merge when pipeline succeeds' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.merge_when_pipeline_succeeds' }
+ let(:call_method) { repository.push_changes(push_options: { merge_when_pipeline_succeeds: true }) }
+ end
+ end
+
+ context 'when set to remove source branch' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.remove_source_branch' }
+ let(:call_method) { repository.push_changes(push_options: { remove_source_branch: true }) }
+ end
+ end
+
+ context 'when title is given' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.title="Is A Title"' }
+ let(:call_method) { repository.push_changes(push_options: { title: 'Is A Title' }) }
+ end
+ end
+
+ context 'when description is given' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.description="Is A Description"' }
+ let(:call_method) { repository.push_changes(push_options: { description: 'Is A Description' }) }
+ end
+ end
+
+ context 'when target branch is given' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.target="is-a-target-branch"' }
+ let(:call_method) { repository.push_changes(push_options: { target: 'is-a-target-branch' }) }
+ end
+ end
+
+ context 'when a label is given' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.label="is-a-label"' }
+ let(:call_method) { repository.push_changes(push_options: { label: ['is-a-label'] }) }
+ end
+ end
+
+ context 'when two labels are given' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.label="is-a-label" -o merge_request.label="is-another-label"' }
+ let(:call_method) { repository.push_changes(push_options: { label: %w[is-a-label is-another-label] }) }
+ end
+ end
+ end
end
describe '#git_protocol=' do