diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-30 18:08:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-30 18:08:07 +0000 |
commit | 2c72daf2f1744f2b8c8c6674c266907e9ef55558 (patch) | |
tree | e489b6e87557d3f6d8a94f2e7d4d47e633d646b5 /spec/factories | |
parent | 4e9acbfba3682c552b3de707c535e6257ef41054 (diff) | |
download | gitlab-ce-2c72daf2f1744f2b8c8c6674c266907e9ef55558.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/factories')
-rw-r--r-- | spec/factories/ci/pipelines.rb | 24 | ||||
-rw-r--r-- | spec/factories/merge_requests.rb | 22 |
2 files changed, 29 insertions, 17 deletions
diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb index 11686ed5277..f2c342f76d0 100644 --- a/spec/factories/ci/pipelines.rb +++ b/spec/factories/ci/pipelines.rb @@ -99,6 +99,30 @@ FactoryBot.define do trait :repository_source do config_source { Ci::Pipeline.config_sources[:repository_source] } end + + trait :detached_merge_request_pipeline do + merge_request + + source { :merge_request_event } + project { merge_request.source_project } + sha { merge_request.source_branch_sha } + ref { merge_request.ref_path } + end + + trait :legacy_detached_merge_request_pipeline do + detached_merge_request_pipeline + + ref { merge_request.source_branch } + end + + trait :merged_result_pipeline do + detached_merge_request_pipeline + + sha { 'test-merge-sha'} + ref { merge_request.merge_ref_path } + source_sha { merge_request.source_branch_sha } + target_sha { merge_request.target_branch_sha } + end end end end diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb index f717bab5f2a..08a8ede61b1 100644 --- a/spec/factories/merge_requests.rb +++ b/spec/factories/merge_requests.rb @@ -147,23 +147,13 @@ FactoryBot.define do trait :with_legacy_detached_merge_request_pipeline do after(:create) do |merge_request| - merge_request.pipelines_for_merge_request << create(:ci_pipeline, - source: :merge_request_event, - merge_request: merge_request, - project: merge_request.source_project, - ref: merge_request.source_branch, - sha: merge_request.source_branch_sha) + create(:ci_pipeline, :legacy_detached_merge_request_pipeline, merge_request: merge_request) end end trait :with_detached_merge_request_pipeline do after(:create) do |merge_request| - merge_request.pipelines_for_merge_request << create(:ci_pipeline, - source: :merge_request_event, - merge_request: merge_request, - project: merge_request.source_project, - ref: merge_request.ref_path, - sha: merge_request.source_branch_sha) + create(:ci_pipeline, :detached_merge_request_pipeline, merge_request: merge_request) end end @@ -175,14 +165,12 @@ FactoryBot.define do end after(:create) do |merge_request, evaluator| - merge_request.pipelines_for_merge_request << create(:ci_pipeline, - source: :merge_request_event, + create(:ci_pipeline, :merged_result_pipeline, merge_request: merge_request, - project: merge_request.source_project, - ref: merge_request.merge_ref_path, sha: evaluator.merge_sha, source_sha: evaluator.source_sha, - target_sha: evaluator.target_sha) + target_sha: evaluator.target_sha + ) end end |