diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-30 14:02:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-30 14:02:35 +0300 |
commit | 434a0ce52d75e13d48eac9ce83774954c7c5d48d (patch) | |
tree | de3b7a7cf1ce8b07555f28df592297c76894c90f /spec/factories | |
parent | 0a0d9493ca481c56b739a3df27c31262283150fe (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc2
Diffstat (limited to 'spec/factories')
-rw-r--r-- | spec/factories/ci/builds.rb | 6 | ||||
-rw-r--r-- | spec/factories/ci/job_artifacts.rb | 12 | ||||
-rw-r--r-- | spec/factories/ci/pipelines.rb | 8 | ||||
-rw-r--r-- | spec/factories/exported_protected_branches.rb | 5 | ||||
-rw-r--r-- | spec/factories/issues.rb | 4 | ||||
-rw-r--r-- | spec/factories/merge_requests.rb | 2 | ||||
-rw-r--r-- | spec/factories/packages/package_file.rb | 8 | ||||
-rw-r--r-- | spec/factories/project_settings.rb | 7 | ||||
-rw-r--r-- | spec/factories/sent_notifications.rb | 2 | ||||
-rw-r--r-- | spec/factories/terraform/state.rb | 8 | ||||
-rw-r--r-- | spec/factories/users.rb | 4 |
11 files changed, 43 insertions, 23 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index 11719e40cf2..c3d6e9d7569 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -356,6 +356,12 @@ FactoryBot.define do end end + trait :codequality_reports do + after(:build) do |build| + build.job_artifacts << create(:ci_job_artifact, :codequality, job: build) + end + end + trait :terraform_reports do after(:build) do |build| build.job_artifacts << create(:ci_job_artifact, :terraform, job: build) diff --git a/spec/factories/ci/job_artifacts.rb b/spec/factories/ci/job_artifacts.rb index 223184891b7..0f5ad013a64 100644 --- a/spec/factories/ci/job_artifacts.rb +++ b/spec/factories/ci/job_artifacts.rb @@ -245,7 +245,17 @@ FactoryBot.define do after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( - Rails.root.join('spec/fixtures/codequality/codequality.json'), 'application/json') + Rails.root.join('spec/fixtures/codequality/codeclimate.json'), 'application/json') + end + end + + trait :codequality_without_errors do + file_type { :codequality } + file_format { :raw } + + after(:build) do |artifact, evaluator| + artifact.file = fixture_file_upload( + Rails.root.join('spec/fixtures/codequality/codeclimate_without_errors.json'), 'application/json') end end diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb index 14bd0ab1bc6..ea22fba37c9 100644 --- a/spec/factories/ci/pipelines.rb +++ b/spec/factories/ci/pipelines.rb @@ -145,6 +145,14 @@ FactoryBot.define do end end + trait :with_codequality_reports do + status { :success } + + after(:build) do |pipeline, evaluator| + pipeline.builds << build(:ci_build, :codequality_reports, pipeline: pipeline, project: pipeline.project) + end + end + trait :with_coverage_report_artifact do after(:build) do |pipeline, evaluator| pipeline.pipeline_artifacts << build(:ci_pipeline_artifact, pipeline: pipeline, project: pipeline.project) diff --git a/spec/factories/exported_protected_branches.rb b/spec/factories/exported_protected_branches.rb new file mode 100644 index 00000000000..7ad49b12e5b --- /dev/null +++ b/spec/factories/exported_protected_branches.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :exported_protected_branch, class: 'ExportedProtectedBranch', parent: :protected_branch +end diff --git a/spec/factories/issues.rb b/spec/factories/issues.rb index 90e43b9e22c..5c62de4d08d 100644 --- a/spec/factories/issues.rb +++ b/spec/factories/issues.rb @@ -52,9 +52,5 @@ FactoryBot.define do factory :incident do issue_type { :incident } end - - factory :quality_test_case do - issue_type { :test_case } - end end end diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb index e5381071228..998d93420d1 100644 --- a/spec/factories/merge_requests.rb +++ b/spec/factories/merge_requests.rb @@ -237,7 +237,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| diff --git a/spec/factories/packages/package_file.rb b/spec/factories/packages/package_file.rb index 643ab8e4f95..bee1b2076df 100644 --- a/spec/factories/packages/package_file.rb +++ b/spec/factories/packages/package_file.rb @@ -152,14 +152,6 @@ FactoryBot.define do file_store { Packages::PackageFileUploader::Store::REMOTE } end - trait(:checksummed) do - verification_checksum { 'abc' } - end - - trait(:checksum_failure) do - verification_failure { 'Could not calculate the checksum' } - end - factory :package_file_with_file, traits: [:jar] end end diff --git a/spec/factories/project_settings.rb b/spec/factories/project_settings.rb new file mode 100644 index 00000000000..c0c5039ab51 --- /dev/null +++ b/spec/factories/project_settings.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :project_setting do + project + end +end diff --git a/spec/factories/sent_notifications.rb b/spec/factories/sent_notifications.rb index 11116af7dbb..f10a3235202 100644 --- a/spec/factories/sent_notifications.rb +++ b/spec/factories/sent_notifications.rb @@ -4,7 +4,7 @@ FactoryBot.define do factory :sent_notification do project recipient { project.creator } - noteable { create(:issue, project: project) } + noteable { association(:issue, project: project) } reply_key { SentNotification.reply_key } end end diff --git a/spec/factories/terraform/state.rb b/spec/factories/terraform/state.rb index c54a8aedbc6..fb63c845073 100644 --- a/spec/factories/terraform/state.rb +++ b/spec/factories/terraform/state.rb @@ -6,11 +6,6 @@ FactoryBot.define do sequence(:name) { |n| "state-#{n}" } - trait :with_file do - versioning_enabled { false } - file { fixture_file_upload('spec/fixtures/terraform/terraform.tfstate', 'application/json') } - end - trait :locked do sequence(:lock_xid) { |n| "lock-#{n}" } locked_at { Time.current } @@ -22,8 +17,5 @@ FactoryBot.define do create(:terraform_state_version, terraform_state: state) end end - - # Remove with https://gitlab.com/gitlab-org/gitlab/-/issues/235108 - factory :legacy_terraform_state, parent: :terraform_state, traits: [:with_file] end end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 1b430009ab5..50656d14eb7 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -35,6 +35,10 @@ FactoryBot.define do user_type { :alert_bot } end + trait :deactivated do + after(:build) { |user, _| user.deactivate! } + end + trait :project_bot do user_type { :project_bot } end |