diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/factories/merge_requests.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/factories/merge_requests.rb')
-rw-r--r-- | spec/factories/merge_requests.rb | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb index e5381071228..e69743122cc 100644 --- a/spec/factories/merge_requests.rb +++ b/spec/factories/merge_requests.rb @@ -24,6 +24,14 @@ FactoryBot.define do trait :with_diffs do end + trait :jira_title do + title { generate(:jira_title) } + end + + trait :jira_branch do + source_branch { generate(:jira_branch) } + end + trait :with_image_diffs do source_branch { "add_images_and_changes" } target_branch { "master" } @@ -52,7 +60,7 @@ FactoryBot.define do after(:build) do |merge_request, evaluator| metrics = merge_request.build_metrics - metrics.merged_at = 1.week.ago + metrics.merged_at = 1.week.from_now metrics.merged_by = evaluator.merged_by metrics.pipeline = create(:ci_empty_pipeline) end @@ -159,6 +167,18 @@ FactoryBot.define do end end + trait :with_codequality_reports do + after(:build) do |merge_request| + merge_request.head_pipeline = build( + :ci_pipeline, + :success, + :with_codequality_reports, + project: merge_request.source_project, + ref: merge_request.source_branch, + sha: merge_request.diff_head_sha) + end + end + trait :unique_branches do source_branch { generate(:branch) } target_branch { generate(:branch) } @@ -237,7 +257,7 @@ FactoryBot.define do target_branch { 'pages-deploy-target' } transient do - deployment { create(:deployment, :review_app) } + deployment { association(:deployment, :review_app) } end after(:build) do |merge_request, evaluator| @@ -256,7 +276,7 @@ FactoryBot.define do source_project = merge_request.source_project # Fake `fetch_ref!` if we don't have repository - # We have too many existing tests replying on this behaviour + # We have too many existing tests relying on this behaviour unless [target_project, source_project].all?(&:repository_exists?) allow(merge_request).to receive(:fetch_ref!) end |