diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
commit | be834a25982746ffd85252ff502df42bb88cb9d5 (patch) | |
tree | b4d6a8ba0931e12fac08f05abea33a3b8ec2c8a2 /qa/spec/git/repository_spec.rb | |
parent | ee925a3597f27e92f83a50937a64068109675b3d (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc32
Diffstat (limited to 'qa/spec/git/repository_spec.rb')
-rw-r--r-- | qa/spec/git/repository_spec.rb | 62 |
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 |