Commit 29714d78 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'rc/rubocop-factorybot' into 'master'

Enable factorybot cop

See merge request gitlab-org/gitlab!22136
parents b55a4a72 2aebe31f
...@@ -301,12 +301,6 @@ RSpec/AnyInstanceOf: ...@@ -301,12 +301,6 @@ RSpec/AnyInstanceOf:
Enabled: false Enabled: false
# Cops for upgrade to gitlab-styles 3.1.0 # Cops for upgrade to gitlab-styles 3.1.0
FactoryBot/FactoryClassName:
Enabled: false
FactoryBot/CreateList:
Enabled: false
Rails/SafeNavigationWithBlank: Rails/SafeNavigationWithBlank:
Enabled: false Enabled: false
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :alerting_alert, class: Gitlab::Alerting::Alert do factory :alerting_alert, class: 'Gitlab::Alerting::Alert' do
project project
payload { {} } payload { {} }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :allowed_email_domain, class: AllowedEmailDomain do factory :allowed_email_domain, class: 'AllowedEmailDomain' do
domain { 'gitlab.com' } domain { 'gitlab.com' }
group group
end end
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :cycle_analytics_group_stage, class: Analytics::CycleAnalytics::GroupStage do factory :cycle_analytics_group_stage, class: 'Analytics::CycleAnalytics::GroupStage' do
sequence(:name) { |n| "Stage ##{n}" } sequence(:name) { |n| "Stage ##{n}" }
start_event_identifier { Gitlab::Analytics::CycleAnalytics::StageEvents::MergeRequestCreated.identifier } start_event_identifier { Gitlab::Analytics::CycleAnalytics::StageEvents::MergeRequestCreated.identifier }
end_event_identifier { Gitlab::Analytics::CycleAnalytics::StageEvents::MergeRequestMerged.identifier } end_event_identifier { Gitlab::Analytics::CycleAnalytics::StageEvents::MergeRequestMerged.identifier }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ee_ci_build, class: Ci::Build, parent: :ci_build do factory :ee_ci_build, class: 'Ci::Build', parent: :ci_build do
trait :protected_environment_failure do trait :protected_environment_failure do
failed failed
failure_reason { Ci::Build.failure_reasons[:protected_environment_failure] } failure_reason { Ci::Build.failure_reasons[:protected_environment_failure] }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ee_ci_job_artifact, class: ::Ci::JobArtifact, parent: :ci_job_artifact do factory :ee_ci_job_artifact, class: '::Ci::JobArtifact', parent: :ci_job_artifact do
trait :sast do trait :sast do
file_type { :sast } file_type { :sast }
file_format { :raw } file_format { :raw }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ee_ci_pipeline, class: Ci::Pipeline, parent: :ci_pipeline do factory :ee_ci_pipeline, class: 'Ci::Pipeline', parent: :ci_pipeline do
trait :webide do trait :webide do
source { :webide } source { :webide }
config_source { :webide_source } config_source { :webide_source }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :license_scanning_dependency, class: ::Gitlab::Ci::Reports::LicenseScanning::Dependency do factory :license_scanning_dependency, class: '::Gitlab::Ci::Reports::LicenseScanning::Dependency' do
initialize_with { new(name, path: path) } initialize_with { new(name, path: path) }
trait :rails do trait :rails do
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :license_scanning_license, class: ::Gitlab::Ci::Reports::LicenseScanning::License do factory :license_scanning_license, class: '::Gitlab::Ci::Reports::LicenseScanning::License' do
initialize_with { new(id: id, name: name, url: url) } initialize_with { new(id: id, name: name, url: url) }
trait :mit do trait :mit do
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_reports_license_scanning_report, class: ::Gitlab::Ci::Reports::LicenseScanning::Report, aliases: [:license_scan_report] do factory :ci_reports_license_scanning_report, class: '::Gitlab::Ci::Reports::LicenseScanning::Report', aliases: [:license_scan_report] do
trait :version_1 do trait :version_1 do
version { '1.0' } version { '1.0' }
end end
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_reports_metrics_report, class: ::Gitlab::Ci::Reports::Metrics::Report do factory :ci_reports_metrics_report, class: '::Gitlab::Ci::Reports::Metrics::Report' do
trait :base_metrics do trait :base_metrics do
after(:build) do |report, _| after(:build) do |report, _|
report.add_metric('metric_name', 'metric_value') report.add_metric('metric_name', 'metric_value')
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_reports_security_aggregated_reports, class: ::Gitlab::Ci::Reports::Security::AggregatedReport do factory :ci_reports_security_aggregated_reports, class: '::Gitlab::Ci::Reports::Security::AggregatedReport' do
reports { FactoryBot.build_list(:ci_reports_security_report, 1) } reports { FactoryBot.build_list(:ci_reports_security_report, 1) }
occurrences { FactoryBot.build_list(:ci_reports_security_occurrence, 1) } occurrences { FactoryBot.build_list(:ci_reports_security_occurrence, 1) }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_reports_security_identifier, class: ::Gitlab::Ci::Reports::Security::Identifier do factory :ci_reports_security_identifier, class: '::Gitlab::Ci::Reports::Security::Identifier' do
external_id { 'PREDICTABLE_RANDOM' } external_id { 'PREDICTABLE_RANDOM' }
external_type { 'find_sec_bugs_type' } external_type { 'find_sec_bugs_type' }
name { "#{external_type}-#{external_id}" } name { "#{external_type}-#{external_id}" }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_reports_security_locations_container_scanning, class: ::Gitlab::Ci::Reports::Security::Locations::ContainerScanning do factory :ci_reports_security_locations_container_scanning, class: '::Gitlab::Ci::Reports::Security::Locations::ContainerScanning' do
image { 'registry.gitlab.com/my/project:latest' } image { 'registry.gitlab.com/my/project:latest' }
operating_system { 'debian:9' } operating_system { 'debian:9' }
package_name { 'glibc' } package_name { 'glibc' }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_reports_security_locations_dast, class: ::Gitlab::Ci::Reports::Security::Locations::Dast do factory :ci_reports_security_locations_dast, class: '::Gitlab::Ci::Reports::Security::Locations::Dast' do
hostname { 'my-app.com' } hostname { 'my-app.com' }
method_name { 'GET' } method_name { 'GET' }
param { 'X-Content-Type-Options' } param { 'X-Content-Type-Options' }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_reports_security_locations_dependency_scanning, class: ::Gitlab::Ci::Reports::Security::Locations::DependencyScanning do factory :ci_reports_security_locations_dependency_scanning, class: '::Gitlab::Ci::Reports::Security::Locations::DependencyScanning' do
file_path { 'app/pom.xml' } file_path { 'app/pom.xml' }
package_name { 'io.netty/netty' } package_name { 'io.netty/netty' }
package_version { '1.2.3' } package_version { '1.2.3' }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_reports_security_locations_sast, class: ::Gitlab::Ci::Reports::Security::Locations::Sast do factory :ci_reports_security_locations_sast, class: '::Gitlab::Ci::Reports::Security::Locations::Sast' do
file_path { 'maven/src/main/java/com/gitlab/security_products/tests/App.java' } file_path { 'maven/src/main/java/com/gitlab/security_products/tests/App.java' }
start_line { 29 } start_line { 29 }
end_line { 31 } end_line { 31 }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_reports_security_occurrence, class: ::Gitlab::Ci::Reports::Security::Occurrence do factory :ci_reports_security_occurrence, class: '::Gitlab::Ci::Reports::Security::Occurrence' do
compare_key { "#{identifiers.first.external_type}:#{identifiers.first.external_id}:#{location.fingerprint}" } compare_key { "#{identifiers.first.external_type}:#{identifiers.first.external_id}:#{location.fingerprint}" }
confidence { :medium } confidence { :medium }
identifiers { Array.new(1) { FactoryBot.build(:ci_reports_security_identifier) } } identifiers { Array.new(1) { FactoryBot.build(:ci_reports_security_identifier) } }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_reports_security_report, class: ::Gitlab::Ci::Reports::Security::Report do factory :ci_reports_security_report, class: '::Gitlab::Ci::Reports::Security::Report' do
type { :sast } type { :sast }
commit_sha { Digest::SHA1.hexdigest(SecureRandom.hex) } commit_sha { Digest::SHA1.hexdigest(SecureRandom.hex) }
created_at { 2.weeks.ago } created_at { 2.weeks.ago }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_reports_security_scanner, class: ::Gitlab::Ci::Reports::Security::Scanner do factory :ci_reports_security_scanner, class: '::Gitlab::Ci::Reports::Security::Scanner' do
external_id { 'find_sec_bugs' } external_id { 'find_sec_bugs' }
name { 'Find Security Bugs' } name { 'Find Security Bugs' }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_subscriptions_project, class: Ci::Subscriptions::Project do factory :ci_subscriptions_project, class: 'Ci::Subscriptions::Project' do
downstream_project factory: :project downstream_project factory: :project
upstream_project factory: [:project, :public] upstream_project factory: [:project, :public]
end end
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :dependency, class: Hash do factory :dependency, class: 'Hash' do
sequence(:name) { |n| "library#{n}" } sequence(:name) { |n| "library#{n}" }
packager { 'Ruby (Bundler)' } packager { 'Ruby (Bundler)' }
version { '1.8.0' } version { '1.8.0' }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :dependency_proxy_blob, class: DependencyProxy::Blob do factory :dependency_proxy_blob, class: 'DependencyProxy::Blob' do
group group
file { fixture_file_upload('ee/spec/fixtures/dependency_proxy/a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4.gz') } file { fixture_file_upload('ee/spec/fixtures/dependency_proxy/a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4.gz') }
file_name { 'a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4.gz' } file_name { 'a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4.gz' }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :design_at_version, class: DesignManagement::DesignAtVersion do factory :design_at_version, class: 'DesignManagement::DesignAtVersion' do
skip_create # This is not an Active::Record model. skip_create # This is not an Active::Record model.
design { nil } design { nil }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :design, class: DesignManagement::Design do factory :design, class: 'DesignManagement::Design' do
issue { create(:issue) } issue { create(:issue) }
project { issue&.project || create(:project) } project { issue&.project || create(:project) }
sequence(:filename) { |n| "homescreen-#{n}.jpg" } sequence(:filename) { |n| "homescreen-#{n}.jpg" }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :design_version, class: DesignManagement::Version do factory :design_version, class: 'DesignManagement::Version' do
sequence(:sha) { |n| Digest::SHA1.hexdigest("commit-like-#{n}") } sequence(:sha) { |n| Digest::SHA1.hexdigest("commit-like-#{n}") }
issue { designs.first&.issue || create(:issue) } issue { designs.first&.issue || create(:issue) }
author { issue&.author || create(:user) } author { issue&.author || create(:user) }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :doorkeeper_access_grant, class: Doorkeeper::AccessGrant do factory :doorkeeper_access_grant, class: 'Doorkeeper::AccessGrant' do
sequence(:resource_owner_id) { |n| n } sequence(:resource_owner_id) { |n| n }
association :application, factory: :doorkeeper_application association :application, factory: :doorkeeper_application
redirect_uri { 'https://app.com/callback' } redirect_uri { 'https://app.com/callback' }
...@@ -9,7 +9,7 @@ FactoryBot.define do ...@@ -9,7 +9,7 @@ FactoryBot.define do
scopes { 'public write' } scopes { 'public write' }
end end
factory :doorkeeper_access_token, class: Doorkeeper::AccessToken do factory :doorkeeper_access_token, class: 'Doorkeeper::AccessToken' do
sequence(:resource_owner_id) { |n| n } sequence(:resource_owner_id) { |n| n }
association :application, factory: :doorkeeper_application association :application, factory: :doorkeeper_application
expires_in { 2.hours } expires_in { 2.hours }
...@@ -19,7 +19,7 @@ FactoryBot.define do ...@@ -19,7 +19,7 @@ FactoryBot.define do
end end
end end
factory :doorkeeper_application, class: Doorkeeper::Application do factory :doorkeeper_application, class: 'Doorkeeper::Application' do
sequence(:name) { |n| "Application #{n}" } sequence(:name) { |n| "Application #{n}" }
redirect_uri { 'https://app.com/callback' } redirect_uri { 'https://app.com/callback' }
end end
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :container_repository_registry, class: Geo::ContainerRepositoryRegistry do factory :container_repository_registry, class: 'Geo::ContainerRepositoryRegistry' do
container_repository container_repository
last_sync_failure { nil } last_sync_failure { nil }
last_synced_at { nil } last_synced_at { nil }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :geo_design_registry, class: Geo::DesignRegistry do factory :geo_design_registry, class: 'Geo::DesignRegistry' do
project project
last_sync_failure { nil } last_sync_failure { nil }
last_synced_at { nil } last_synced_at { nil }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :geo_event_log, class: Geo::EventLog do factory :geo_event_log, class: 'Geo::EventLog' do
trait :created_event do trait :created_event do
repository_created_event factory: :geo_repository_created_event repository_created_event factory: :geo_repository_created_event
end end
...@@ -55,7 +55,7 @@ FactoryBot.define do ...@@ -55,7 +55,7 @@ FactoryBot.define do
end end
end end
factory :geo_repository_created_event, class: Geo::RepositoryCreatedEvent do factory :geo_repository_created_event, class: 'Geo::RepositoryCreatedEvent' do
project project
repository_storage_name { project.repository_storage } repository_storage_name { project.repository_storage }
...@@ -64,7 +64,7 @@ FactoryBot.define do ...@@ -64,7 +64,7 @@ FactoryBot.define do
wiki_path { project.wiki.disk_path } wiki_path { project.wiki.disk_path }
end end
factory :geo_repository_updated_event, class: Geo::RepositoryUpdatedEvent do factory :geo_repository_updated_event, class: 'Geo::RepositoryUpdatedEvent' do
project project
source { Geo::RepositoryUpdatedEvent::REPOSITORY } source { Geo::RepositoryUpdatedEvent::REPOSITORY }
...@@ -72,7 +72,7 @@ FactoryBot.define do ...@@ -72,7 +72,7 @@ FactoryBot.define do
tags_affected { 0 } tags_affected { 0 }
end end
factory :geo_design_repository_updated_event, class: Geo::RepositoryUpdatedEvent do factory :geo_design_repository_updated_event, class: 'Geo::RepositoryUpdatedEvent' do
project project
source { Geo::RepositoryUpdatedEvent::DESIGN } source { Geo::RepositoryUpdatedEvent::DESIGN }
...@@ -80,7 +80,7 @@ FactoryBot.define do ...@@ -80,7 +80,7 @@ FactoryBot.define do
tags_affected { 0 } tags_affected { 0 }
end end
factory :geo_repository_deleted_event, class: Geo::RepositoryDeletedEvent do factory :geo_repository_deleted_event, class: 'Geo::RepositoryDeletedEvent' do
project project
repository_storage_name { project.repository_storage } repository_storage_name { project.repository_storage }
...@@ -88,11 +88,11 @@ FactoryBot.define do ...@@ -88,11 +88,11 @@ FactoryBot.define do
deleted_project_name { project.name } deleted_project_name { project.name }
end end
factory :geo_repositories_changed_event, class: Geo::RepositoriesChangedEvent do factory :geo_repositories_changed_event, class: 'Geo::RepositoriesChangedEvent' do
geo_node geo_node
end end
factory :geo_repository_renamed_event, class: Geo::RepositoryRenamedEvent do factory :geo_repository_renamed_event, class: 'Geo::RepositoryRenamedEvent' do
project { create(:project, :repository) } project { create(:project, :repository) }
repository_storage_name { project.repository_storage } repository_storage_name { project.repository_storage }
...@@ -104,7 +104,7 @@ FactoryBot.define do ...@@ -104,7 +104,7 @@ FactoryBot.define do
new_path { project.path + '_new' } new_path { project.path + '_new' }
end end
factory :geo_hashed_storage_migrated_event, class: Geo::HashedStorageMigratedEvent do factory :geo_hashed_storage_migrated_event, class: 'Geo::HashedStorageMigratedEvent' do
project { create(:project, :repository) } project { create(:project, :repository) }
repository_storage_name { project.repository_storage } repository_storage_name { project.repository_storage }
...@@ -115,14 +115,14 @@ FactoryBot.define do ...@@ -115,14 +115,14 @@ FactoryBot.define do
new_storage_version { Project::HASHED_STORAGE_FEATURES[:repository] } new_storage_version { Project::HASHED_STORAGE_FEATURES[:repository] }
end end
factory :geo_hashed_storage_attachments_event, class: Geo::HashedStorageAttachmentsEvent do factory :geo_hashed_storage_attachments_event, class: 'Geo::HashedStorageAttachmentsEvent' do
project { create(:project, :repository) } project { create(:project, :repository) }
old_attachments_path { Storage::LegacyProject.new(project).disk_path } old_attachments_path { Storage::LegacyProject.new(project).disk_path }
new_attachments_path { Storage::HashedProject.new(project).disk_path } new_attachments_path { Storage::HashedProject.new(project).disk_path }
end end
factory :geo_lfs_object_deleted_event, class: Geo::LfsObjectDeletedEvent do factory :geo_lfs_object_deleted_event, class: 'Geo::LfsObjectDeletedEvent' do
lfs_object { create(:lfs_object, :with_file) } lfs_object { create(:lfs_object, :with_file) }
after(:build, :stub) do |event, _| after(:build, :stub) do |event, _|
...@@ -134,7 +134,7 @@ FactoryBot.define do ...@@ -134,7 +134,7 @@ FactoryBot.define do
end end
end end
factory :geo_job_artifact_deleted_event, class: Geo::JobArtifactDeletedEvent do factory :geo_job_artifact_deleted_event, class: 'Geo::JobArtifactDeletedEvent' do
job_artifact { create(:ci_job_artifact, :archive) } job_artifact { create(:ci_job_artifact, :archive) }
after(:build, :stub) do |event, _| after(:build, :stub) do |event, _|
...@@ -145,7 +145,7 @@ FactoryBot.define do ...@@ -145,7 +145,7 @@ FactoryBot.define do
end end
end end
factory :geo_upload_deleted_event, class: Geo::UploadDeletedEvent do factory :geo_upload_deleted_event, class: 'Geo::UploadDeletedEvent' do
upload { create(:upload) } upload { create(:upload) }
file_path { upload.path } file_path { upload.path }
model_id { upload.model_id } model_id { upload.model_id }
...@@ -165,15 +165,15 @@ FactoryBot.define do ...@@ -165,15 +165,15 @@ FactoryBot.define do
end end
end end
factory :geo_reset_checksum_event, class: Geo::ResetChecksumEvent do factory :geo_reset_checksum_event, class: 'Geo::ResetChecksumEvent' do
project project
end end
factory :geo_cache_invalidation_event, class: Geo::CacheInvalidationEvent do factory :geo_cache_invalidation_event, class: 'Geo::CacheInvalidationEvent' do
sequence(:key) { |n| "cache-key-#{n}" } sequence(:key) { |n| "cache-key-#{n}" }
end end
factory :geo_container_repository_updated_event, class: Geo::ContainerRepositoryUpdatedEvent do factory :geo_container_repository_updated_event, class: 'Geo::ContainerRepositoryUpdatedEvent' do
container_repository container_repository
end end
end end
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :geo_event_log_state, class: Geo::EventLogState do factory :geo_event_log_state, class: 'Geo::EventLogState' do
sequence(:event_id) sequence(:event_id)
end end
end end
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :geo_job_artifact_registry, class: Geo::JobArtifactRegistry do factory :geo_job_artifact_registry, class: 'Geo::JobArtifactRegistry' do
sequence(:artifact_id) sequence(:artifact_id)
success { true } success { true }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :geo_lfs_object_registry, class: Geo::LfsObjectRegistry do factory :geo_lfs_object_registry, class: 'Geo::LfsObjectRegistry' do
sequence(:lfs_object_id) sequence(:lfs_object_id)
success { true } success { true }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :geo_project_registry, class: Geo::ProjectRegistry do factory :geo_project_registry, class: 'Geo::ProjectRegistry' do
project project
last_repository_synced_at { nil } last_repository_synced_at { nil }
last_repository_successful_sync_at { nil } last_repository_successful_sync_at { nil }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :geo_upload_registry, class: Geo::UploadRegistry do factory :geo_upload_registry, class: 'Geo::UploadRegistry' do
sequence(:file_id) sequence(:file_id)
file_type { :file } file_type { :file }
success { true } success { true }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :group_saml_identity, class: Identity, parent: :identity do factory :group_saml_identity, class: 'Identity', parent: :identity do
provider { 'group_saml' } provider { 'group_saml' }
extern_uid { generate(:username) } extern_uid { generate(:username) }
saml_provider saml_provider
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :project_incident_management_setting, class: IncidentManagement::ProjectIncidentManagementSetting do factory :project_incident_management_setting, class: 'IncidentManagement::ProjectIncidentManagementSetting' do
project project
create_issue { false } create_issue { false }
issue_template_key { nil } issue_template_key { nil }
......
...@@ -6,7 +6,7 @@ FactoryBot.define do ...@@ -6,7 +6,7 @@ FactoryBot.define do
project project
end end
factory :insights_issues_by_team, class: Hash do factory :insights_issues_by_team, class: 'Hash' do
initialize_with do initialize_with do
{ {
Manage: 1, Manage: 1,
...@@ -17,7 +17,7 @@ FactoryBot.define do ...@@ -17,7 +17,7 @@ FactoryBot.define do
end end
end end
factory :insights_merge_requests_per_month, class: Hash do factory :insights_merge_requests_per_month, class: 'Hash' do
initialize_with do initialize_with do
{ {
'January 2019' => 1, 'January 2019' => 1,
...@@ -27,7 +27,7 @@ FactoryBot.define do ...@@ -27,7 +27,7 @@ FactoryBot.define do
end end
end end
factory :insights_issues_by_team_per_month, class: Hash do factory :insights_issues_by_team_per_month, class: 'Hash' do
initialize_with do initialize_with do
{ {
'January 2019' => { 'January 2019' => {
......
...@@ -20,7 +20,7 @@ end ...@@ -20,7 +20,7 @@ end
FactoryBot.define do FactoryBot.define do
factory :note_on_epic, parent: :note, traits: [:on_epic] factory :note_on_epic, parent: :note, traits: [:on_epic]
factory :diff_note_on_design, parent: :note, traits: [:on_design], class: DiffNote do factory :diff_note_on_design, parent: :note, traits: [:on_design], class: 'DiffNote' do
position do position do
Gitlab::Diff::Position.new( Gitlab::Diff::Position.new(
old_path: noteable.full_path, old_path: noteable.full_path,
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :operations_feature_flag_scope, class: Operations::FeatureFlagScope do factory :operations_feature_flag_scope, class: 'Operations::FeatureFlagScope' do
association :feature_flag, factory: :operations_feature_flag association :feature_flag, factory: :operations_feature_flag
active { true } active { true }
strategies { [{ name: "default", parameters: {} }] } strategies { [{ name: "default", parameters: {} }] }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :operations_feature_flag, class: Operations::FeatureFlag do factory :operations_feature_flag, class: 'Operations::FeatureFlag' do
sequence(:name) { |n| "feature_flag_#{n}" } sequence(:name) { |n| "feature_flag_#{n}" }
project project
active { true } active { true }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :operations_feature_flags_client, class: Operations::FeatureFlagsClient do factory :operations_feature_flags_client, class: 'Operations::FeatureFlagsClient' do
project project
end end
end end
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :package, class: Packages::Package do factory :package, class: 'Packages::Package' do
project project
name { 'my/company/app/my-app' } name { 'my/company/app/my-app' }
sequence(:version) { |n| "1.#{n}-SNAPSHOT" } sequence(:version) { |n| "1.#{n}-SNAPSHOT" }
...@@ -65,10 +65,10 @@ FactoryBot.define do ...@@ -65,10 +65,10 @@ FactoryBot.define do
end end
end end
factory :package_build_info, class: Packages::BuildInfo do factory :package_build_info, class: 'Packages::BuildInfo' do
end end
factory :package_file, class: Packages::PackageFile do factory :package_file, class: 'Packages::PackageFile' do
package package
factory :conan_package_file do factory :conan_package_file do
...@@ -175,7 +175,7 @@ FactoryBot.define do ...@@ -175,7 +175,7 @@ FactoryBot.define do
end end
end end
factory :maven_metadatum, class: Packages::MavenMetadatum do factory :maven_metadatum, class: 'Packages::MavenMetadatum' do
package package
path { 'my/company/app/my-app/1.0-SNAPSHOT' } path { 'my/company/app/my-app/1.0-SNAPSHOT' }
app_group { 'my.company.app' } app_group { 'my.company.app' }
...@@ -183,13 +183,13 @@ FactoryBot.define do ...@@ -183,13 +183,13 @@ FactoryBot.define do
app_version { '1.0-SNAPSHOT' } app_version { '1.0-SNAPSHOT' }
end end
factory :conan_metadatum, class: Packages::ConanMetadatum do factory :conan_metadatum, class: 'Packages::ConanMetadatum' do
package package
package_username { 'username' } package_username { 'username' }
package_channel { 'stable' } package_channel { 'stable' }
end end
factory :conan_file_metadatum, class: Packages::ConanFileMetadatum do factory :conan_file_metadatum, class: 'Packages::ConanFileMetadatum' do
package_file package_file
recipe_revision { '0' } recipe_revision { '0' }
...@@ -204,18 +204,18 @@ FactoryBot.define do ...@@ -204,18 +204,18 @@ FactoryBot.define do
end end
end end
factory :packages_dependency, class: Packages::Dependency do factory :packages_dependency, class: 'Packages::Dependency' do
sequence(:name) { |n| "@test/package-#{n}"} sequence(:name) { |n| "@test/package-#{n}"}
sequence(:version_pattern) { |n| "~6.2.#{n}" } sequence(:version_pattern) { |n| "~6.2.#{n}" }
end end
factory :packages_dependency_link, class: Packages::DependencyLink do factory :packages_dependency_link, class: 'Packages::DependencyLink' do
package package
dependency { create(:packages_dependency) } dependency { create(:packages_dependency) }
dependency_type { :dependencies } dependency_type { :dependencies }
end end
factory :packages_tag, class: Packages::Tag do factory :packages_tag, class: 'Packages::Tag' do
package package
sequence(:name) { |n| "tag-#{n}"} sequence(:name) { |n| "tag-#{n}"}
end end
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :project_alerting_setting, class: Alerting::ProjectAlertingSetting do factory :project_alerting_setting, class: 'Alerting::ProjectAlertingSetting' do
project project
token { 'access_token_123' } token { 'access_token_123' }
end end
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :protected_branch_merge_access_level, class: ProtectedBranch::MergeAccessLevel do factory :protected_branch_merge_access_level, class: 'ProtectedBranch::MergeAccessLevel' do
user { nil } user { nil }
group { nil } group { nil }
protected_branch protected_branch
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :protected_branch_push_access_level, class: ProtectedBranch::PushAccessLevel do factory :protected_branch_push_access_level, class: 'ProtectedBranch::PushAccessLevel' do
user { nil } user { nil }
group { nil } group { nil }
protected_branch protected_branch
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :protected_branch_unprotect_access_level, class: ProtectedBranch::UnprotectAccessLevel do factory :protected_branch_unprotect_access_level, class: 'ProtectedBranch::UnprotectAccessLevel' do
user { nil } user { nil }
group { nil } group { nil }
protected_branch protected_branch
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :protected_environment_deploy_access_level, class: ProtectedEnvironment::DeployAccessLevel do factory :protected_environment_deploy_access_level, class: 'ProtectedEnvironment::DeployAccessLevel' do
user { nil } user { nil }
group { nil } group { nil }
protected_environment protected_environment
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :protected_tag_create_access_level, class: ProtectedTag::CreateAccessLevel do factory :protected_tag_create_access_level, class: 'ProtectedTag::CreateAccessLevel' do
user { nil } user { nil }
group { nil } group { nil }
protected_tag protected_tag
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :software_license, class: SoftwareLicense do factory :software_license, class: 'SoftwareLicense' do
sequence(:name) { |n| "SOFTWARE-LICENSE-2.7/example_#{n}" } sequence(:name) { |n| "SOFTWARE-LICENSE-2.7/example_#{n}" }
trait :mit do trait :mit do
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :software_license_policy, class: SoftwareLicensePolicy do factory :software_license_policy, class: 'SoftwareLicensePolicy' do
classification { :allowed } classification { :allowed }
project project
software_license software_license
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :spdx_catalogue, class: ::Gitlab::SPDX::Catalogue do factory :spdx_catalogue, class: '::Gitlab::SPDX::Catalogue' do
initialize_with do initialize_with do
content = IO.read(Rails.root.join('spec', 'fixtures', 'spdx.json')) content = IO.read(Rails.root.join('spec', 'fixtures', 'spdx.json'))
::Gitlab::SPDX::Catalogue.new(JSON.parse(content, symbolize_names: true)) ::Gitlab::SPDX::Catalogue.new(JSON.parse(content, symbolize_names: true))
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :spdx_license, class: ::Gitlab::SPDX::License do factory :spdx_license, class: '::Gitlab::SPDX::License' do
id { |n| "License-#{n}" } id { |n| "License-#{n}" }
name { |n| "License #{n}" } name { |n| "License #{n}" }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :users_ops_dashboard_project, class: UsersOpsDashboardProject do factory :users_ops_dashboard_project, class: 'UsersOpsDashboardProject' do
user factory: :user user factory: :user
project factory: :project project factory: :project
end end
......
...@@ -7,7 +7,7 @@ FactoryBot.define do ...@@ -7,7 +7,7 @@ FactoryBot.define do
Digest::SHA1.hexdigest n.to_s Digest::SHA1.hexdigest n.to_s
end end
factory :vulnerability_feedback, class: Vulnerabilities::Feedback do factory :vulnerability_feedback, class: 'Vulnerabilities::Feedback' do
project project
author author
issue { nil } issue { nil }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :vulnerabilities_identifier, class: Vulnerabilities::Identifier do factory :vulnerabilities_identifier, class: 'Vulnerabilities::Identifier' do
external_type { 'CVE' } external_type { 'CVE' }
external_id { 'CVE-2018-1234' } external_id { 'CVE-2018-1234' }
fingerprint { '52d084cede3db8fafcd6b8ae382ddf1970da3b7f' } fingerprint { '52d084cede3db8fafcd6b8ae382ddf1970da3b7f' }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :vulnerabilities_issue_link, class: Vulnerabilities::IssueLink do factory :vulnerabilities_issue_link, class: 'Vulnerabilities::IssueLink' do
vulnerability vulnerability
issue issue
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :vulnerabilities_occurrence_identifier, class: Vulnerabilities::OccurrenceIdentifier do factory :vulnerabilities_occurrence_identifier, class: 'Vulnerabilities::OccurrenceIdentifier' do
occurrence factory: :vulnerabilities_occurrence occurrence factory: :vulnerabilities_occurrence
identifier factory: :vulnerabilities_identifier identifier factory: :vulnerabilities_identifier
end end
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :vulnerabilities_occurrence_pipeline, class: Vulnerabilities::OccurrencePipeline do factory :vulnerabilities_occurrence_pipeline, class: 'Vulnerabilities::OccurrencePipeline' do
occurrence factory: :vulnerabilities_occurrence occurrence factory: :vulnerabilities_occurrence
pipeline factory: :ci_pipeline pipeline factory: :ci_pipeline
end end
......
...@@ -5,7 +5,7 @@ FactoryBot.define do ...@@ -5,7 +5,7 @@ FactoryBot.define do
Digest::SHA1.hexdigest("uuid-#{n}")[0..35] Digest::SHA1.hexdigest("uuid-#{n}")[0..35]
end end
factory :vulnerabilities_occurrence, class: Vulnerabilities::Occurrence, aliases: [:vulnerabilities_finding] do factory :vulnerabilities_occurrence, class: 'Vulnerabilities::Occurrence', aliases: [:vulnerabilities_finding] do
name { 'Cipher with no integrity' } name { 'Cipher with no integrity' }
project project
sequence(:uuid) { generate(:vulnerability_occurrence_uuid) } sequence(:uuid) { generate(:vulnerability_occurrence_uuid) }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :vulnerabilities_scanner, class: Vulnerabilities::Scanner do factory :vulnerabilities_scanner, class: 'Vulnerabilities::Scanner' do
external_id { 'find_sec_bugs' } external_id { 'find_sec_bugs' }
name { 'Find Security Bugs' } name { 'Find Security Bugs' }
project project
......
...@@ -14,7 +14,7 @@ describe EE::Gitlab::Auth::LDAP::Sync::Groups do ...@@ -14,7 +14,7 @@ describe EE::Gitlab::Auth::LDAP::Sync::Groups do
allow(EE::Gitlab::Auth::LDAP::Sync::AdminUsers).to receive(:execute) allow(EE::Gitlab::Auth::LDAP::Sync::AdminUsers).to receive(:execute)
allow(EE::Gitlab::Auth::LDAP::Sync::ExternalUsers).to receive(:execute) allow(EE::Gitlab::Auth::LDAP::Sync::ExternalUsers).to receive(:execute)
2.times { create(:group_with_ldap_group_link) } create_list(:group_with_ldap_group_link, 2)
end end
after do after do
......
...@@ -171,7 +171,7 @@ describe License do ...@@ -171,7 +171,7 @@ describe License do
context 'but active users exceeds restricted user count' do context 'but active users exceeds restricted user count' do
it 'is invalid' do it 'is invalid' do
6.times { create(:user) } create_list(:user, 6)
expect(license).not_to be_valid expect(license).not_to be_valid
end end
...@@ -192,14 +192,14 @@ describe License do ...@@ -192,14 +192,14 @@ describe License do
end end
it 'uses current active user count to calculate the expected true-up' do it 'uses current active user count to calculate the expected true-up' do
3.times { create(:user) } create_list(:user, 3)
expect(license).to be_valid expect(license).to be_valid
end end
context 'with wrong true-up quantity' do context 'with wrong true-up quantity' do
it 'is invalid' do it 'is invalid' do
2.times { create(:user) } create_list(:user, 2)
expect(license).not_to be_valid expect(license).not_to be_valid
end end
......
...@@ -2375,15 +2375,9 @@ describe Project do ...@@ -2375,15 +2375,9 @@ describe Project do
group2.update(custom_project_templates_group_id: group2_sub2.id) group2.update(custom_project_templates_group_id: group2_sub2.id)
create(:project, group: group1) create(:project, group: group1)
2.times do create_list(:project, 2, group: group2)
create(:project, group: group2) create_list(:project, 3, group: group2_sub1)
end create_list(:project, 4, group: group2_sub2)
3.times do
create(:project, group: group2_sub1)
end
4.times do
create(:project, group: group2_sub2)
end
end end
it 'counts instance level templates' do it 'counts instance level templates' do
......
...@@ -13,9 +13,7 @@ describe ElasticNamespaceRolloutWorker do ...@@ -13,9 +13,7 @@ describe ElasticNamespaceRolloutWorker do
before_all do before_all do
Plan::PAID_HOSTED_PLANS.each do |plan| Plan::PAID_HOSTED_PLANS.each do |plan|
4.times do create_list(:gitlab_subscription, 4, hosted_plan: public_send("#{plan}_plan"))
create(:gitlab_subscription, hosted_plan: public_send("#{plan}_plan"))
end
end end
end end
......
...@@ -112,9 +112,7 @@ describe AutocompleteController do ...@@ -112,9 +112,7 @@ describe AutocompleteController do
context 'limited users per page' do context 'limited users per page' do
before do before do
25.times do create_list(:user, 25)
create(:user)
end
sign_in(user) sign_in(user)
get(:users) get(:users)
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :cycle_analytics_project_stage, class: Analytics::CycleAnalytics::ProjectStage do factory :cycle_analytics_project_stage, class: 'Analytics::CycleAnalytics::ProjectStage' do
project project
sequence(:name) { |n| "Stage ##{n}" } sequence(:name) { |n| "Stage ##{n}" }
hidden { false } hidden { false }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :aws_role, class: Aws::Role do factory :aws_role, class: 'Aws::Role' do
user user
role_arn { 'arn:aws:iam::123456789012:role/role-name' } role_arn { 'arn:aws:iam::123456789012:role/role-name' }
......
...@@ -6,11 +6,11 @@ FactoryBot.define do ...@@ -6,11 +6,11 @@ FactoryBot.define do
image_url { generate(:url) } image_url { generate(:url) }
end end
factory :project_badge, traits: [:base_badge], class: ProjectBadge do factory :project_badge, traits: [:base_badge], class: 'ProjectBadge' do
project project
end end
factory :group_badge, aliases: [:badge], traits: [:base_badge], class: GroupBadge do factory :group_badge, aliases: [:badge], traits: [:base_badge], class: 'GroupBadge' do
group group
end end
end end
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :chat_name, class: ChatName do factory :chat_name, class: 'ChatName' do
user factory: :user user factory: :user
service factory: :service service factory: :service
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :chat_team, class: ChatTeam do factory :chat_team, class: 'ChatTeam' do
sequence(:team_id) { |n| "abcdefghijklm#{n}" } sequence(:team_id) { |n| "abcdefghijklm#{n}" }
namespace factory: :group namespace factory: :group
end end
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_bridge, class: Ci::Bridge do factory :ci_bridge, class: 'Ci::Bridge' do
name { 'bridge' } name { 'bridge' }
stage { 'test' } stage { 'test' }
stage_idx { 0 } stage_idx { 0 }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_build_need, class: Ci::BuildNeed do factory :ci_build_need, class: 'Ci::BuildNeed' do
build factory: :ci_build build factory: :ci_build
sequence(:name) { |n| "build_#{n}" } sequence(:name) { |n| "build_#{n}" }
end end
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_build_trace_chunk, class: Ci::BuildTraceChunk do factory :ci_build_trace_chunk, class: 'Ci::BuildTraceChunk' do
build factory: :ci_build build factory: :ci_build
chunk_index { 0 } chunk_index { 0 }
data_store { :redis } data_store { :redis }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_build_trace_section_name, class: Ci::BuildTraceSectionName do factory :ci_build_trace_section_name, class: 'Ci::BuildTraceSectionName' do
sequence(:name) { |n| "section_#{n}" } sequence(:name) { |n| "section_#{n}" }
project factory: :project project factory: :project
end end
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
include ActionDispatch::TestProcess include ActionDispatch::TestProcess
FactoryBot.define do FactoryBot.define do
factory :ci_build, class: Ci::Build do factory :ci_build, class: 'Ci::Build' do
name { 'test' } name { 'test' }
stage { 'test' } stage { 'test' }
stage_idx { 0 } stage_idx { 0 }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_group_variable, class: Ci::GroupVariable do factory :ci_group_variable, class: 'Ci::GroupVariable' do
sequence(:key) { |n| "VARIABLE_#{n}" } sequence(:key) { |n| "VARIABLE_#{n}" }
value { 'VARIABLE_VALUE' } value { 'VARIABLE_VALUE' }
masked { false } masked { false }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
include ActionDispatch::TestProcess include ActionDispatch::TestProcess
FactoryBot.define do FactoryBot.define do
factory :ci_job_artifact, class: Ci::JobArtifact do factory :ci_job_artifact, class: 'Ci::JobArtifact' do
job factory: :ci_build job factory: :ci_build
file_type { :archive } file_type { :archive }
file_format { :zip } file_format { :zip }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_job_variable, class: Ci::JobVariable do factory :ci_job_variable, class: 'Ci::JobVariable' do
sequence(:key) { |n| "VARIABLE_#{n}" } sequence(:key) { |n| "VARIABLE_#{n}" }
value { 'VARIABLE_VALUE' } value { 'VARIABLE_VALUE' }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_pipeline_schedule, class: Ci::PipelineSchedule do factory :ci_pipeline_schedule, class: 'Ci::PipelineSchedule' do
cron { '0 1 * * *' } cron { '0 1 * * *' }
cron_timezone { Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE } cron_timezone { Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE }
ref { 'master' } ref { 'master' }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_pipeline_schedule_variable, class: Ci::PipelineScheduleVariable do factory :ci_pipeline_schedule_variable, class: 'Ci::PipelineScheduleVariable' do
sequence(:key) { |n| "VARIABLE_#{n}" } sequence(:key) { |n| "VARIABLE_#{n}" }
value { 'VARIABLE_VALUE' } value { 'VARIABLE_VALUE' }
variable_type { 'env_var' } variable_type { 'env_var' }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_pipeline_variable, class: Ci::PipelineVariable do factory :ci_pipeline_variable, class: 'Ci::PipelineVariable' do
sequence(:key) { |n| "VARIABLE_#{n}" } sequence(:key) { |n| "VARIABLE_#{n}" }
value { 'VARIABLE_VALUE' } value { 'VARIABLE_VALUE' }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
FactoryBot.define do FactoryBot.define do
# TODO: we can remove this factory in favour of :ci_pipeline # TODO: we can remove this factory in favour of :ci_pipeline
factory :ci_empty_pipeline, class: Ci::Pipeline do factory :ci_empty_pipeline, class: 'Ci::Pipeline' do
source { :push } source { :push }
ref { 'master' } ref { 'master' }
sha { '97de212e80737a608d939f648d959671fb0a0142' } sha { '97de212e80737a608d939f648d959671fb0a0142' }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_resource, class: Ci::Resource do factory :ci_resource, class: 'Ci::Resource' do
resource_group factory: :ci_resource_group resource_group factory: :ci_resource_group
trait(:retained) do trait(:retained) do
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_resource_group, class: Ci::ResourceGroup do factory :ci_resource_group, class: 'Ci::ResourceGroup' do
project project
sequence(:key) { |n| "IOS_#{n}" } sequence(:key) { |n| "IOS_#{n}" }
end end
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_runner_project, class: Ci::RunnerProject do factory :ci_runner_project, class: 'Ci::RunnerProject' do
runner factory: [:ci_runner, :project] runner factory: [:ci_runner, :project]
project project
end end
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_runner, class: Ci::Runner do factory :ci_runner, class: 'Ci::Runner' do
sequence(:description) { |n| "My runner#{n}" } sequence(:description) { |n| "My runner#{n}" }
platform { "darwin" } platform { "darwin" }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_sources_pipeline, class: Ci::Sources::Pipeline do factory :ci_sources_pipeline, class: 'Ci::Sources::Pipeline' do
after(:build) do |source| after(:build) do |source|
source.project ||= source.pipeline.project source.project ||= source.pipeline.project
source.source_pipeline ||= source.source_job.pipeline source.source_pipeline ||= source.source_job.pipeline
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_stage, class: Ci::LegacyStage do factory :ci_stage, class: 'Ci::LegacyStage' do
skip_create skip_create
transient do transient do
...@@ -18,7 +18,7 @@ FactoryBot.define do ...@@ -18,7 +18,7 @@ FactoryBot.define do
end end
end end
factory :ci_stage_entity, class: Ci::Stage do factory :ci_stage_entity, class: 'Ci::Stage' do
project factory: :project project factory: :project
pipeline factory: :ci_empty_pipeline pipeline factory: :ci_empty_pipeline
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_trigger_request, class: Ci::TriggerRequest do factory :ci_trigger_request, class: 'Ci::TriggerRequest' do
trigger factory: :ci_trigger trigger factory: :ci_trigger
end end
end end
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_trigger_without_token, class: Ci::Trigger do factory :ci_trigger_without_token, class: 'Ci::Trigger' do
owner owner
factory :ci_trigger do factory :ci_trigger do
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :ci_variable, class: Ci::Variable do factory :ci_variable, class: 'Ci::Variable' do
sequence(:key) { |n| "VARIABLE_#{n}" } sequence(:key) { |n| "VARIABLE_#{n}" }
value { 'VARIABLE_VALUE' } value { 'VARIABLE_VALUE' }
masked { false } masked { false }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :clusters_applications_helm, class: Clusters::Applications::Helm do factory :clusters_applications_helm, class: 'Clusters::Applications::Helm' do
cluster factory: %i(cluster provided_by_gcp) cluster factory: %i(cluster provided_by_gcp)
before(:create) do before(:create) do
...@@ -70,40 +70,40 @@ FactoryBot.define do ...@@ -70,40 +70,40 @@ FactoryBot.define do
updated_at { ClusterWaitForAppInstallationWorker::TIMEOUT.ago } updated_at { ClusterWaitForAppInstallationWorker::TIMEOUT.ago }
end end
factory :clusters_applications_ingress, class: Clusters::Applications::Ingress do factory :clusters_applications_ingress, class: 'Clusters::Applications::Ingress' do
modsecurity_enabled { false } modsecurity_enabled { false }
cluster factory: %i(cluster with_installed_helm provided_by_gcp) cluster factory: %i(cluster with_installed_helm provided_by_gcp)
end end
factory :clusters_applications_cert_manager, class: Clusters::Applications::CertManager do factory :clusters_applications_cert_manager, class: 'Clusters::Applications::CertManager' do
email { 'admin@example.com' } email { 'admin@example.com' }
cluster factory: %i(cluster with_installed_helm provided_by_gcp) cluster factory: %i(cluster with_installed_helm provided_by_gcp)
end end
factory :clusters_applications_elastic_stack, class: Clusters::Applications::ElasticStack do factory :clusters_applications_elastic_stack, class: 'Clusters::Applications::ElasticStack' do
cluster factory: %i(cluster with_installed_helm provided_by_gcp) cluster factory: %i(cluster with_installed_helm provided_by_gcp)
end end
factory :clusters_applications_crossplane, class: Clusters::Applications::Crossplane do factory :clusters_applications_crossplane, class: 'Clusters::Applications::Crossplane' do
stack { 'gcp' } stack { 'gcp' }
cluster factory: %i(cluster with_installed_helm provided_by_gcp) cluster factory: %i(cluster with_installed_helm provided_by_gcp)
end end
factory :clusters_applications_prometheus, class: Clusters::Applications::Prometheus do factory :clusters_applications_prometheus, class: 'Clusters::Applications::Prometheus' do
cluster factory: %i(cluster with_installed_helm provided_by_gcp) cluster factory: %i(cluster with_installed_helm provided_by_gcp)
end end
factory :clusters_applications_runner, class: Clusters::Applications::Runner do factory :clusters_applications_runner, class: 'Clusters::Applications::Runner' do
runner factory: %i(ci_runner) runner factory: %i(ci_runner)
cluster factory: %i(cluster with_installed_helm provided_by_gcp) cluster factory: %i(cluster with_installed_helm provided_by_gcp)
end end
factory :clusters_applications_knative, class: Clusters::Applications::Knative do factory :clusters_applications_knative, class: 'Clusters::Applications::Knative' do
hostname { 'example.com' } hostname { 'example.com' }
cluster factory: %i(cluster with_installed_helm provided_by_gcp) cluster factory: %i(cluster with_installed_helm provided_by_gcp)
end end
factory :clusters_applications_jupyter, class: Clusters::Applications::Jupyter do factory :clusters_applications_jupyter, class: 'Clusters::Applications::Jupyter' do
oauth_application factory: :oauth_application oauth_application factory: :oauth_application
cluster factory: %i(cluster with_installed_helm provided_by_gcp project) cluster factory: %i(cluster with_installed_helm provided_by_gcp project)
end end
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :cluster, class: Clusters::Cluster do factory :cluster, class: 'Clusters::Cluster' do
user user
name { 'test-cluster' } name { 'test-cluster' }
cluster_type { :project_type } cluster_type { :project_type }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :cluster_kubernetes_namespace, class: Clusters::KubernetesNamespace do factory :cluster_kubernetes_namespace, class: 'Clusters::KubernetesNamespace' do
association :cluster, :project, :provided_by_gcp association :cluster, :project, :provided_by_gcp
after(:build) do |kubernetes_namespace| after(:build) do |kubernetes_namespace|
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :cluster_platform_kubernetes, class: Clusters::Platforms::Kubernetes do factory :cluster_platform_kubernetes, class: 'Clusters::Platforms::Kubernetes' do
association :cluster, platform_type: :kubernetes, provider_type: :user association :cluster, platform_type: :kubernetes, provider_type: :user
namespace { nil } namespace { nil }
api_url { 'https://kubernetes.example.com' } api_url { 'https://kubernetes.example.com' }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :cluster_project, class: Clusters::Project do factory :cluster_project, class: 'Clusters::Project' do
cluster cluster
project project
end end
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :cluster_provider_aws, class: Clusters::Providers::Aws do factory :cluster_provider_aws, class: 'Clusters::Providers::Aws' do
association :cluster, platform_type: :kubernetes, provider_type: :aws association :cluster, platform_type: :kubernetes, provider_type: :aws
role_arn { 'arn:aws:iam::123456789012:role/role-name' } role_arn { 'arn:aws:iam::123456789012:role/role-name' }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :cluster_provider_gcp, class: Clusters::Providers::Gcp do factory :cluster_provider_gcp, class: 'Clusters::Providers::Gcp' do
association :cluster, platform_type: :kubernetes, provider_type: :gcp association :cluster, platform_type: :kubernetes, provider_type: :gcp
gcp_project_id { 'test-gcp-project' } gcp_project_id { 'test-gcp-project' }
......
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :commit_status, class: CommitStatus do factory :commit_status, class: 'CommitStatus' do
name { 'default' } name { 'default' }
stage { 'test' } stage { 'test' }
stage_idx { 0 } stage_idx { 0 }
...@@ -59,7 +59,7 @@ FactoryBot.define do ...@@ -59,7 +59,7 @@ FactoryBot.define do
build.project = build.pipeline.project build.project = build.pipeline.project
end end
factory :generic_commit_status, class: GenericCommitStatus do factory :generic_commit_status, class: 'GenericCommitStatus' do
name { 'generic' } name { 'generic' }
description { 'external commit status' } description { 'external commit status' }
end end
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment