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>2020-02-07 00:08:48 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-07 00:08:48 +0300
commita89cb5cbdd832d4d9e80517973aceda6bc0a3856 (patch)
tree574475bd0901a2f8906d36a4728b8bbb95b41e1c /spec/services/git
parent0d6fa033121a9bef708b8f2de186c4034c61d4a3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/git')
-rw-r--r--spec/services/git/branch_push_service_spec.rb21
1 files changed, 18 insertions, 3 deletions
diff --git a/spec/services/git/branch_push_service_spec.rb b/spec/services/git/branch_push_service_spec.rb
index c64b93a2532..8b4f45010ed 100644
--- a/spec/services/git/branch_push_service_spec.rb
+++ b/spec/services/git/branch_push_service_spec.rb
@@ -12,6 +12,7 @@ describe Git::BranchPushService, services: true do
let(:newrev) { sample_commit.id }
let(:branch) { 'master' }
let(:ref) { "refs/heads/#{branch}" }
+ let(:push_options) { nil }
before do
project.add_maintainer(user)
@@ -19,7 +20,7 @@ describe Git::BranchPushService, services: true do
describe 'Push branches' do
subject do
- execute_service(project, user, oldrev: oldrev, newrev: newrev, ref: ref)
+ execute_service(project, user, oldrev: oldrev, newrev: newrev, ref: ref, push_options: push_options)
end
context 'new branch' do
@@ -113,6 +114,20 @@ describe Git::BranchPushService, services: true do
expect { subject }.not_to change { Ci::Pipeline.count }
end
+
+ context 'with push options' do
+ let(:push_options) { ['mr.create'] }
+
+ it 'sanitizes push options' do
+ allow(Gitlab::Runtime).to receive(:sidekiq?).and_return(true)
+ expect(Sidekiq.logger).to receive(:warn) do |args|
+ pipeline_params = args[:pipeline_params]
+ expect(pipeline_params.keys).to match_array(%i(before after ref variables_attributes checkout_sha))
+ end
+
+ expect { subject }.not_to change { Ci::Pipeline.count }
+ end
+ end
end
end
@@ -637,8 +652,8 @@ describe Git::BranchPushService, services: true do
end
end
- def execute_service(project, user, change)
- service = described_class.new(project, user, change: change)
+ def execute_service(project, user, change, push_options = {})
+ service = described_class.new(project, user, change: change, push_options: push_options)
service.execute
service
end