diff --git a/Gemfile b/Gemfile index 67c0e6b4ce04afd7d0767afdbb072efa5b1f5d50..460d161587de9629bfddbc5841b51507ead013cf 100644 --- a/Gemfile +++ b/Gemfile @@ -355,7 +355,7 @@ group :development, :test do gem 'fuubar', '~> 2.2.0' gem 'database_cleaner', '~> 1.7.0' - gem 'factory_bot_rails', '~> 4.8.2' + gem 'factory_bot_rails', '~> 5.1.0' gem 'rspec-rails', '~> 3.8.0' gem 'rspec-retry', '~> 0.6.1' gem 'rspec_profiling', '~> 0.0.5' diff --git a/Gemfile.lock b/Gemfile.lock index 4a2016c8a8b02a62ceb95821564840dd969b6e9f..c6828ecb2cd8bd2336db00075aca96773090f3d0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -254,7 +254,7 @@ GEM mail (~> 2.7) encryptor (3.0.0) equalizer (0.0.11) - erubi (1.8.0) + erubi (1.9.0) escape_utils (1.2.1) et-orbi (1.2.1) tzinfo @@ -264,11 +264,11 @@ GEM expression_parser (0.9.0) extended-markdown-filter (0.6.0) html-pipeline (~> 2.0) - factory_bot (4.8.2) - activesupport (>= 3.0.0) - factory_bot_rails (4.8.2) - factory_bot (~> 4.8.2) - railties (>= 3.0.0) + factory_bot (5.1.0) + activesupport (>= 4.2.0) + factory_bot_rails (5.1.0) + factory_bot (~> 5.1.0) + railties (>= 4.2.0) faraday (0.12.2) multipart-post (>= 1.2, < 3) faraday-http-cache (2.0.0) @@ -565,7 +565,7 @@ GEM activesupport (>= 4) railties (>= 4) request_store (~> 1.0) - loofah (2.2.3) + loofah (2.3.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -783,7 +783,7 @@ GEM thor (>= 0.19.0, < 2.0) rainbow (3.0.0) raindrops (0.19.0) - rake (12.3.2) + rake (12.3.3) rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) @@ -1144,7 +1144,7 @@ DEPENDENCIES email_reply_trimmer (~> 0.1) email_spec (~> 2.2.0) escape_utils (~> 1.1) - factory_bot_rails (~> 4.8.2) + factory_bot_rails (~> 5.1.0) faraday (~> 0.12) faraday_middleware-aws-signers-v4 fast_blank diff --git a/ee/spec/factories/alerting/alert.rb b/ee/spec/factories/alerting/alert.rb index 2773b5d8f7b1346f61eb864a49324e42f7b88f95..4641b93c208d5cc857643ce0f56529477dfb2258 100644 --- a/ee/spec/factories/alerting/alert.rb +++ b/ee/spec/factories/alerting/alert.rb @@ -6,7 +6,7 @@ payload { {} } transient do - metric_id nil + metric_id { nil } after(:build) do |alert, evaluator| unless alert.payload.key?('startsAt') diff --git a/ee/spec/factories/approval_rules.rb b/ee/spec/factories/approval_rules.rb index 8fc385ab3e0466d8e3aa4fa9ef829b6711a98740..58328ba4c1e1c0c571d6abbbec0932a99ece3eff 100644 --- a/ee/spec/factories/approval_rules.rb +++ b/ee/spec/factories/approval_rules.rb @@ -8,15 +8,15 @@ factory :code_owner_rule, parent: :approval_merge_request_rule do merge_request - rule_type :code_owner - code_owner true # deprecated, replaced with `rule_type: :code_owner` + rule_type { :code_owner } + code_owner { true } # deprecated, replaced with `rule_type: :code_owner` sequence(:name) { |n| "*-#{n}.js" } end factory :report_approver_rule, parent: :approval_merge_request_rule do merge_request - rule_type :report_approver - report_type :security + rule_type { :report_approver } + report_type { :security } sequence(:name) { |n| "*-#{n}.js" } trait :requires_approval do @@ -24,23 +24,23 @@ end trait :license_management do - name ApprovalRuleLike::DEFAULT_NAME_FOR_LICENSE_REPORT - report_type :license_management + name { ApprovalRuleLike::DEFAULT_NAME_FOR_LICENSE_REPORT } + report_type { :license_management } end end factory :approval_project_rule do project sequence(:name) { |n| "#{ApprovalRuleLike::DEFAULT_NAME}-#{n}" } - rule_type :regular + rule_type { :regular } trait :requires_approval do approvals_required { rand(1..ApprovalProjectRule::APPROVALS_REQUIRED_MAX) } end trait :security_report do - rule_type :report_approver - name ApprovalRuleLike::DEFAULT_NAME_FOR_SECURITY_REPORT + rule_type { :report_approver } + name { ApprovalRuleLike::DEFAULT_NAME_FOR_SECURITY_REPORT } end trait :security do @@ -48,8 +48,8 @@ end trait :license_management do - name ApprovalRuleLike::DEFAULT_NAME_FOR_LICENSE_REPORT - rule_type :report_approver + name { ApprovalRuleLike::DEFAULT_NAME_FOR_LICENSE_REPORT } + rule_type { :report_approver } end end end diff --git a/ee/spec/factories/audit_events.rb b/ee/spec/factories/audit_events.rb index 8e100b4a1248434e781162b0e97188e277142c9a..a7bb4d371f611f4b4ccdafd11682a9b747ff708c 100644 --- a/ee/spec/factories/audit_events.rb +++ b/ee/spec/factories/audit_events.rb @@ -4,7 +4,7 @@ factory :audit_event, class: 'SecurityEvent', aliases: [:user_audit_event] do user - entity_type 'User' + entity_type { 'User' } entity_id { user.id } details do { @@ -21,7 +21,7 @@ end trait :project_event do - entity_type 'Project' + entity_type { 'Project' } entity_id { create(:project).id } details do { @@ -38,7 +38,7 @@ end trait :group_event do - entity_type 'Group' + entity_type { 'Group' } entity_id { create(:group).id } details do { diff --git a/ee/spec/factories/ci/builds.rb b/ee/spec/factories/ci/builds.rb index 1d7f1010ed428478a8412ba0116e0d31a85fd4ef..ace6a7893eeb470e1cd9275c1d37df011d8cc73b 100644 --- a/ee/spec/factories/ci/builds.rb +++ b/ee/spec/factories/ci/builds.rb @@ -10,7 +10,7 @@ trait "legacy_#{report_type}".to_sym do success artifacts - name report_type + name { report_type } options do { @@ -29,7 +29,7 @@ end trait :dependency_list do - name :dependency_scanning + name { :dependency_scanning } after(:build) do |build| build.job_artifacts << build(:ee_ci_job_artifact, :dependency_list, job: build) diff --git a/ee/spec/factories/ci/job_artifacts.rb b/ee/spec/factories/ci/job_artifacts.rb index 5eda63dd04c5f777bb36e38ff261b6a3132a85c1..452826693f47008666ea43b2b3e2b3b215bfc0b3 100644 --- a/ee/spec/factories/ci/job_artifacts.rb +++ b/ee/spec/factories/ci/job_artifacts.rb @@ -3,8 +3,8 @@ FactoryBot.define do factory :ee_ci_job_artifact, class: ::Ci::JobArtifact, parent: :ci_job_artifact do trait :sast do - file_type :sast - file_format :raw + file_type { :sast } + file_format { :raw } after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( @@ -13,8 +13,8 @@ end trait :sast_feature_branch do - file_format :raw - file_type :sast + file_format { :raw } + file_type { :sast } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -23,8 +23,8 @@ end trait :sast_deprecated do - file_type :sast - file_format :raw + file_type { :sast } + file_format { :raw } after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( @@ -33,8 +33,8 @@ end trait :sast_with_corrupted_data do - file_type :sast - file_format :raw + file_type { :sast } + file_format { :raw } after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( @@ -43,8 +43,8 @@ end trait :license_management do - file_type :license_management - file_format :raw + file_type { :license_management } + file_format { :raw } after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( @@ -53,8 +53,8 @@ end trait :license_management_feature_branch do - file_type :license_management - file_format :raw + file_type { :license_management } + file_format { :raw } after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( @@ -63,8 +63,8 @@ end trait :corrupted_license_management_report do - file_type :license_management - file_format :raw + file_type { :license_management } + file_format { :raw } after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( @@ -73,8 +73,8 @@ end trait :performance do - file_format :raw - file_type :performance + file_format { :raw } + file_type { :performance } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -83,8 +83,8 @@ end trait :license_management do - file_format :raw - file_type :license_management + file_format { :raw } + file_type { :license_management } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -93,8 +93,8 @@ end trait :dependency_scanning do - file_format :raw - file_type :dependency_scanning + file_format { :raw } + file_type { :dependency_scanning } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -103,8 +103,8 @@ end trait :dependency_scanning_remediation do - file_format :raw - file_type :dependency_scanning + file_format { :raw } + file_type { :dependency_scanning } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -113,8 +113,8 @@ end trait :dependency_scanning_deprecated do - file_format :raw - file_type :dependency_scanning + file_format { :raw } + file_type { :dependency_scanning } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -123,8 +123,8 @@ end trait :dependency_scanning_feature_branch do - file_format :raw - file_type :dependency_scanning + file_format { :raw } + file_type { :dependency_scanning } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -133,8 +133,8 @@ end trait :corrupted_dependency_scanning_report do - file_format :raw - file_type :dependency_scanning + file_format { :raw } + file_type { :dependency_scanning } after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( @@ -143,8 +143,8 @@ end trait :container_scanning do - file_format :raw - file_type :container_scanning + file_format { :raw } + file_type { :container_scanning } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -153,8 +153,8 @@ end trait :container_scanning_feature_branch do - file_format :raw - file_type :container_scanning + file_format { :raw } + file_type { :container_scanning } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -163,8 +163,8 @@ end trait :corrupted_container_scanning_report do - file_format :raw - file_type :container_scanning + file_format { :raw } + file_type { :container_scanning } after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( @@ -173,8 +173,8 @@ end trait :dast do - file_format :raw - file_type :dast + file_format { :raw } + file_type { :dast } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -183,8 +183,8 @@ end trait :metrics do - file_format :gzip - file_type :metrics + file_format { :gzip } + file_type { :metrics } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -193,8 +193,8 @@ end trait :metrics_alternate do - file_format :gzip - file_type :metrics + file_format { :gzip } + file_type { :metrics } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -203,8 +203,8 @@ end trait :dependency_list do - file_format :raw - file_type :dependency_scanning + file_format { :raw } + file_type { :dependency_scanning } after(:build) do |artifact, _| artifact.file = fixture_file_upload( diff --git a/ee/spec/factories/ci/pipelines.rb b/ee/spec/factories/ci/pipelines.rb index a159bbcbe1c6c4c18db523141991899f83c3029e..6f55c4205e0df212363c242955bd2cab413d0745 100644 --- a/ee/spec/factories/ci/pipelines.rb +++ b/ee/spec/factories/ci/pipelines.rb @@ -3,13 +3,13 @@ FactoryBot.define do factory :ee_ci_pipeline, class: Ci::Pipeline, parent: :ci_pipeline do trait :webide do - source :webide - config_source :webide_source + source { :webide } + config_source { :webide_source } end %i[license_management dependency_list dependency_scanning sast container_scanning].each do |report_type| trait "with_#{report_type}_report".to_sym do - status :success + status { :success } after(:build) do |pipeline, evaluator| pipeline.builds << build(:ee_ci_build, report_type, :success, pipeline: pipeline, project: pipeline.project) @@ -18,7 +18,7 @@ end trait :with_container_scanning_feature_branch do - status :success + status { :success } after(:build) do |pipeline, evaluator| pipeline.builds << build(:ee_ci_build, :container_scanning_feature_branch, pipeline: pipeline, project: pipeline.project) @@ -26,7 +26,7 @@ end trait :with_corrupted_container_scanning_report do - status :success + status { :success } after(:build) do |pipeline, evaluator| pipeline.builds << build(:ee_ci_build, :corrupted_container_scanning_report, pipeline: pipeline, project: pipeline.project) @@ -34,7 +34,7 @@ end trait :with_dependency_scanning_feature_branch do - status :success + status { :success } after(:build) do |pipeline, evaluator| pipeline.builds << build(:ee_ci_build, :dependency_scanning_feature_branch, pipeline: pipeline, project: pipeline.project) @@ -42,7 +42,7 @@ end trait :with_corrupted_dependency_scanning_report do - status :success + status { :success } after(:build) do |pipeline, evaluator| pipeline.builds << build(:ee_ci_build, :corrupted_dependency_scanning_report, pipeline: pipeline, project: pipeline.project) @@ -50,7 +50,7 @@ end trait :with_sast_feature_branch do - status :success + status { :success } after(:build) do |pipeline, evaluator| pipeline.builds << build(:ee_ci_build, :sast_feature_branch, pipeline: pipeline, project: pipeline.project) @@ -58,7 +58,7 @@ end trait :with_license_management_feature_branch do - status :success + status { :success } after(:build) do |pipeline, evaluator| pipeline.builds << build(:ee_ci_build, :license_management_feature_branch, pipeline: pipeline, project: pipeline.project) @@ -66,7 +66,7 @@ end trait :with_corrupted_license_management_report do - status :success + status { :success } after(:build) do |pipeline, evaluator| pipeline.builds << build(:ee_ci_build, :corrupted_license_management_report, pipeline: pipeline, project: pipeline.project) @@ -74,7 +74,7 @@ end trait :with_metrics_report do - status :success + status { :success } after(:build) do |pipeline, evaluator| pipeline.builds << build(:ee_ci_build, :metrics, pipeline: pipeline, project: pipeline.project) @@ -82,7 +82,7 @@ end trait :with_metrics_alternate_report do - status :success + status { :success } after(:build) do |pipeline, evaluator| pipeline.builds << build(:ee_ci_build, :metrics_alternate, pipeline: pipeline, project: pipeline.project) diff --git a/ee/spec/factories/ci/reports/security/identifiers.rb b/ee/spec/factories/ci/reports/security/identifiers.rb index 03460df4d22fd4617ee28a4d9b1ea4893a6d5e5b..897a5de53ee47fc6d50e2d4ee84a0580e204659a 100644 --- a/ee/spec/factories/ci/reports/security/identifiers.rb +++ b/ee/spec/factories/ci/reports/security/identifiers.rb @@ -2,8 +2,8 @@ FactoryBot.define do factory :ci_reports_security_identifier, class: ::Gitlab::Ci::Reports::Security::Identifier do - external_id 'PREDICTABLE_RANDOM' - external_type 'find_sec_bugs_type' + external_id { 'PREDICTABLE_RANDOM' } + external_type { 'find_sec_bugs_type' } name { "#{external_type}-#{external_id}" } skip_create diff --git a/ee/spec/factories/ci/reports/security/locations/container_scanning.rb b/ee/spec/factories/ci/reports/security/locations/container_scanning.rb index 906d20d1413212247fdb38e92de0708a4be060f8..cbde386dabf256c4a479607dcb0ac49e85d9a7e4 100644 --- a/ee/spec/factories/ci/reports/security/locations/container_scanning.rb +++ b/ee/spec/factories/ci/reports/security/locations/container_scanning.rb @@ -2,10 +2,10 @@ FactoryBot.define do factory :ci_reports_security_locations_container_scanning, class: ::Gitlab::Ci::Reports::Security::Locations::ContainerScanning do - image 'registry.gitlab.com/my/project:latest' - operating_system 'debian:9' - package_name 'glibc' - package_version '1.2.3' + image { 'registry.gitlab.com/my/project:latest' } + operating_system { 'debian:9' } + package_name { 'glibc' } + package_version { '1.2.3' } skip_create diff --git a/ee/spec/factories/ci/reports/security/locations/dast.rb b/ee/spec/factories/ci/reports/security/locations/dast.rb index 0c35e23d5fdfe3934f948af40fd35a42ade7d5b0..c8860f726012b99a75eb71012bbb43672c1f1c5b 100644 --- a/ee/spec/factories/ci/reports/security/locations/dast.rb +++ b/ee/spec/factories/ci/reports/security/locations/dast.rb @@ -2,10 +2,10 @@ FactoryBot.define do factory :ci_reports_security_locations_dast, class: ::Gitlab::Ci::Reports::Security::Locations::Dast do - hostname 'my-app.com' - method_name 'GET' - param 'X-Content-Type-Options' - path '/some/path' + hostname { 'my-app.com' } + method_name { 'GET' } + param { 'X-Content-Type-Options' } + path { '/some/path' } skip_create diff --git a/ee/spec/factories/ci/reports/security/locations/dependency_scanning.rb b/ee/spec/factories/ci/reports/security/locations/dependency_scanning.rb index d50cef1e48b43e770b2ebda35a3ff79c7c4fe33b..f1de7e278e54b6e4cb2d926d2d6fe1f4ba7e7b2a 100644 --- a/ee/spec/factories/ci/reports/security/locations/dependency_scanning.rb +++ b/ee/spec/factories/ci/reports/security/locations/dependency_scanning.rb @@ -2,9 +2,9 @@ FactoryBot.define do factory :ci_reports_security_locations_dependency_scanning, class: ::Gitlab::Ci::Reports::Security::Locations::DependencyScanning do - file_path 'app/pom.xml' - package_name 'io.netty/netty' - package_version '1.2.3' + file_path { 'app/pom.xml' } + package_name { 'io.netty/netty' } + package_version { '1.2.3' } skip_create diff --git a/ee/spec/factories/ci/reports/security/locations/sast.rb b/ee/spec/factories/ci/reports/security/locations/sast.rb index b098279471c645f780a29a4a9971e1a6620cb6b2..864a7d91f98c47693a9378d62d506b7f9f969f85 100644 --- a/ee/spec/factories/ci/reports/security/locations/sast.rb +++ b/ee/spec/factories/ci/reports/security/locations/sast.rb @@ -2,11 +2,11 @@ FactoryBot.define 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' - start_line 29 - end_line 31 - class_name 'com.gitlab.security_products.tests.App' - method_name 'insecureCypher' + file_path { 'maven/src/main/java/com/gitlab/security_products/tests/App.java' } + start_line { 29 } + end_line { 31 } + class_name { 'com.gitlab.security_products.tests.App' } + method_name { 'insecureCypher' } skip_create diff --git a/ee/spec/factories/ci/reports/security/occurrences.rb b/ee/spec/factories/ci/reports/security/occurrences.rb index 75c9241ac6c530f839c0ad39745148028f66b8a7..c5562a53f63603a622b7e5b54bc59eb68283ffee 100644 --- a/ee/spec/factories/ci/reports/security/occurrences.rb +++ b/ee/spec/factories/ci/reports/security/occurrences.rb @@ -3,12 +3,12 @@ FactoryBot.define 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}" } - confidence :medium + confidence { :medium } identifiers { Array.new(1) { FactoryBot.build(:ci_reports_security_identifier) } } location factory: :ci_reports_security_locations_sast - metadata_version 'sast:1.0' - name 'Cipher with no integrity' - report_type :sast + metadata_version { 'sast:1.0' } + name { 'Cipher with no integrity' } + report_type { :sast } raw_metadata do { description: "The cipher does not provide data integrity update 1", @@ -29,7 +29,7 @@ }.to_json end scanner factory: :ci_reports_security_scanner - severity :high + severity { :high } sequence(:uuid) { generate(:vulnerability_occurrence_uuid) } skip_create diff --git a/ee/spec/factories/ci/reports/security/reports.rb b/ee/spec/factories/ci/reports/security/reports.rb index c9ab9354fe77cb1a8ff0f18505e4829d4827ff9a..c1a981d8def7a8afbdb59738caf39f94ad51612c 100644 --- a/ee/spec/factories/ci/reports/security/reports.rb +++ b/ee/spec/factories/ci/reports/security/reports.rb @@ -2,13 +2,13 @@ FactoryBot.define do factory :ci_reports_security_report, class: ::Gitlab::Ci::Reports::Security::Report do - type :sast + type { :sast } commit_sha { Digest::SHA1.hexdigest(SecureRandom.hex) } transient do - occurrences [] - scanners [] - identifiers [] + occurrences { [] } + scanners { [] } + identifiers { [] } end after :build do |report, evaluator| diff --git a/ee/spec/factories/ci/reports/security/scanners.rb b/ee/spec/factories/ci/reports/security/scanners.rb index 23c292bed235339c37f31e51060170f1f5ff5104..7b5ac6d3798cdb7b7f0b396b7bc8d1ec0aeae770 100644 --- a/ee/spec/factories/ci/reports/security/scanners.rb +++ b/ee/spec/factories/ci/reports/security/scanners.rb @@ -2,8 +2,8 @@ FactoryBot.define do factory :ci_reports_security_scanner, class: ::Gitlab::Ci::Reports::Security::Scanner do - external_id 'find_sec_bugs' - name 'Find Security Bugs' + external_id { 'find_sec_bugs' } + name { 'Find Security Bugs' } skip_create diff --git a/ee/spec/factories/dependencies.rb b/ee/spec/factories/dependencies.rb index 5c3c655edb67f144c37012b8c8856781cf57a727..8d253165f0899071b8ac842487b41869b7abdc47 100644 --- a/ee/spec/factories/dependencies.rb +++ b/ee/spec/factories/dependencies.rb @@ -2,9 +2,9 @@ FactoryBot.define do factory :dependency, class: Hash do - name 'nokogiri' - packager 'Ruby (Bundler)' - version '1.8.0' + name { 'nokogiri' } + packager { 'Ruby (Bundler)' } + version { '1.8.0' } licenses { [] } location do { diff --git a/ee/spec/factories/dependency_proxy.rb b/ee/spec/factories/dependency_proxy.rb index 4ba16fe32bd78dcea844b6ac4dc61ac6c6e4b22f..0cf80dd472f2d54367f564cad24c6afdf36c0c9d 100644 --- a/ee/spec/factories/dependency_proxy.rb +++ b/ee/spec/factories/dependency_proxy.rb @@ -3,6 +3,6 @@ factory :dependency_proxy_blob, class: DependencyProxy::Blob do group file { fixture_file_upload('ee/spec/fixtures/dependency_proxy/a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4.gz') } - file_name 'a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4.gz' + file_name { 'a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4.gz' } end end diff --git a/ee/spec/factories/design_management/designs.rb b/ee/spec/factories/design_management/designs.rb index 6c9c22fe6fcfb70e3f8255e330900f9a8ccc2858..593371b76637d8b14c1b8b6f10dbf3a73eaa4b46 100644 --- a/ee/spec/factories/design_management/designs.rb +++ b/ee/spec/factories/design_management/designs.rb @@ -38,7 +38,7 @@ with_file transient do - file Gitlab::Git::LfsPointerFile.new('').pointer + file { Gitlab::Git::LfsPointerFile.new('').pointer } end end @@ -46,8 +46,8 @@ # want to pay for gitlay calls. trait :with_versions do transient do - deleted false - versions_count 1 + deleted { false } + versions_count { 1 } sequence(:file) { |n| "some-file-content-#{n}" } end @@ -67,9 +67,9 @@ # with correctly made commits in the repository and files that can be retrieved. trait :with_file do transient do - deleted false - versions_count 1 - file File.join(Rails.root, 'spec/fixtures/dk.png') + deleted { false } + versions_count { 1 } + file { File.join(Rails.root, 'spec/fixtures/dk.png') } end after :create do |design, evaluator| diff --git a/ee/spec/factories/design_management/versions.rb b/ee/spec/factories/design_management/versions.rb index c4611f1f1b74f9ca9bb84ce0d072a8dcbb674b79..a69532b09f1763745d189deceeb3258a65c758ea 100644 --- a/ee/spec/factories/design_management/versions.rb +++ b/ee/spec/factories/design_management/versions.rb @@ -6,15 +6,15 @@ issue { designs.first&.issue || create(:issue) } transient do - designs_count 1 - created_designs [] - modified_designs [] - deleted_designs [] + designs_count { 1 } + created_designs { [] } + modified_designs { [] } + deleted_designs { [] } end # Warning: this will intentionally result in an invalid version! trait :empty do - designs_count 0 + designs_count { 0 } end after(:build) do |version, evaluator| @@ -62,7 +62,7 @@ trait :committed do transient do author { create(:user) } - file File.join(Rails.root, 'spec/fixtures/dk.png') + file { File.join(Rails.root, 'spec/fixtures/dk.png') } end after :create do |version, evaluator| diff --git a/ee/spec/factories/doorkeeper.rb b/ee/spec/factories/doorkeeper.rb index d99e4cd03b6f915868b494504626c5609f8171ab..324747618e3216e54f9fcbfa880f7a89160bcee9 100644 --- a/ee/spec/factories/doorkeeper.rb +++ b/ee/spec/factories/doorkeeper.rb @@ -4,9 +4,9 @@ factory :doorkeeper_access_grant, class: Doorkeeper::AccessGrant do sequence(:resource_owner_id) { |n| n } association :application, factory: :doorkeeper_application - redirect_uri 'https://app.com/callback' - expires_in 100 - scopes 'public write' + redirect_uri { 'https://app.com/callback' } + expires_in { 100 } + scopes { 'public write' } end factory :doorkeeper_access_token, class: Doorkeeper::AccessToken do @@ -15,12 +15,12 @@ expires_in { 2.hours } factory :clientless_access_token do - application nil + application { nil } end end factory :doorkeeper_application, class: Doorkeeper::Application do sequence(:name) { |n| "Application #{n}" } - redirect_uri 'https://app.com/callback' + redirect_uri { 'https://app.com/callback' } end end diff --git a/ee/spec/factories/draft_note.rb b/ee/spec/factories/draft_note.rb index 5be6d883a1ecc1376960a5fd89e17021fd82ac51..24563dc92b72d440b0972ea440cfe02d7a991ef8 100644 --- a/ee/spec/factories/draft_note.rb +++ b/ee/spec/factories/draft_note.rb @@ -7,7 +7,7 @@ factory :draft_note_on_text_diff do transient do - line_number 14 + line_number { 14 } diff_refs { merge_request.try(:diff_refs) } end diff --git a/ee/spec/factories/epics.rb b/ee/spec/factories/epics.rb index e8e26df222bbc3eba6dc6e43f42cb7a701e3e639..d9d5754d9c14cdbd59818b974838a51d9d84a5cc 100644 --- a/ee/spec/factories/epics.rb +++ b/ee/spec/factories/epics.rb @@ -9,24 +9,24 @@ trait :use_fixed_dates do start_date { Date.new(2010, 1, 1) } start_date_fixed { Date.new(2010, 1, 1) } - start_date_is_fixed true + start_date_is_fixed { true } end_date { Date.new(2010, 1, 3) } due_date_fixed { Date.new(2010, 1, 3) } - due_date_is_fixed true + due_date_is_fixed { true } end trait :opened do - state :opened + state { :opened } end trait :closed do - state :closed + state { :closed } closed_at { Time.now } end factory :labeled_epic do transient do - labels [] + labels { [] } end after(:create) do |epic, evaluator| diff --git a/ee/spec/factories/geo/container_repository_registry.rb b/ee/spec/factories/geo/container_repository_registry.rb index 64f6c8eb6b0ffd07e7082371b0ea0fd5696f85ad..bf570303a299562c45b6bf616f81295396d0bb29 100644 --- a/ee/spec/factories/geo/container_repository_registry.rb +++ b/ee/spec/factories/geo/container_repository_registry.rb @@ -3,30 +3,30 @@ FactoryBot.define do factory :container_repository_registry, class: Geo::ContainerRepositoryRegistry do container_repository - last_sync_failure nil - last_synced_at nil - state :pending + last_sync_failure { nil } + last_synced_at { nil } + state { :pending } trait :started do - state :started + state { :started } end trait :synced do - state :synced + state { :synced } last_synced_at { 5.days.ago } end trait :sync_failed do - state :failed + state { :failed } last_synced_at { 1.day.ago } - retry_count 2 - last_sync_failure 'Random error' + retry_count { 2 } + last_sync_failure { 'Random error' } end trait :sync_started do - state :started + state { :started } last_synced_at { 1.day.ago } - retry_count 0 + retry_count { 0 } end end end diff --git a/ee/spec/factories/geo/event_log.rb b/ee/spec/factories/geo/event_log.rb index 89cd4d70d79d21cdb4939e8ea40a37765423f7d3..269a0e646fa9f0fd08bc20ae95f4dbb7f9f25a9e 100644 --- a/ee/spec/factories/geo/event_log.rb +++ b/ee/spec/factories/geo/event_log.rb @@ -63,9 +63,9 @@ factory :geo_repository_updated_event, class: Geo::RepositoryUpdatedEvent do project - source 0 - branches_affected 0 - tags_affected 0 + source { 0 } + branches_affected { 0 } + tags_affected { 0 } end factory :geo_repository_deleted_event, class: Geo::RepositoryDeletedEvent do diff --git a/ee/spec/factories/geo/file_registry.rb b/ee/spec/factories/geo/file_registry.rb index 9db49bb0f7bce99b016eb3a62a41b73c51a36484..304892b56eaf0bc78579f93be52819d925b7a27c 100644 --- a/ee/spec/factories/geo/file_registry.rb +++ b/ee/spec/factories/geo/file_registry.rb @@ -3,23 +3,23 @@ FactoryBot.define do factory :geo_file_registry, class: Geo::FileRegistry do sequence(:file_id) - file_type :file - success true + file_type { :file } + success { true } - trait(:attachment) { file_type :attachment } - trait(:avatar) { file_type :avatar } - trait(:file) { file_type :file } - trait(:lfs) { file_type :lfs } - trait(:namespace_file) { file_type :namespace_file } - trait(:personal_file) { file_type :personal_file } - trait(:favicon) { file_type :favicon } - trait(:import_export) { file_type :import_export } + trait(:attachment) { file_type { :attachment } } + trait(:avatar) { file_type { :avatar } } + trait(:file) { file_type { :file } } + trait(:lfs) { file_type { :lfs } } + trait(:namespace_file) { file_type { :namespace_file } } + trait(:personal_file) { file_type { :personal_file } } + trait(:favicon) { file_type { :favicon } } + trait(:import_export) { file_type { :import_export } } factory :geo_upload_registry, class: Geo::UploadRegistry trait :failed do - success false - retry_count 1 + success { false } + retry_count { 1 } end trait :with_file do diff --git a/ee/spec/factories/geo/job_artifact_registry.rb b/ee/spec/factories/geo/job_artifact_registry.rb index 67e4690d5bd90a344b144bf26720f8e670a53434..1aacdd1926b56fc4870760c0adc6476b71a3626e 100644 --- a/ee/spec/factories/geo/job_artifact_registry.rb +++ b/ee/spec/factories/geo/job_artifact_registry.rb @@ -3,7 +3,7 @@ FactoryBot.define do factory :geo_job_artifact_registry, class: Geo::JobArtifactRegistry do sequence(:artifact_id) - success true + success { true } trait :with_artifact do transient do diff --git a/ee/spec/factories/geo/project_registry.rb b/ee/spec/factories/geo/project_registry.rb index e352d86be1eb7b9426f3fdcb1dcef0a6467a0652..1e0eea71fa7c0122caed3dafb4230198718bcedc 100644 --- a/ee/spec/factories/geo/project_registry.rb +++ b/ee/spec/factories/geo/project_registry.rb @@ -3,26 +3,26 @@ FactoryBot.define do factory :geo_project_registry, class: Geo::ProjectRegistry do project - last_repository_synced_at nil - last_repository_successful_sync_at nil - last_wiki_synced_at nil - last_wiki_successful_sync_at nil - resync_repository true - resync_wiki true + last_repository_synced_at { nil } + last_repository_successful_sync_at { nil } + last_wiki_synced_at { nil } + last_wiki_successful_sync_at { nil } + resync_repository { true } + resync_wiki { true } trait :dirty do - resync_repository true - resync_wiki true + resync_repository { true } + resync_wiki { true } end trait :repository_dirty do - resync_repository true - resync_wiki false + resync_repository { true } + resync_wiki { false } end trait :wiki_dirty do - resync_repository false - resync_wiki true + resync_repository { false } + resync_wiki { true } end trait :synced do @@ -30,27 +30,27 @@ last_repository_successful_sync_at { 5.days.ago } last_wiki_synced_at { 5.days.ago } last_wiki_successful_sync_at { 5.days.ago } - resync_repository false - resync_wiki false + resync_repository { false } + resync_wiki { false } end trait :sync_failed do last_repository_synced_at { 5.days.ago } - last_repository_successful_sync_at nil + last_repository_successful_sync_at { nil } last_wiki_synced_at { 5.days.ago } - last_wiki_successful_sync_at nil - resync_repository true - resync_wiki true - repository_retry_count 1 - wiki_retry_count 1 + last_wiki_successful_sync_at { nil } + resync_repository { true } + resync_wiki { true } + repository_retry_count { 1 } + wiki_retry_count { 1 } end trait :repository_sync_failed do sync_failed last_wiki_successful_sync_at { 5.days.ago } - resync_wiki false - wiki_retry_count nil + resync_wiki { false } + wiki_retry_count { nil } end trait :existing_repository_sync_failed do @@ -61,70 +61,70 @@ trait :repository_syncing do repository_sync_failed - repository_retry_count 0 + repository_retry_count { 0 } end trait :wiki_sync_failed do sync_failed last_repository_successful_sync_at { 5.days.ago } - resync_repository false - repository_retry_count nil + resync_repository { false } + repository_retry_count { nil } end trait :wiki_syncing do wiki_sync_failed - wiki_retry_count 0 + wiki_retry_count { 0 } end trait :repository_verified do - repository_verification_checksum_sha 'f079a831cab27bcda7d81cd9b48296d0c3dd92ee' - last_repository_verification_failure nil + repository_verification_checksum_sha { 'f079a831cab27bcda7d81cd9b48296d0c3dd92ee' } + last_repository_verification_failure { nil } end trait :repository_verification_failed do - repository_verification_checksum_sha nil - last_repository_verification_failure 'Repository checksum did not match' + repository_verification_checksum_sha { nil } + last_repository_verification_failure { 'Repository checksum did not match' } end trait :repository_checksum_mismatch do - last_repository_verification_failure 'Repository checksum mismatch' - repository_checksum_mismatch true + last_repository_verification_failure { 'Repository checksum mismatch' } + repository_checksum_mismatch { true } end trait :repository_verification_outdated do - repository_verification_checksum_sha nil - last_repository_verification_failure nil + repository_verification_checksum_sha { nil } + last_repository_verification_failure { nil } end trait :repository_retrying_verification do - repository_verification_retry_count 1 - resync_repository true + repository_verification_retry_count { 1 } + resync_repository { true } end trait :wiki_verified do - wiki_verification_checksum_sha 'e079a831cab27bcda7d81cd9b48296d0c3dd92ef' - last_wiki_verification_failure nil + wiki_verification_checksum_sha { 'e079a831cab27bcda7d81cd9b48296d0c3dd92ef' } + last_wiki_verification_failure { nil } end trait :wiki_verification_failed do - wiki_verification_checksum_sha nil - last_wiki_verification_failure 'Wiki checksum did not match' + wiki_verification_checksum_sha { nil } + last_wiki_verification_failure { 'Wiki checksum did not match' } end trait :wiki_checksum_mismatch do - last_wiki_verification_failure 'Wiki checksum mismatch' - wiki_checksum_mismatch true + last_wiki_verification_failure { 'Wiki checksum mismatch' } + wiki_checksum_mismatch { true } end trait :wiki_verification_outdated do - wiki_verification_checksum_sha nil - last_wiki_verification_failure nil + wiki_verification_checksum_sha { nil } + last_wiki_verification_failure { nil } end trait :wiki_retrying_verification do - wiki_verification_retry_count 1 - resync_wiki true + wiki_verification_retry_count { 1 } + resync_wiki { true } end end end diff --git a/ee/spec/factories/geo_node_statuses.rb b/ee/spec/factories/geo_node_statuses.rb index 7375ecf6185a74e3b26999fc4b12c941146f2965..da260c66ce8e3accffda578ff76ffcf3d4690418 100644 --- a/ee/spec/factories/geo_node_statuses.rb +++ b/ee/spec/factories/geo_node_statuses.rb @@ -6,43 +6,43 @@ storage_shards { StorageShard.all } trait :healthy do - status_message nil - attachments_count 329 - attachments_failed_count 13 - attachments_synced_count 141 - attachments_synced_missing_on_primary_count 89 - lfs_objects_count 256 - lfs_objects_failed_count 12 - lfs_objects_synced_count 123 - lfs_objects_synced_missing_on_primary_count 90 - job_artifacts_count 580 - job_artifacts_failed_count 3 - job_artifacts_synced_count 577 - job_artifacts_synced_missing_on_primary_count 91 - container_repositories_count 400 - container_repositories_failed_count 3 - container_repositories_synced_count 200 - projects_count 10 - repositories_synced_count 5 - repositories_failed_count 0 - wikis_synced_count 4 - wikis_failed_count 1 - repositories_checksummed_count 600 - repositories_checksum_failed_count 120 - wikis_checksummed_count 585 - wikis_checksum_failed_count 55 - repositories_verified_count 501 - repositories_verification_failed_count 100 - repositories_checksum_mismatch_count 15 - wikis_verified_count 499 - wikis_verification_failed_count 99 - wikis_checksum_mismatch_count 10 - repositories_retrying_verification_count 25 - wikis_retrying_verification_count 3 - repositories_checked_failed_count 1 - last_event_id 2 + status_message { nil } + attachments_count { 329 } + attachments_failed_count { 13 } + attachments_synced_count { 141 } + attachments_synced_missing_on_primary_count { 89 } + lfs_objects_count { 256 } + lfs_objects_failed_count { 12 } + lfs_objects_synced_count { 123 } + lfs_objects_synced_missing_on_primary_count { 90 } + job_artifacts_count { 580 } + job_artifacts_failed_count { 3 } + job_artifacts_synced_count { 577 } + job_artifacts_synced_missing_on_primary_count { 91 } + container_repositories_count { 400 } + container_repositories_failed_count { 3 } + container_repositories_synced_count { 200 } + projects_count { 10 } + repositories_synced_count { 5 } + repositories_failed_count { 0 } + wikis_synced_count { 4 } + wikis_failed_count { 1 } + repositories_checksummed_count { 600 } + repositories_checksum_failed_count { 120 } + wikis_checksummed_count { 585 } + wikis_checksum_failed_count { 55 } + repositories_verified_count { 501 } + repositories_verification_failed_count { 100 } + repositories_checksum_mismatch_count { 15 } + wikis_verified_count { 499 } + wikis_verification_failed_count { 99 } + wikis_checksum_mismatch_count { 10 } + repositories_retrying_verification_count { 25 } + wikis_retrying_verification_count { 3 } + repositories_checked_failed_count { 1 } + last_event_id { 2 } last_event_timestamp { Time.now.to_i } - cursor_last_event_id 1 + cursor_last_event_id { 1 } cursor_last_event_timestamp { Time.now.to_i } last_successful_status_check_timestamp { 2.minutes.ago } version { Gitlab::VERSION } @@ -50,7 +50,7 @@ end trait :unhealthy do - status_message "Could not connect to Geo node - HTTP Status Code: 401 Unauthorized\nTest" + status_message { "Could not connect to Geo node - HTTP Status Code: 401 Unauthorized\nTest" } end end end diff --git a/ee/spec/factories/geo_nodes.rb b/ee/spec/factories/geo_nodes.rb index 580fd5a8bf7b594d03fd213944c792f44334bb22..cc5628e740da79f64ad81ea59ebe18f8a835e320 100644 --- a/ee/spec/factories/geo_nodes.rb +++ b/ee/spec/factories/geo_nodes.rb @@ -10,17 +10,17 @@ "node_name_#{n}" end - primary false - sync_object_storage true + primary { false } + sync_object_storage { true } trait :primary do - primary true - minimum_reverification_interval 7 - sync_object_storage false + primary { true } + minimum_reverification_interval { 7 } + sync_object_storage { false } end trait :local_storage_only do - sync_object_storage false + sync_object_storage { false } end end end diff --git a/ee/spec/factories/gitlab_subscriptions.rb b/ee/spec/factories/gitlab_subscriptions.rb index 110637daa4bd24d99b2efaa4f15e7bf981c4e18d..f7556bd9aeceaf6d9fa5d1b52e0c9795ed30c897 100644 --- a/ee/spec/factories/gitlab_subscriptions.rb +++ b/ee/spec/factories/gitlab_subscriptions.rb @@ -4,13 +4,13 @@ factory :gitlab_subscription do namespace association :hosted_plan, factory: :gold_plan - seats 10 + seats { 10 } start_date { Date.today } end_date { Date.today.advance(years: 1) } - trial false + trial { false } trait :free do - hosted_plan_id nil + hosted_plan_id { nil } end trait :early_adopter do diff --git a/ee/spec/factories/group_saml_identities.rb b/ee/spec/factories/group_saml_identities.rb index 6d425da743c42245334bc963d810f3b64da0c6d1..000c8cf74d087db8b4a4ef3a3def3e6cb28bbaf8 100644 --- a/ee/spec/factories/group_saml_identities.rb +++ b/ee/spec/factories/group_saml_identities.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true FactoryBot.define do factory :group_saml_identity, class: Identity, parent: :identity do - provider 'group_saml' + provider { 'group_saml' } extern_uid { generate(:username) } saml_provider user diff --git a/ee/spec/factories/groups.rb b/ee/spec/factories/groups.rb index 3889cd78c200de281ec1f868500eb2dc7eefcf8f..7b4c28481808394253340d8cd538863d5339ec31 100644 --- a/ee/spec/factories/groups.rb +++ b/ee/spec/factories/groups.rb @@ -9,9 +9,9 @@ factory :group_with_ldap, parent: :group do transient do - cn 'group1' - group_access Gitlab::Access::GUEST - provider 'ldapmain' + cn { 'group1' } + group_access { Gitlab::Access::GUEST } + provider { 'ldapmain' } end factory :group_with_ldap_group_link do diff --git a/ee/spec/factories/import_states.rb b/ee/spec/factories/import_states.rb index b41e7854e330e67de10d8943dfff7b0720d30303..756f8b30cde03bf31cb3c01289fccbcdc337cc4d 100644 --- a/ee/spec/factories/import_states.rb +++ b/ee/spec/factories/import_states.rb @@ -4,7 +4,7 @@ factory :import_state do trait :mirror do transient do - mirror true + mirror { true } import_url { generate(:url) } end @@ -32,7 +32,7 @@ end trait :hard_failed do - status :failed + status { :failed } retry_count { Gitlab::Mirror::MAX_RETRY + 1 } last_update_at { Time.now - 1.minute } end diff --git a/ee/spec/factories/incident_management/project_incident_management_settings.rb b/ee/spec/factories/incident_management/project_incident_management_settings.rb index 78c530e298018378d70d2ed4c1e025554da3de74..80498fb568921a2b7bfd79960f418f48d4a9d35e 100644 --- a/ee/spec/factories/incident_management/project_incident_management_settings.rb +++ b/ee/spec/factories/incident_management/project_incident_management_settings.rb @@ -3,8 +3,8 @@ FactoryBot.define do factory :project_incident_management_setting, class: IncidentManagement::ProjectIncidentManagementSetting do project - create_issue false - issue_template_key nil - send_email false + create_issue { false } + issue_template_key { nil } + send_email { false } end end diff --git a/ee/spec/factories/ip_restrictions.rb b/ee/spec/factories/ip_restrictions.rb index 04d3c4a14fac1f9c630bdd97bac134f3ce074629..98768403c5433851b5a10680a6a92ac621dd5936 100644 --- a/ee/spec/factories/ip_restrictions.rb +++ b/ee/spec/factories/ip_restrictions.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :ip_restriction do - range '192.168.0.0/24' + range { '192.168.0.0/24' } group end end diff --git a/ee/spec/factories/jira_connect_installation.rb b/ee/spec/factories/jira_connect_installation.rb index f8e7361b763eb8f4d605a3e068e86940bf56ad66..2e3202c662cf3d749f0646e87d0454f759ab79b4 100644 --- a/ee/spec/factories/jira_connect_installation.rb +++ b/ee/spec/factories/jira_connect_installation.rb @@ -3,7 +3,7 @@ FactoryBot.define do factory :jira_connect_installation do sequence(:client_key) { |n| "atlassian-client-key-#{n}" } - shared_secret 'jrNarHaRYaumMvfV3UnYpwt8' - base_url 'https://sample.atlassian.net' + shared_secret { 'jrNarHaRYaumMvfV3UnYpwt8' } + base_url { 'https://sample.atlassian.net' } end end diff --git a/ee/spec/factories/ldap_group_links.rb b/ee/spec/factories/ldap_group_links.rb index f56044a653910be98b45417f602e905b0187cdbc..49c7aa62dd74d49ac59bd950134a4e89e4f95a60 100644 --- a/ee/spec/factories/ldap_group_links.rb +++ b/ee/spec/factories/ldap_group_links.rb @@ -2,9 +2,9 @@ FactoryBot.define do factory :ldap_group_link do - cn 'group1' - group_access Gitlab::Access::GUEST - provider 'ldapmain' + cn { 'group1' } + group_access { Gitlab::Access::GUEST } + provider { 'ldapmain' } group end end diff --git a/ee/spec/factories/licenses.rb b/ee/spec/factories/licenses.rb index 3088f916e91adb4530b259e32dcc8157bcb818d1..3205c9fe7f2c1be4211cb436c4308bcaf783234a 100644 --- a/ee/spec/factories/licenses.rb +++ b/ee/spec/factories/licenses.rb @@ -5,7 +5,7 @@ skip_create trait :trial do - block_changes_at nil + block_changes_at { nil } restrictions do { trial: true } end @@ -16,7 +16,7 @@ end transient do - plan License::STARTER_PLAN + plan { License::STARTER_PLAN } end starts_at { Date.today - 1.month } @@ -42,9 +42,9 @@ factory :license do transient do - plan nil - expired false - trial false + plan { nil } + expired { false } + trial { false } end data do diff --git a/ee/spec/factories/lists.rb b/ee/spec/factories/lists.rb index 0ae3390d023b19b98702fded74af744cf911b225..fa6fe5a152b590a11fff24693d8c80a6bc6a27eb 100644 --- a/ee/spec/factories/lists.rb +++ b/ee/spec/factories/lists.rb @@ -2,15 +2,15 @@ FactoryBot.define do factory :user_list, parent: :list do - list_type :assignee - label nil + list_type { :assignee } + label { nil } user end factory :milestone_list, parent: :list do - list_type :milestone - label nil - user nil + list_type { :milestone } + label { nil } + user { nil } milestone end end diff --git a/ee/spec/factories/merge_requests.rb b/ee/spec/factories/merge_requests.rb index a4f8af491e0618a730cdb677ed419ffc6539e29c..4504cce6a0bdd1c43dd8dcd8c9ea3d78e388e491 100644 --- a/ee/spec/factories/merge_requests.rb +++ b/ee/spec/factories/merge_requests.rb @@ -13,8 +13,8 @@ train_creator { author } end - auto_merge_enabled true - auto_merge_strategy AutoMergeService::STRATEGY_MERGE_TRAIN + auto_merge_enabled { true } + auto_merge_strategy { AutoMergeService::STRATEGY_MERGE_TRAIN } merge_user { train_creator } after :create do |merge_request, evaluator| @@ -34,14 +34,14 @@ end trait :add_to_merge_train_when_pipeline_succeeds do - auto_merge_enabled true - auto_merge_strategy AutoMergeService::STRATEGY_ADD_TO_MERGE_TRAIN_WHEN_PIPELINE_SUCCEEDS + auto_merge_enabled { true } + auto_merge_strategy { AutoMergeService::STRATEGY_ADD_TO_MERGE_TRAIN_WHEN_PIPELINE_SUCCEEDS } merge_user { author } end trait :with_productivity_metrics do transient do - metrics_data {} + metrics_data { {} } end after :build do |mr, evaluator| @@ -53,8 +53,8 @@ end transient do - approval_groups [] - approval_users [] + approval_groups { [] } + approval_users { [] } end after :create do |merge_request, evaluator| diff --git a/ee/spec/factories/merge_trains.rb b/ee/spec/factories/merge_trains.rb index 179ff63e31a83075c686e5ebe992b7501b665f79..23e674e62b0244a31a15d4b307e909835f7a40be 100644 --- a/ee/spec/factories/merge_trains.rb +++ b/ee/spec/factories/merge_trains.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :merge_train do - target_branch 'master' + target_branch { 'master' } target_project factory: :project merge_request user diff --git a/ee/spec/factories/namespaces.rb b/ee/spec/factories/namespaces.rb index 954134296d9d2a4daafeef25fdf03f21f0ef096f..65aa3e603717dacd5552a54839c2d57635fc8daa 100644 --- a/ee/spec/factories/namespaces.rb +++ b/ee/spec/factories/namespaces.rb @@ -3,7 +3,7 @@ FactoryBot.modify do factory :namespace do transient do - plan nil + plan { nil } end before(:create) do |namespace, evaluator| @@ -17,17 +17,17 @@ end trait :with_build_minutes_limit do - shared_runners_minutes_limit 500 + shared_runners_minutes_limit { 500 } end trait :with_not_used_build_minutes_limit do namespace_statistics factory: :namespace_statistics, shared_runners_seconds: 300.minutes.to_i - shared_runners_minutes_limit 500 + shared_runners_minutes_limit { 500 } end trait :with_used_build_minutes_limit do namespace_statistics factory: :namespace_statistics, shared_runners_seconds: 1000.minutes.to_i - shared_runners_minutes_limit 500 + shared_runners_minutes_limit { 500 } end end end diff --git a/ee/spec/factories/notes.rb b/ee/spec/factories/notes.rb index 45f60cf0f2858c3e2c2784bd35d3ee60ac09dc29..ba58a1292db9cf06e22a0b38ec339a1f71da8e28 100644 --- a/ee/spec/factories/notes.rb +++ b/ee/spec/factories/notes.rb @@ -4,7 +4,7 @@ factory :note do trait :on_epic do noteable { create(:epic) } - project nil + project { nil } end trait :with_review do diff --git a/ee/spec/factories/operations/feature_flag_scopes.rb b/ee/spec/factories/operations/feature_flag_scopes.rb index 626dc3ffecb5dc6d1c90e77925c107c1f02f6319..4769afb23a01f835a1f5b5d6c2767055ac4aafff 100644 --- a/ee/spec/factories/operations/feature_flag_scopes.rb +++ b/ee/spec/factories/operations/feature_flag_scopes.rb @@ -3,8 +3,8 @@ FactoryBot.define do factory :operations_feature_flag_scope, class: Operations::FeatureFlagScope do association :feature_flag, factory: :operations_feature_flag - active true - strategies [{ name: "default", parameters: {} }] + active { true } + strategies { [{ name: "default", parameters: {} }] } sequence(:environment_scope) { |n| "review/patch-#{n}" } end end diff --git a/ee/spec/factories/operations/feature_flags.rb b/ee/spec/factories/operations/feature_flags.rb index 60d36f1bb3667954f72eb96630e00b2d2c5b524b..1355dca5193e97bf40c2c3845d326cc1ec67e164 100644 --- a/ee/spec/factories/operations/feature_flags.rb +++ b/ee/spec/factories/operations/feature_flags.rb @@ -4,6 +4,6 @@ factory :operations_feature_flag, class: Operations::FeatureFlag do sequence(:name) { |n| "feature_flag_#{n}" } project - active true + active { true } end end diff --git a/ee/spec/factories/packages.rb b/ee/spec/factories/packages.rb index 76c180e587c7c4d1c2898ae81aa9edac80dbaaeb..c79272aeb0bd3590797aeae2aae7eb2508008c1e 100644 --- a/ee/spec/factories/packages.rb +++ b/ee/spec/factories/packages.rb @@ -2,9 +2,9 @@ FactoryBot.define do factory :package, class: Packages::Package do project - name 'my/company/app/my-app' - version '1.0-SNAPSHOT' - package_type 'maven' + name { 'my/company/app/my-app' } + version { '1.0-SNAPSHOT' } + package_type { 'maven' } factory :maven_package do maven_metadatum @@ -22,8 +22,8 @@ factory :npm_package do sequence(:name) { |n| "@#{project.root_namespace.path}/package-#{n}"} - version '1.0.0' - package_type 'npm' + version { '1.0.0' } + package_type { 'npm' } after :create do |package| create :package_file, :npm, package: package @@ -36,33 +36,33 @@ trait(:jar) do file { fixture_file_upload('ee/spec/fixtures/maven/my-app-1.0-20180724.124855-1.jar') } - file_name 'my-app-1.0-20180724.124855-1.jar' - file_sha1 '4f0bfa298744d505383fbb57c554d4f5c12d88b3' - file_type 'jar' + file_name { 'my-app-1.0-20180724.124855-1.jar' } + file_sha1 { '4f0bfa298744d505383fbb57c554d4f5c12d88b3' } + file_type { 'jar' } size { 100.kilobytes } end trait(:pom) do file { fixture_file_upload('ee/spec/fixtures/maven/my-app-1.0-20180724.124855-1.pom') } - file_name 'my-app-1.0-20180724.124855-1.pom' - file_sha1 '19c975abd49e5102ca6c74a619f21e0cf0351c57' - file_type 'pom' + file_name { 'my-app-1.0-20180724.124855-1.pom' } + file_sha1 { '19c975abd49e5102ca6c74a619f21e0cf0351c57' } + file_type { 'pom' } size { 200.kilobytes } end trait(:xml) do file { fixture_file_upload('ee/spec/fixtures/maven/maven-metadata.xml') } - file_name 'maven-metadata.xml' - file_sha1 '42b1bdc80de64953b6876f5a8c644f20204011b0' - file_type 'xml' + file_name { 'maven-metadata.xml' } + file_sha1 { '42b1bdc80de64953b6876f5a8c644f20204011b0' } + file_type { 'xml' } size { 300.kilobytes } end trait(:npm) do file { fixture_file_upload('ee/spec/fixtures/npm/foo-1.0.1.tgz') } - file_name 'foo-1.0.1.tgz' - file_sha1 'be93151dc23ac34a82752444556fe79b32c7a1ad' - file_type 'tgz' + file_name { 'foo-1.0.1.tgz' } + file_sha1 { 'be93151dc23ac34a82752444556fe79b32c7a1ad' } + file_type { 'tgz' } size { 400.kilobytes } end @@ -73,9 +73,9 @@ factory :maven_metadatum, class: Packages::MavenMetadatum do package - path 'my/company/app/my-app/1.0-SNAPSHOT' - app_group 'my.company.app' - app_name 'my-app' - app_version '1.0-SNAPSHOT' + path { 'my/company/app/my-app/1.0-SNAPSHOT' } + app_group { 'my.company.app' } + app_name { 'my-app' } + app_version { '1.0-SNAPSHOT' } end end diff --git a/ee/spec/factories/plans.rb b/ee/spec/factories/plans.rb index 467fcaadbf461fb29ef84ad49e6379a99f0f45a5..3bb8dc61263e5ebc6e7c28d4f2ffc1d8da8a834a 100644 --- a/ee/spec/factories/plans.rb +++ b/ee/spec/factories/plans.rb @@ -4,13 +4,13 @@ FactoryBot.define do factory :plan do factory :free_plan do - name EE::Namespace::FREE_PLAN + name { EE::Namespace::FREE_PLAN } title { name.titleize } end EE::Namespace::PLANS.each do |plan| factory :"#{plan}_plan" do - name plan + name { plan } title { name.titleize } end end diff --git a/ee/spec/factories/project_alerting_settings.rb b/ee/spec/factories/project_alerting_settings.rb index 62ee2076baab63add9984d952474c14e9b9800bc..ccec6841158e68c09ca0059a90ee511f7efea0b5 100644 --- a/ee/spec/factories/project_alerting_settings.rb +++ b/ee/spec/factories/project_alerting_settings.rb @@ -3,6 +3,6 @@ FactoryBot.define do factory :project_alerting_setting, class: Alerting::ProjectAlertingSetting do project - token 'access_token_123' + token { 'access_token_123' } end end diff --git a/ee/spec/factories/project_repository_states.rb b/ee/spec/factories/project_repository_states.rb index 1e02bcac9eebf48c13034abc5e6d076ae4e1cf71..a25229903b3abafa040c2bbcd4da24359c8a70f5 100644 --- a/ee/spec/factories/project_repository_states.rb +++ b/ee/spec/factories/project_repository_states.rb @@ -5,47 +5,47 @@ project trait :repository_failed do - repository_verification_checksum nil + repository_verification_checksum { nil } last_repository_verification_ran_at { Time.now } - last_repository_verification_failure 'Could not calculate the checksum' - repository_retry_count 1 + last_repository_verification_failure { 'Could not calculate the checksum' } + repository_retry_count { 1 } repository_retry_at { 5.minutes.ago } end trait :repository_outdated do - repository_verification_checksum nil + repository_verification_checksum { nil } last_repository_verification_ran_at { 1.day.ago } - last_repository_verification_failure nil + last_repository_verification_failure { nil } end trait :repository_verified do - repository_verification_checksum 'f079a831cab27bcda7d81cd9b48296d0c3dd92ee' + repository_verification_checksum { 'f079a831cab27bcda7d81cd9b48296d0c3dd92ee' } last_repository_verification_ran_at { 1.day.ago } - last_repository_verification_failure nil - repository_retry_count nil - repository_retry_at nil + last_repository_verification_failure { nil } + repository_retry_count { nil } + repository_retry_at { nil } end trait :wiki_failed do - wiki_verification_checksum nil + wiki_verification_checksum { nil } last_wiki_verification_ran_at { Time.now } - last_wiki_verification_failure 'Could not calculate the checksum' - wiki_retry_count 1 + last_wiki_verification_failure { 'Could not calculate the checksum' } + wiki_retry_count { 1 } wiki_retry_at { 5.minutes.ago } end trait :wiki_outdated do - wiki_verification_checksum nil + wiki_verification_checksum { nil } last_wiki_verification_ran_at { 1.day.ago } - last_wiki_verification_failure nil + last_wiki_verification_failure { nil } end trait :wiki_verified do - wiki_verification_checksum 'e079a831cab27bcda7d81cd9b48296d0c3dd92ef' + wiki_verification_checksum { 'e079a831cab27bcda7d81cd9b48296d0c3dd92ef' } last_wiki_verification_ran_at { 1.day.ago } - last_wiki_verification_failure nil - wiki_retry_count nil - wiki_retry_at nil + last_wiki_verification_failure { nil } + wiki_retry_count { nil } + wiki_retry_at { nil } end end end diff --git a/ee/spec/factories/project_tracing_settings.rb b/ee/spec/factories/project_tracing_settings.rb index befc48b32a5f4b52a35cdde06172cbf538dc593f..05c1529c18ee5846c73eefdb82c69fb3fad260b6 100644 --- a/ee/spec/factories/project_tracing_settings.rb +++ b/ee/spec/factories/project_tracing_settings.rb @@ -3,6 +3,6 @@ FactoryBot.define do factory :project_tracing_setting do project - external_url 'https://example.com' + external_url { 'https://example.com' } end end diff --git a/ee/spec/factories/projects.rb b/ee/spec/factories/projects.rb index 904a4d2832a9e9ee8bf2a61c6d81f1ef7dbce8a0..435491ed937292b89bbfc96396314a9dc2a92661 100644 --- a/ee/spec/factories/projects.rb +++ b/ee/spec/factories/projects.rb @@ -3,9 +3,9 @@ FactoryBot.modify do factory :project do transient do - last_update_at nil - last_successful_update_at nil - retry_count 0 + last_update_at { nil } + last_successful_update_at { nil } + retry_count { 0 } end after(:create) do |project, evaluator| @@ -37,23 +37,23 @@ end trait :import_none do - import_status :none + import_status { :none } end trait :import_hard_failed do - import_status :failed + import_status { :failed } last_update_at { Time.now - 1.minute } retry_count { Gitlab::Mirror::MAX_RETRY + 1 } end trait :disabled_mirror do - mirror false + mirror { false } import_url { generate(:url) } mirror_user_id { creator_id } end trait :mirror do - mirror true + mirror { true } import_url { generate(:url) } mirror_user_id { creator_id } end @@ -63,7 +63,7 @@ end trait :requiring_code_owner_approval do - merge_requests_require_code_owner_approval true + merge_requests_require_code_owner_approval { true } end trait :jira_dvcs_cloud do @@ -79,7 +79,7 @@ end trait :service_desk_disabled do - service_desk_enabled nil + service_desk_enabled { nil } end end end diff --git a/ee/spec/factories/prometheus_alert.rb b/ee/spec/factories/prometheus_alert.rb index 2d59313ba901dc8861ff68b585f6da57af1fbe7b..a9fede9efca8360431a9edde96fad00fc3d5127f 100644 --- a/ee/spec/factories/prometheus_alert.rb +++ b/ee/spec/factories/prometheus_alert.rb @@ -3,8 +3,8 @@ FactoryBot.define do factory :prometheus_alert do project - operator :gt - threshold 1 + operator { :gt } + threshold { 1 } environment do |alert| build(:environment, project: alert.project) diff --git a/ee/spec/factories/prometheus_alert_event.rb b/ee/spec/factories/prometheus_alert_event.rb index cb8683f08cc9fd3c7e01132b5c738d6152f91b4a..281fbacabe2b6e45171ae1ef4bb636e09d955755 100644 --- a/ee/spec/factories/prometheus_alert_event.rb +++ b/ee/spec/factories/prometheus_alert_event.rb @@ -11,12 +11,12 @@ trait :resolved do status { PrometheusAlertEvent.status_value_for(:resolved) } ended_at { Time.now } - payload_key nil + payload_key { nil } end trait :none do - status nil - started_at nil + status { nil } + started_at { nil } end end end diff --git a/ee/spec/factories/protected_branches.rb b/ee/spec/factories/protected_branches.rb index a643ada99be2393810b82989f8bb928e85ed7ed8..bebfb1ca0133a783a0a72b7b855e305466453262 100644 --- a/ee/spec/factories/protected_branches.rb +++ b/ee/spec/factories/protected_branches.rb @@ -3,12 +3,12 @@ FactoryBot.modify do factory :protected_branch do transient do - authorize_user_to_push nil - authorize_user_to_merge nil - authorize_user_to_unprotect nil - authorize_group_to_push nil - authorize_group_to_merge nil - authorize_group_to_unprotect nil + authorize_user_to_push { nil } + authorize_user_to_merge { nil } + authorize_user_to_unprotect { nil } + authorize_group_to_push { nil } + authorize_group_to_merge { nil } + authorize_group_to_unprotect { nil } end after(:build) do |protected_branch, evaluator| diff --git a/ee/spec/factories/protected_branches/merge_access_levels.rb b/ee/spec/factories/protected_branches/merge_access_levels.rb index ff57853214951705e364dcf9a1954de91c3d689c..f4eb72e20045933128a3509b188aaaeb70a34540 100644 --- a/ee/spec/factories/protected_branches/merge_access_levels.rb +++ b/ee/spec/factories/protected_branches/merge_access_levels.rb @@ -2,8 +2,8 @@ FactoryBot.define do factory :protected_branch_merge_access_level, class: ProtectedBranch::MergeAccessLevel do - user nil - group nil + user { nil } + group { nil } protected_branch access_level { Gitlab::Access::DEVELOPER } end diff --git a/ee/spec/factories/protected_branches/push_access_levels.rb b/ee/spec/factories/protected_branches/push_access_levels.rb index a357aedc36129c70cb7a158b8813bea6379c6a18..f5e50f75d2b7a7db1017a25fff1acae9cdcdaa3e 100644 --- a/ee/spec/factories/protected_branches/push_access_levels.rb +++ b/ee/spec/factories/protected_branches/push_access_levels.rb @@ -2,8 +2,8 @@ FactoryBot.define do factory :protected_branch_push_access_level, class: ProtectedBranch::PushAccessLevel do - user nil - group nil + user { nil } + group { nil } protected_branch access_level { Gitlab::Access::DEVELOPER } end diff --git a/ee/spec/factories/protected_branches/unprotect_access_levels.rb b/ee/spec/factories/protected_branches/unprotect_access_levels.rb index 3b3cecf0ba50d1f8401d70166cf1e11c43122728..bcdd79af46cdbfca2880a25cc54e2adb1cc58d45 100644 --- a/ee/spec/factories/protected_branches/unprotect_access_levels.rb +++ b/ee/spec/factories/protected_branches/unprotect_access_levels.rb @@ -2,8 +2,8 @@ FactoryBot.define do factory :protected_branch_unprotect_access_level, class: ProtectedBranch::UnprotectAccessLevel do - user nil - group nil + user { nil } + group { nil } protected_branch access_level { Gitlab::Access::DEVELOPER } end diff --git a/ee/spec/factories/protected_environments.rb b/ee/spec/factories/protected_environments.rb index a1c104b0e1dc1d8e9269556c9db59dbfa04f7a32..f552dc01f77db05b6596bef6f96222a58666e86a 100644 --- a/ee/spec/factories/protected_environments.rb +++ b/ee/spec/factories/protected_environments.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true FactoryBot.define do factory :protected_environment do - name 'production' + name { 'production' } project transient do - authorize_user_to_deploy nil - authorize_group_to_deploy nil + authorize_user_to_deploy { nil } + authorize_group_to_deploy { nil } end after(:build) do |protected_environment, evaluator| @@ -36,7 +36,7 @@ end trait :staging do - name 'staging' + name { 'staging' } end end end diff --git a/ee/spec/factories/protected_environments/deploy_access_levels.rb b/ee/spec/factories/protected_environments/deploy_access_levels.rb index 20b7218621f81e8b19d0a3f9dc393499cddc90f6..bb34ca5b2a76eca1a6d33474d8d06d48feb7b674 100644 --- a/ee/spec/factories/protected_environments/deploy_access_levels.rb +++ b/ee/spec/factories/protected_environments/deploy_access_levels.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true FactoryBot.define do factory :protected_environment_deploy_access_level, class: ProtectedEnvironment::DeployAccessLevel do - user nil - group nil + user { nil } + group { nil } protected_environment access_level { Gitlab::Access::DEVELOPER } diff --git a/ee/spec/factories/protected_tags.rb b/ee/spec/factories/protected_tags.rb index c798a9db7dcecf65beebc062c542c2e9039f545e..1fb969b3e245db82d73d17b1b3476ad2e6ea5d85 100644 --- a/ee/spec/factories/protected_tags.rb +++ b/ee/spec/factories/protected_tags.rb @@ -3,13 +3,13 @@ FactoryBot.modify do factory :protected_tag do transient do - authorize_user_to_create nil - authorize_group_to_create nil + authorize_user_to_create { nil } + authorize_group_to_create { nil } end trait :developers_can_create do transient do - default_access_level false + default_access_level { false } end after(:build) do |protected_tag| @@ -19,7 +19,7 @@ trait :no_one_can_create do transient do - default_access_level false + default_access_level { false } end after(:build) do |protected_tag| @@ -29,7 +29,7 @@ trait :maintainers_can_create do transient do - default_access_level false + default_access_level { false } end after(:build) do |protected_tag| diff --git a/ee/spec/factories/protected_tags/create_access_levels.rb b/ee/spec/factories/protected_tags/create_access_levels.rb index 921acc2df178d24be8ac928321579f7ac945accf..9d788e43c832de9f5a264793e8d6592c6b685af7 100644 --- a/ee/spec/factories/protected_tags/create_access_levels.rb +++ b/ee/spec/factories/protected_tags/create_access_levels.rb @@ -2,8 +2,8 @@ FactoryBot.define do factory :protected_tag_create_access_level, class: ProtectedTag::CreateAccessLevel do - user nil - group nil + user { nil } + group { nil } protected_tag access_level { Gitlab::Access::DEVELOPER } end diff --git a/ee/spec/factories/push_rules.rb b/ee/spec/factories/push_rules.rb index fe7e9ef1d2bd0882b17bda4d0e342aadc4b6dc15..cd3f475c5a575baca78f628ad85659f54d9ea119 100644 --- a/ee/spec/factories/push_rules.rb +++ b/ee/spec/factories/push_rules.rb @@ -4,21 +4,21 @@ FactoryBot.define do factory :push_rule do - force_push_regex 'feature\/.*' - deny_delete_tag false - delete_branch_regex 'bug\/.*' + force_push_regex { 'feature\/.*' } + deny_delete_tag { false } + delete_branch_regex { 'bug\/.*' } project trait :commit_message do - commit_message_regex "(f|F)ixes #\d+.*" + commit_message_regex { "(f|F)ixes #\d+.*" } end trait :author_email do - author_email_regex '.*@veryspecificedomain.com' + author_email_regex { '.*@veryspecificedomain.com' } end factory :push_rule_sample do - is_sample true + is_sample { true } end end end diff --git a/ee/spec/factories/saml_providers.rb b/ee/spec/factories/saml_providers.rb index 8bdc01fa43ceae58a7814fce948815ae1d504104..71573dfd1b811c7660b61115a04d82fc8676bdf3 100644 --- a/ee/spec/factories/saml_providers.rb +++ b/ee/spec/factories/saml_providers.rb @@ -3,13 +3,13 @@ FactoryBot.define do factory :saml_provider do group - certificate_fingerprint '55:44:33:22:11:aa:bb:cc:dd:ee:ff:11:22:33:44:55:66:77:88:99' - sso_url 'https://saml.example.com/adfs/ls' + certificate_fingerprint { '55:44:33:22:11:aa:bb:cc:dd:ee:ff:11:22:33:44:55:66:77:88:99' } + sso_url { 'https://saml.example.com/adfs/ls' } trait :enforced_group_managed_accounts do - enabled true - enforced_sso true - enforced_group_managed_accounts true + enabled { true } + enforced_sso { true } + enforced_group_managed_accounts { true } end end end diff --git a/ee/spec/factories/services.rb b/ee/spec/factories/services.rb index 70407be224550923acffe3314af0e63b20dfc34b..ae687c9b35fc8456767dd44973382a51a4defbf1 100644 --- a/ee/spec/factories/services.rb +++ b/ee/spec/factories/services.rb @@ -3,17 +3,17 @@ FactoryBot.define do factory :gitlab_slack_application_service do project - active true - type 'GitlabSlackApplicationService' + active { true } + type { 'GitlabSlackApplicationService' } end factory :alerts_service do project - type 'AlertsService' - active true + type { 'AlertsService' } + active { true } trait :inactive do - active false + active { false } end end end diff --git a/ee/spec/factories/software_license_policy.rb b/ee/spec/factories/software_license_policy.rb index f9f1e7876638e6bc9cd76e268fa0baf91da14076..b8347ffef546beba769ac56bbc4612e36b38e560 100644 --- a/ee/spec/factories/software_license_policy.rb +++ b/ee/spec/factories/software_license_policy.rb @@ -2,12 +2,12 @@ FactoryBot.define do factory :software_license_policy, class: SoftwareLicensePolicy do - approval_status 1 + approval_status { 1 } project software_license trait :blacklist do - approval_status :blacklisted + approval_status { :blacklisted } end end end diff --git a/ee/spec/factories/users.rb b/ee/spec/factories/users.rb index a186fe0ce1917fa3f32908b64ed302fb43e8c94d..970dc62b46bae683e58bfd143b3c9094da651d4b 100644 --- a/ee/spec/factories/users.rb +++ b/ee/spec/factories/users.rb @@ -3,7 +3,7 @@ FactoryBot.modify do factory :user do trait :auditor do - auditor true + auditor { true } end trait :group_managed do @@ -17,7 +17,7 @@ factory :omniauth_user do transient do - saml_provider nil + saml_provider { nil } end end end diff --git a/ee/spec/factories/vulnerabilities/feedback.rb b/ee/spec/factories/vulnerabilities/feedback.rb index e6f7d384f624ec2b57f510cca027a647b00fa6cb..3718643896659ca5d6dc1167f5bab2eed885811d 100644 --- a/ee/spec/factories/vulnerabilities/feedback.rb +++ b/ee/spec/factories/vulnerabilities/feedback.rb @@ -10,48 +10,48 @@ factory :vulnerability_feedback, class: Vulnerabilities::Feedback do project author - issue nil - merge_request nil + issue { nil } + merge_request { nil } association :pipeline, factory: :ci_pipeline - feedback_type 'dismissal' - category 'sast' + feedback_type { 'dismissal' } + category { 'sast' } project_fingerprint { generate(:project_fingerprint) } vulnerability_data { { category: 'sast' } } trait :dismissal do - feedback_type 'dismissal' + feedback_type { 'dismissal' } end trait :comment do - comment 'a dismissal comment' + comment { 'a dismissal comment' } comment_timestamp { Time.zone.now } comment_author { author } end trait :issue do - feedback_type 'issue' + feedback_type { 'issue' } issue { create(:issue, project: project) } end trait :merge_request do - feedback_type 'merge_request' + feedback_type { 'merge_request' } merge_request { create(:merge_request, source_project: project) } end trait :sast do - category 'sast' + category { 'sast' } end trait :dependency_scanning do - category 'dependency_scanning' + category { 'dependency_scanning' } end trait :container_scanning do - category 'container_scanning' + category { 'container_scanning' } end trait :dast do - category 'dast' + category { 'dast' } end end end diff --git a/ee/spec/factories/vulnerabilities/identifiers.rb b/ee/spec/factories/vulnerabilities/identifiers.rb index a6337b3148effdcb057988daf8bf8ee2ec3379aa..65d4a947168fd7bbd383d039bad34775165dd117 100644 --- a/ee/spec/factories/vulnerabilities/identifiers.rb +++ b/ee/spec/factories/vulnerabilities/identifiers.rb @@ -2,11 +2,11 @@ FactoryBot.define do factory :vulnerabilities_identifier, class: Vulnerabilities::Identifier do - external_type 'CVE' - external_id 'CVE-2018-1234' - fingerprint '52d084cede3db8fafcd6b8ae382ddf1970da3b7f' - name 'CVE-2018-1234' - url 'http://cve.mitre.org/cgi-bin/cvename.cgi?name=2018-1234' + external_type { 'CVE' } + external_id { 'CVE-2018-1234' } + fingerprint { '52d084cede3db8fafcd6b8ae382ddf1970da3b7f' } + name { 'CVE-2018-1234' } + url { 'http://cve.mitre.org/cgi-bin/cvename.cgi?name=2018-1234' } project end end diff --git a/ee/spec/factories/vulnerabilities/occurrences.rb b/ee/spec/factories/vulnerabilities/occurrences.rb index 9450e128b7253fbe68113e96de0fb10ac5af1d10..05e0f1cbcebf94c3e59cc3b00cc00f3a56e2d8db 100644 --- a/ee/spec/factories/vulnerabilities/occurrences.rb +++ b/ee/spec/factories/vulnerabilities/occurrences.rb @@ -6,17 +6,17 @@ end factory :vulnerabilities_occurrence, class: Vulnerabilities::Occurrence do - name 'Cipher with no integrity' + name { 'Cipher with no integrity' } project sequence(:uuid) { generate(:vulnerability_occurrence_uuid) } project_fingerprint { generate(:project_fingerprint) } primary_identifier factory: :vulnerabilities_identifier - location_fingerprint '4e5b6966dd100170b4b1ad599c7058cce91b57b4' - report_type :sast - severity :high - confidence :medium + location_fingerprint { '4e5b6966dd100170b4b1ad599c7058cce91b57b4' } + report_type { :sast } + severity { :high } + confidence { :medium } scanner factory: :vulnerabilities_scanner - metadata_version 'sast:1.0' + metadata_version { 'sast:1.0' } raw_metadata do { description: "The cipher does not provide data integrity update 1", diff --git a/ee/spec/factories/vulnerabilities/scanners.rb b/ee/spec/factories/vulnerabilities/scanners.rb index 58aa1be96572c18fa00d3d48db046f55eba4bfc7..bf2477782387ac939d8cb7f34cdbf27d6158e03f 100644 --- a/ee/spec/factories/vulnerabilities/scanners.rb +++ b/ee/spec/factories/vulnerabilities/scanners.rb @@ -2,8 +2,8 @@ FactoryBot.define do factory :vulnerabilities_scanner, class: Vulnerabilities::Scanner do - external_id 'find_sec_bugs' - name 'Find Security Bugs' + external_id { 'find_sec_bugs' } + name { 'Find Security Bugs' } project end end diff --git a/ee/spec/support/factory_bot.rb b/ee/spec/support/factory_bot.rb index 8278c979abd99181ff80a58f33f1fa5d73d05dba..58e2d78ea3c06b53beb6cc47fa0157b39aa0b0c1 100644 --- a/ee/spec/support/factory_bot.rb +++ b/ee/spec/support/factory_bot.rb @@ -6,5 +6,9 @@ Rails.root.join('ee', 'spec', 'factories') ] FactoryBot.find_definitions + + # Use FactoryBot 4.x behavior: + # https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#associations + FactoryBot.use_parent_strategy = false end end diff --git a/spec/factories/abuse_reports.rb b/spec/factories/abuse_reports.rb index 578af9ed895febd6e7dc8fb44c5e1f823372e018..4174faae1ed8482501cd897041abb27064c0320c 100644 --- a/spec/factories/abuse_reports.rb +++ b/spec/factories/abuse_reports.rb @@ -4,6 +4,6 @@ factory :abuse_report do reporter factory: :user user - message 'User sends spam' + message { 'User sends spam' } end end diff --git a/spec/factories/appearances.rb b/spec/factories/appearances.rb index bdd5964fb93bb3754121e5239886bf255b26aacb..e2922662ea4963585595ff5db8cb4d096ac2d7de 100644 --- a/spec/factories/appearances.rb +++ b/spec/factories/appearances.rb @@ -4,9 +4,9 @@ FactoryBot.define do factory :appearance do - title "GitLab Community Edition" - description "Open source software to collaborate on code" - new_project_guidelines "Custom project guidelines" + title { "GitLab Community Edition" } + description { "Open source software to collaborate on code" } + new_project_guidelines { "Custom project guidelines" } end trait :with_logo do diff --git a/spec/factories/application_settings.rb b/spec/factories/application_settings.rb index 90b6b9e648a58d5bf384ebbdceb4b8950d99003f..d4571b9861d30fa7b41075d358bcc756da49dc32 100644 --- a/spec/factories/application_settings.rb +++ b/spec/factories/application_settings.rb @@ -2,6 +2,6 @@ FactoryBot.define do factory :application_setting do - default_projects_limit 42 + default_projects_limit { 42 } end end diff --git a/spec/factories/award_emoji.rb b/spec/factories/award_emoji.rb index a8bb806381e0088b8ad66d6f3ad40989f1e3b269..a430210ab49a374ad38187ca34a3b5b8bb082ec8 100644 --- a/spec/factories/award_emoji.rb +++ b/spec/factories/award_emoji.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :award_emoji do - name "thumbsup" + name { "thumbsup" } user awardable factory: :issue @@ -12,7 +12,7 @@ trait :upvote trait :downvote do - name "thumbsdown" + name { "thumbsdown" } end end end diff --git a/spec/factories/boards.rb b/spec/factories/boards.rb index a5aff5c75042bdf21df9f9a40ef2e0690729fc8d..29cfe8fb295766cfb925eafe7ee8635a465eb146 100644 --- a/spec/factories/boards.rb +++ b/spec/factories/boards.rb @@ -3,11 +3,11 @@ FactoryBot.define do factory :board do transient do - project nil - group nil - project_id nil - group_id nil - parent nil + project { nil } + group { nil } + project_id { nil } + group_id { nil } + parent { nil } end after(:build, :stub) do |board, evaluator| diff --git a/spec/factories/broadcast_messages.rb b/spec/factories/broadcast_messages.rb index 2a30e2034b14b555fc59bf2234249300508f86ac..ed6e267e7c487eb93e2f6ae4b2478e9b76fc3520 100644 --- a/spec/factories/broadcast_messages.rb +++ b/spec/factories/broadcast_messages.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :broadcast_message do - message "MyText" + message { "MyText" } starts_at { 1.day.ago } ends_at { 1.day.from_now } diff --git a/spec/factories/chat_names.rb b/spec/factories/chat_names.rb index 07bf990162f6599195ac55368f139210c98a46df..ace5d5e83c98288e6f4557ae0ec5d9d78e5d62d7 100644 --- a/spec/factories/chat_names.rb +++ b/spec/factories/chat_names.rb @@ -5,8 +5,8 @@ user factory: :user service factory: :service - team_id 'T0001' - team_domain 'Awesome Team' + team_id { 'T0001' } + team_domain { 'Awesome Team' } sequence(:chat_id) { |n| "U#{n}" } chat_name { generate(:username) } diff --git a/spec/factories/ci/bridge.rb b/spec/factories/ci/bridge.rb index b1b714277e425fbd813c9c9d05122bf232e9dda5..60219b07cf09faceb89d7779753d8a90274dd910 100644 --- a/spec/factories/ci/bridge.rb +++ b/spec/factories/ci/bridge.rb @@ -2,22 +2,26 @@ FactoryBot.define do factory :ci_bridge, class: Ci::Bridge do - name 'bridge' - stage 'test' - stage_idx 0 - ref 'master' - tag false - created_at 'Di 29. Okt 09:50:00 CET 2013' - status :created + name { 'bridge' } + stage { 'test' } + stage_idx { 0 } + ref { 'master' } + tag { false } + created_at { 'Di 29. Okt 09:50:00 CET 2013' } + status { :created } pipeline factory: :ci_pipeline trait :variables do - yaml_variables [{ key: 'BRIDGE', value: 'cross', public: true }] + yaml_variables do + [{ key: 'BRIDGE', value: 'cross', public: true }] + end end - transient { downstream nil } - transient { upstream nil } + transient do + downstream { nil } + upstream { nil } + end after(:build) do |bridge, evaluator| bridge.project ||= bridge.pipeline.project diff --git a/spec/factories/ci/build_trace_chunks.rb b/spec/factories/ci/build_trace_chunks.rb index 492dc47f083292e198b99698e272984d9b6e5a47..22f091f8e761638cc794d0402159c7be67f6be3a 100644 --- a/spec/factories/ci/build_trace_chunks.rb +++ b/spec/factories/ci/build_trace_chunks.rb @@ -3,14 +3,14 @@ FactoryBot.define do factory :ci_build_trace_chunk, class: Ci::BuildTraceChunk do build factory: :ci_build - chunk_index 0 - data_store :redis + chunk_index { 0 } + data_store { :redis } trait :redis_with_data do - data_store :redis + data_store { :redis } transient do - initial_data 'test data' + initial_data { 'test data' } end after(:create) do |build_trace_chunk, evaluator| @@ -19,14 +19,14 @@ end trait :redis_without_data do - data_store :redis + data_store { :redis } end trait :database_with_data do - data_store :database + data_store { :database} transient do - initial_data 'test data' + initial_data { 'test data' } end after(:build) do |build_trace_chunk, evaluator| @@ -35,14 +35,14 @@ end trait :database_without_data do - data_store :database + data_store { :database } end trait :fog_with_data do - data_store :fog + data_store { :fog } transient do - initial_data 'test data' + initial_data { 'test data' } end after(:create) do |build_trace_chunk, evaluator| @@ -51,7 +51,7 @@ end trait :fog_without_data do - data_store :fog + data_store { :fog } end end end diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index e3b7c64176a9730e15479a0f0fc60b1ed5419e68..6725cde08f285bc6bcdb58f402eb4935e59b450a 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -4,13 +4,13 @@ FactoryBot.define do factory :ci_build, class: Ci::Build do - name 'test' - stage 'test' - stage_idx 0 - ref 'master' - tag false - protected false - created_at 'Di 29. Okt 09:50:00 CET 2013' + name { 'test' } + stage { 'test' } + stage_idx { 0 } + ref { 'master' } + tag { false } + add_attribute(:protected) { false } + created_at { 'Di 29. Okt 09:50:00 CET 2013' } pending options do @@ -30,127 +30,127 @@ pipeline factory: :ci_pipeline trait :degenerated do - options nil - yaml_variables nil + options { nil } + yaml_variables { nil } end trait :started do - started_at 'Di 29. Okt 09:51:28 CET 2013' + started_at { 'Di 29. Okt 09:51:28 CET 2013' } end trait :finished do started - finished_at 'Di 29. Okt 09:53:28 CET 2013' + finished_at { 'Di 29. Okt 09:53:28 CET 2013' } end trait :success do finished - status 'success' + status { 'success' } end trait :failed do finished - status 'failed' + status { 'failed' } end trait :canceled do finished - status 'canceled' + status { 'canceled' } end trait :skipped do started - status 'skipped' + status { 'skipped' } end trait :running do started - status 'running' + status { 'running' } end trait :pending do - queued_at 'Di 29. Okt 09:50:59 CET 2013' - status 'pending' + queued_at { 'Di 29. Okt 09:50:59 CET 2013' } + status { 'pending' } end trait :created do - status 'created' + status { 'created' } end trait :preparing do - status 'preparing' + status { 'preparing' } end trait :scheduled do schedulable - status 'scheduled' + status { 'scheduled' } scheduled_at { 1.minute.since } end trait :expired_scheduled do schedulable - status 'scheduled' + status { 'scheduled' } scheduled_at { 1.minute.ago } end trait :manual do - status 'manual' - self.when 'manual' + status { 'manual' } + self.when { 'manual' } end trait :teardown_environment do - environment 'staging' + environment { 'staging' } options do { script: %w(ls), environment: { name: 'staging', - action: 'stop', - url: 'http://staging.example.com/$CI_JOB_NAME' } + action: 'stop', + url: 'http://staging.example.com/$CI_JOB_NAME' } } end end trait :deploy_to_production do - environment 'production' + environment { 'production' } options do { script: %w(ls), environment: { name: 'production', - url: 'http://prd.example.com/$CI_JOB_NAME' } + url: 'http://prd.example.com/$CI_JOB_NAME' } } end end trait :start_review_app do - environment 'review/$CI_COMMIT_REF_NAME' + environment { 'review/$CI_COMMIT_REF_NAME' } options do { script: %w(ls), environment: { name: 'review/$CI_COMMIT_REF_NAME', - url: 'http://staging.example.com/$CI_JOB_NAME', - on_stop: 'stop_review_app' } + url: 'http://staging.example.com/$CI_JOB_NAME', + on_stop: 'stop_review_app' } } end end trait :stop_review_app do - name 'stop_review_app' - environment 'review/$CI_COMMIT_REF_NAME' + name { 'stop_review_app' } + environment { 'review/$CI_COMMIT_REF_NAME' } options do { script: %w(ls), environment: { name: 'review/$CI_COMMIT_REF_NAME', - url: 'http://staging.example.com/$CI_JOB_NAME', - action: 'stop' } + url: 'http://staging.example.com/$CI_JOB_NAME', + action: 'stop' } } end end trait :allowed_to_fail do - allow_failure true + allow_failure { true } end trait :ignored do @@ -166,7 +166,7 @@ end trait :schedulable do - self.when 'delayed' + self.when { 'delayed' } options do { @@ -177,11 +177,11 @@ end trait :actionable do - self.when 'manual' + self.when { 'manual' } end trait :retried do - retried true + retried { true } end trait :cancelable do @@ -194,11 +194,13 @@ end trait :tags do - tag_list [:docker, :ruby] + tag_list do + [:docker, :ruby] + end end trait :on_tag do - tag true + tag { true } end trait :triggered do @@ -210,12 +212,12 @@ end trait :tag do - tag true + tag { true } end trait :coverage do - coverage 99.9 - coverage_regex '/(d+)/' + coverage { 99.9 } + coverage_regex { '/(d+)/' } end trait :trace_live do @@ -303,23 +305,23 @@ trait :extended_options do options do { - image: { name: 'ruby:2.1', entrypoint: '/bin/sh' }, - services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }], - script: %w(echo), - after_script: %w(ls date), - artifacts: { - name: 'artifacts_file', - untracked: false, - paths: ['out/'], - when: 'always', - expire_in: '7d' - }, - cache: { - key: 'cache_key', - untracked: false, - paths: ['vendor/*'], - policy: 'pull-push' - } + image: { name: 'ruby:2.1', entrypoint: '/bin/sh' }, + services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }], + script: %w(echo), + after_script: %w(ls date), + artifacts: { + name: 'artifacts_file', + untracked: false, + paths: ['out/'], + when: 'always', + expire_in: '7d' + }, + cache: { + key: 'cache_key', + untracked: false, + paths: ['vendor/*'], + policy: 'pull-push' + } } end end @@ -329,27 +331,27 @@ end trait :non_playable do - status 'created' - self.when 'manual' + status { 'created' } + self.when { 'manual' } end trait :protected do - protected true + add_attribute(:protected) { true } end trait :script_failure do failed - failure_reason 1 + failure_reason { 1 } end trait :api_failure do failed - failure_reason 2 + failure_reason { 2 } end trait :prerequisite_failure do failed - failure_reason 10 + failure_reason { 10 } end trait :with_runner_session do diff --git a/spec/factories/ci/group_variables.rb b/spec/factories/ci/group_variables.rb index 13c2b78e61b36a319ed7b3a320e1d6bad2c79bdb..217f05a088e035bd5b11c15a29433ce48d34033a 100644 --- a/spec/factories/ci/group_variables.rb +++ b/spec/factories/ci/group_variables.rb @@ -3,11 +3,11 @@ FactoryBot.define do factory :ci_group_variable, class: Ci::GroupVariable do sequence(:key) { |n| "VARIABLE_#{n}" } - value 'VARIABLE_VALUE' - masked false + value { 'VARIABLE_VALUE' } + masked { false } trait(:protected) do - protected true + add_attribute(:protected) { true } end group factory: :group diff --git a/spec/factories/ci/job_artifacts.rb b/spec/factories/ci/job_artifacts.rb index 6f553cadfa3ac3f0eb207bc10cd48756c03e841f..bdc6cc2f169843e9f6cbd9e5a8839c34569f7a87 100644 --- a/spec/factories/ci/job_artifacts.rb +++ b/spec/factories/ci/job_artifacts.rb @@ -5,15 +5,15 @@ FactoryBot.define do factory :ci_job_artifact, class: Ci::JobArtifact do job factory: :ci_build - file_type :archive - file_format :zip + file_type { :archive } + file_format { :zip } trait :expired do expire_at { Date.yesterday } end trait :remote_store do - file_store JobArtifactUploader::Store::REMOTE + file_store { JobArtifactUploader::Store::REMOTE} end after :build do |artifact| @@ -21,7 +21,7 @@ end trait :raw do - file_format :raw + file_format { :raw } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -30,7 +30,7 @@ end trait :zip do - file_format :zip + file_format { :zip } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -39,7 +39,7 @@ end trait :gzip do - file_format :gzip + file_format { :gzip } after(:build) do |artifact, _| artifact.file = fixture_file_upload( @@ -48,8 +48,8 @@ end trait :archive do - file_type :archive - file_format :zip + file_type { :archive } + file_format { :zip } transient do file { fixture_file_upload(Rails.root.join('spec/fixtures/ci_build_artifacts.zip'), 'application/zip') } @@ -63,12 +63,12 @@ trait :legacy_archive do archive - file_location :legacy_path + file_location { :legacy_path } end trait :metadata do - file_type :metadata - file_format :gzip + file_type { :metadata } + file_format { :gzip } transient do file { fixture_file_upload(Rails.root.join('spec/fixtures/ci_build_artifacts_metadata.gz'), 'application/x-gzip') } @@ -80,8 +80,8 @@ end trait :trace do - file_type :trace - file_format :raw + file_type { :trace } + file_format { :raw } after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( @@ -90,8 +90,8 @@ end trait :junit do - file_type :junit - file_format :gzip + file_type { :junit } + file_format { :gzip } after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( @@ -100,8 +100,8 @@ end trait :junit_with_ant do - file_type :junit - file_format :gzip + file_type { :junit } + file_format { :gzip } after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( @@ -110,8 +110,8 @@ end trait :junit_with_three_testsuites do - file_type :junit - file_format :gzip + file_type { :junit } + file_format { :gzip } after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( @@ -120,8 +120,8 @@ end trait :junit_with_corrupted_data do - file_type :junit - file_format :gzip + file_type { :junit } + file_format { :gzip } after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( @@ -130,8 +130,8 @@ end trait :codequality do - file_type :codequality - file_format :raw + file_type { :codequality } + file_format { :raw } after(:build) do |artifact, evaluator| artifact.file = fixture_file_upload( diff --git a/spec/factories/ci/job_variables.rb b/spec/factories/ci/job_variables.rb index d664b763abd9cce0b57861c9061aa24dac8c98ea..bfc631b8126aac18de0b628a963ccace9f09ea3b 100644 --- a/spec/factories/ci/job_variables.rb +++ b/spec/factories/ci/job_variables.rb @@ -3,7 +3,7 @@ FactoryBot.define do factory :ci_job_variable, class: Ci::JobVariable do sequence(:key) { |n| "VARIABLE_#{n}" } - value 'VARIABLE_VALUE' + value { 'VARIABLE_VALUE' } job factory: :ci_build end diff --git a/spec/factories/ci/pipeline_schedule.rb b/spec/factories/ci/pipeline_schedule.rb index 8fae6986869148e200b8dfc70fa9f38cfe46f184..c752dc1c9dd7a38c7c73fd1b99debfcae1226639 100644 --- a/spec/factories/ci/pipeline_schedule.rb +++ b/spec/factories/ci/pipeline_schedule.rb @@ -2,40 +2,40 @@ FactoryBot.define do factory :ci_pipeline_schedule, class: Ci::PipelineSchedule do - cron '0 1 * * *' - cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE - ref 'master' - active true - description "pipeline schedule" + cron { '0 1 * * *' } + cron_timezone { Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE } + ref { 'master' } + active { true } + description { "pipeline schedule" } project trait :every_minute do - cron '*/1 * * * *' - cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE + cron { '*/1 * * * *' } + cron_timezone { Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE } end trait :hourly do - cron '* */1 * * *' - cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE + cron { '* */1 * * *' } + cron_timezone { Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE } end trait :nightly do - cron '0 1 * * *' - cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE + cron { '0 1 * * *' } + cron_timezone { Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE } end trait :weekly do - cron '0 1 * * 6' - cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE + cron { '0 1 * * 6' } + cron_timezone { Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE } end trait :monthly do - cron '0 1 22 * *' - cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE + cron { '0 1 22 * *' } + cron_timezone { Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE } end trait :inactive do - active false + active { false } end end end diff --git a/spec/factories/ci/pipeline_schedule_variables.rb b/spec/factories/ci/pipeline_schedule_variables.rb index fd7cfada65b4eaffbab2934efd67818582dc1617..24913c614f4fdbd3137a6a28438c20fa6a82d72a 100644 --- a/spec/factories/ci/pipeline_schedule_variables.rb +++ b/spec/factories/ci/pipeline_schedule_variables.rb @@ -3,8 +3,8 @@ FactoryBot.define do factory :ci_pipeline_schedule_variable, class: Ci::PipelineScheduleVariable do sequence(:key) { |n| "VARIABLE_#{n}" } - value 'VARIABLE_VALUE' - variable_type 'env_var' + value { 'VARIABLE_VALUE' } + variable_type { 'env_var' } pipeline_schedule factory: :ci_pipeline_schedule end diff --git a/spec/factories/ci/pipeline_variables.rb b/spec/factories/ci/pipeline_variables.rb index af0982124d742f7bff98be88513f38c8bd405a3f..48f6e35fe70b3b792a78cbc346e8848811515a7f 100644 --- a/spec/factories/ci/pipeline_variables.rb +++ b/spec/factories/ci/pipeline_variables.rb @@ -3,7 +3,7 @@ FactoryBot.define do factory :ci_pipeline_variable, class: Ci::PipelineVariable do sequence(:key) { |n| "VARIABLE_#{n}" } - value 'VARIABLE_VALUE' + value { 'VARIABLE_VALUE' } pipeline factory: :ci_empty_pipeline end diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb index 9652b0000a97525d152783bd1f9d8bf4fdaadd05..fefd89728e67d93d69b2083d2179708330cd7437 100644 --- a/spec/factories/ci/pipelines.rb +++ b/spec/factories/ci/pipelines.rb @@ -2,11 +2,11 @@ FactoryBot.define do factory :ci_empty_pipeline, class: Ci::Pipeline do - source :push - ref 'master' - sha '97de212e80737a608d939f648d959671fb0a0142' - status 'pending' - protected false + source { :push } + ref { 'master' } + sha { '97de212e80737a608d939f648d959671fb0a0142' } + status { 'pending' } + add_attribute(:protected) { false } project @@ -26,7 +26,7 @@ # Persist merge request head_pipeline_id # on pipeline factories to avoid circular references - transient { head_pipeline_of nil } + transient { head_pipeline_of { nil } } after(:create) do |pipeline, evaluator| merge_request = evaluator.head_pipeline_of @@ -34,7 +34,7 @@ end factory :ci_pipeline do - transient { config nil } + transient { config { nil } } after(:build) do |pipeline, evaluator| if evaluator.config @@ -48,44 +48,47 @@ end trait :invalid do - config(rspec: nil) - failure_reason :config_error + config do + { rspec: nil } + end + + failure_reason { :config_error } end trait :created do - status :created + status { :created } end trait :preparing do - status :preparing + status { :preparing } end trait :blocked do - status :manual + status { :manual } end trait :scheduled do - status :scheduled + status { :scheduled } end trait :success do - status :success + status { :success } end trait :running do - status :running + status { :running } end trait :failed do - status :failed + status { :failed } end trait :protected do - protected true + add_attribute(:protected) { true } end trait :with_test_reports do - status :success + status { :success } after(:build) do |pipeline, evaluator| pipeline.builds << build(:ci_build, :test_reports, pipeline: pipeline, project: pipeline.project) diff --git a/spec/factories/ci/runners.rb b/spec/factories/ci/runners.rb index 1e4344b814d9ba937e9389a3a1893c75ae24afba..3697970721b845043efcde352eacebf40787dc05 100644 --- a/spec/factories/ci/runners.rb +++ b/spec/factories/ci/runners.rb @@ -4,22 +4,22 @@ factory :ci_runner, class: Ci::Runner do sequence(:description) { |n| "My runner#{n}" } - platform "darwin" - active true - access_level :not_protected + platform { "darwin" } + active { true } + access_level { :not_protected } - runner_type :instance_type + runner_type { :instance_type } trait :online do contacted_at { Time.now } end trait :instance do - runner_type :instance_type + runner_type { :instance_type } end trait :group do - runner_type :group_type + runner_type { :group_type } after(:build) do |runner, evaluator| runner.groups << build(:group) if runner.groups.empty? @@ -27,7 +27,7 @@ end trait :project do - runner_type :project_type + runner_type { :project_type } after(:build) do |runner, evaluator| runner.projects << build(:project) if runner.projects.empty? @@ -43,21 +43,21 @@ end trait :inactive do - active false + active { false } end trait :ref_protected do - access_level :ref_protected + access_level { :ref_protected } end trait :tagged_only do - run_untagged false + run_untagged { false } - tag_list %w(tag1 tag2) + tag_list { %w(tag1 tag2) } end trait :locked do - locked true + locked { true } end end end diff --git a/spec/factories/ci/stages.rb b/spec/factories/ci/stages.rb index 88ff8d7dc533ce05b17a742302a42b94b8245924..67f4db41d965975b5f92fb6e661e0d99142419f6 100644 --- a/spec/factories/ci/stages.rb +++ b/spec/factories/ci/stages.rb @@ -5,16 +5,16 @@ skip_create transient do - name 'test' - status nil - warnings nil + name { 'test' } + status { nil } + warnings { nil } pipeline factory: :ci_empty_pipeline end initialize_with do Ci::LegacyStage.new(pipeline, name: name, - status: status, - warnings: warnings) + status: status, + warnings: warnings) end end @@ -22,8 +22,8 @@ project factory: :project pipeline factory: :ci_empty_pipeline - name 'test' - position 1 - status 'pending' + name { 'test' } + position { 1 } + status { 'pending' } end end diff --git a/spec/factories/ci/variables.rb b/spec/factories/ci/variables.rb index 55d11085040136b6bb6735269a8b56b0bbb06ba7..9d2501c4e1838eb206650b77cea59f103ff5ac7a 100644 --- a/spec/factories/ci/variables.rb +++ b/spec/factories/ci/variables.rb @@ -3,11 +3,11 @@ FactoryBot.define do factory :ci_variable, class: Ci::Variable do sequence(:key) { |n| "VARIABLE_#{n}" } - value 'VARIABLE_VALUE' - masked false + value { 'VARIABLE_VALUE' } + masked { false } trait(:protected) do - protected true + add_attribute(:protected) { true } end project diff --git a/spec/factories/clusters/applications/helm.rb b/spec/factories/clusters/applications/helm.rb index 89f7bc15217536af811da567ce4ddeb6b9a6e2a1..c7ec7c11743d8127837398d04f973e182ebb54d7 100644 --- a/spec/factories/clusters/applications/helm.rb +++ b/spec/factories/clusters/applications/helm.rb @@ -19,50 +19,50 @@ end trait :not_installable do - status(-2) + status { -2 } end trait :errored do - status(-1) - status_reason 'something went wrong' + status { -1 } + status_reason { 'something went wrong' } end trait :installable do - status 0 + status { 0 } end trait :scheduled do - status 1 + status { 1 } end trait :installing do - status 2 + status { 2 } end trait :installed do - status 3 + status { 3 } end trait :updating do - status 4 + status { 4 } end trait :updated do - status 5 + status { 5 } end trait :update_errored do - status(6) - status_reason 'something went wrong' + status { 6 } + status_reason { 'something went wrong' } end trait :uninstalling do - status 7 + status { 7 } end trait :uninstall_errored do - status(8) - status_reason 'something went wrong' + status { 8 } + status_reason { 'something went wrong' } end trait :timed_out do @@ -75,7 +75,7 @@ end 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) end @@ -89,7 +89,7 @@ end 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) end diff --git a/spec/factories/clusters/clusters.rb b/spec/factories/clusters/clusters.rb index 29aea5e403e72d280c7b8987aa14d04cd780a723..74c42c81399326a5b1cd285dfef36aa4be9107d2 100644 --- a/spec/factories/clusters/clusters.rb +++ b/spec/factories/clusters/clusters.rb @@ -3,10 +3,10 @@ FactoryBot.define do factory :cluster, class: Clusters::Cluster do user - name 'test-cluster' - cluster_type :project_type - managed true - namespace_per_environment true + name { 'test-cluster' } + cluster_type { :project_type } + managed { true } + namespace_per_environment { true } factory :cluster_for_group, traits: [:provided_by_gcp, :group] @@ -31,26 +31,26 @@ end trait :namespace_per_environment_disabled do - namespace_per_environment false + namespace_per_environment { false } end trait :provided_by_user do - provider_type :user - platform_type :kubernetes + provider_type { :user } + platform_type { :kubernetes } platform_kubernetes factory: [:cluster_platform_kubernetes, :configured] end trait :provided_by_gcp do - provider_type :gcp - platform_type :kubernetes + provider_type { :gcp } + platform_type { :kubernetes } provider_gcp factory: [:cluster_provider_gcp, :created] platform_kubernetes factory: [:cluster_platform_kubernetes, :configured] end trait :providing_by_gcp do - provider_type :gcp + provider_type { :gcp } provider_gcp factory: [:cluster_provider_gcp, :creating] end @@ -63,7 +63,7 @@ end trait :disabled do - enabled false + enabled { false } end trait :production_environment do @@ -75,11 +75,11 @@ end trait :with_domain do - domain 'example.com' + domain { 'example.com' } end trait :not_managed do - managed false + managed { false } end end end diff --git a/spec/factories/clusters/kubernetes_namespaces.rb b/spec/factories/clusters/kubernetes_namespaces.rb index 8d6ad1b9f796696dd7f2975f32eb0587243aecae..75895e1c020f872549d570e8c09d4af4666f6cec 100644 --- a/spec/factories/clusters/kubernetes_namespaces.rb +++ b/spec/factories/clusters/kubernetes_namespaces.rb @@ -27,7 +27,7 @@ end trait :without_token do - service_account_token nil + service_account_token { nil } end end end diff --git a/spec/factories/clusters/platforms/kubernetes.rb b/spec/factories/clusters/platforms/kubernetes.rb index d5dc288fddba51b73574291a96d8f373dcfe5a82..2757498e36b7221b97466a71c63322dd6acbb235 100644 --- a/spec/factories/clusters/platforms/kubernetes.rb +++ b/spec/factories/clusters/platforms/kubernetes.rb @@ -3,14 +3,14 @@ FactoryBot.define do factory :cluster_platform_kubernetes, class: Clusters::Platforms::Kubernetes do cluster - namespace nil - api_url 'https://kubernetes.example.com' + namespace { nil } + api_url { 'https://kubernetes.example.com' } token { 'a' * 40 } trait :configured do - api_url 'https://kubernetes.example.com' - username 'xxxxxx' - password 'xxxxxx' + api_url { 'https://kubernetes.example.com' } + username { 'xxxxxx' } + password { 'xxxxxx' } before(:create) do |platform_kubernetes, evaluator| pem_file = File.expand_path(Rails.root.join('spec/fixtures/clusters/sample_cert.pem')) @@ -19,7 +19,7 @@ end trait :rbac_disabled do - authorization_type :abac + authorization_type { :abac } end end end diff --git a/spec/factories/clusters/providers/gcp.rb b/spec/factories/clusters/providers/gcp.rb index 7fdcdebad346dbd2b9c7e4faffbf10beb4023968..83b65dc808700d8a945b12c6ae74208cbb7be2da 100644 --- a/spec/factories/clusters/providers/gcp.rb +++ b/spec/factories/clusters/providers/gcp.rb @@ -3,14 +3,14 @@ FactoryBot.define do factory :cluster_provider_gcp, class: Clusters::Providers::Gcp do cluster - gcp_project_id 'test-gcp-project' + gcp_project_id { 'test-gcp-project' } trait :scheduled do - access_token 'access_token_123' + access_token { 'access_token_123' } end trait :creating do - access_token 'access_token_123' + access_token { 'access_token_123' } after(:build) do |gcp, evaluator| gcp.make_creating('operation-123') @@ -18,7 +18,7 @@ end trait :created do - endpoint '111.111.111.111' + endpoint { '111.111.111.111' } after(:build) do |gcp, evaluator| gcp.make_created @@ -32,11 +32,11 @@ end trait :abac_enabled do - legacy_abac true + legacy_abac { true } end trait :cloud_run_enabled do - cloud_run true + cloud_run { true } end end end diff --git a/spec/factories/commit_statuses.rb b/spec/factories/commit_statuses.rb index a76da30217e2f772e7814b5ec6b63b8d03680c42..3ce71a1b05deb62cee1d44d7d2efb41e03c9e7e2 100644 --- a/spec/factories/commit_statuses.rb +++ b/spec/factories/commit_statuses.rb @@ -2,53 +2,53 @@ FactoryBot.define do factory :commit_status, class: CommitStatus do - name 'default' - stage 'test' - stage_idx 0 - status 'success' - description 'commit status' + name { 'default' } + stage { 'test' } + stage_idx { 0 } + status { 'success' } + description { 'commit status'} pipeline factory: :ci_pipeline_with_one_job - started_at 'Tue, 26 Jan 2016 08:21:42 +0100' - finished_at 'Tue, 26 Jan 2016 08:23:42 +0100' + started_at { 'Tue, 26 Jan 2016 08:21:42 +0100'} + finished_at { 'Tue, 26 Jan 2016 08:23:42 +0100'} trait :success do - status 'success' + status { 'success' } end trait :failed do - status 'failed' + status { 'failed' } end trait :canceled do - status 'canceled' + status { 'canceled' } end trait :skipped do - status 'skipped' + status { 'skipped' } end trait :running do - status 'running' + status { 'running' } end trait :pending do - status 'pending' + status { 'pending' } end trait :preparing do - status 'preparing' + status { 'preparing' } end trait :created do - status 'created' + status { 'created' } end trait :manual do - status 'manual' + status { 'manual' } end trait :scheduled do - status 'scheduled' + status { 'scheduled' } end after(:build) do |build, evaluator| @@ -56,8 +56,8 @@ end factory :generic_commit_status, class: GenericCommitStatus do - name 'generic' - description 'external commit status' + name { 'generic' } + description { 'external commit status' } end end end diff --git a/spec/factories/commits.rb b/spec/factories/commits.rb index d1554426a76a24a7e37b14303fc7cd06f34ccbd4..d006f9baf1f1654cc6392e992f7dafb9fcd89a4a 100644 --- a/spec/factories/commits.rb +++ b/spec/factories/commits.rb @@ -5,7 +5,7 @@ FactoryBot.define do factory :commit do transient do - author nil + author { nil } end git_commit do diff --git a/spec/factories/container_repositories.rb b/spec/factories/container_repositories.rb index 0b756220d680f9833b7b99cfa20f080358aae01e..b2862e41e65ba26fce54c291e84f0b61b5132dab 100644 --- a/spec/factories/container_repositories.rb +++ b/spec/factories/container_repositories.rb @@ -6,11 +6,11 @@ project transient do - tags [] + tags { [] } end trait :root do - name '' + name { '' } end after(:build) do |repository, evaluator| diff --git a/spec/factories/conversational_development_index_metrics.rb b/spec/factories/conversational_development_index_metrics.rb index ea5816684c697b7687b3206f6505825735f81e79..f039bac81d063d97d23e46db05117c34863ea951 100644 --- a/spec/factories/conversational_development_index_metrics.rb +++ b/spec/factories/conversational_development_index_metrics.rb @@ -2,44 +2,44 @@ FactoryBot.define do factory :conversational_development_index_metric, class: ConversationalDevelopmentIndex::Metric do - leader_issues 9.256 - instance_issues 1.234 - percentage_issues 13.331 + leader_issues { 9.256 } + instance_issues { 1.234 } + percentage_issues { 13.331 } - leader_notes 30.33333 - instance_notes 28.123 - percentage_notes 92.713 + leader_notes { 30.33333 } + instance_notes { 28.123 } + percentage_notes { 92.713 } - leader_milestones 16.2456 - instance_milestones 1.234 - percentage_milestones 7.595 + leader_milestones { 16.2456 } + instance_milestones { 1.234 } + percentage_milestones { 7.595 } - leader_boards 5.2123 - instance_boards 3.254 - percentage_boards 62.429 + leader_boards { 5.2123 } + instance_boards { 3.254 } + percentage_boards { 62.429 } - leader_merge_requests 1.2 - instance_merge_requests 0.6 - percentage_merge_requests 50.0 + leader_merge_requests { 1.2 } + instance_merge_requests { 0.6 } + percentage_merge_requests { 50.0 } - leader_ci_pipelines 12.1234 - instance_ci_pipelines 2.344 - percentage_ci_pipelines 19.334 + leader_ci_pipelines { 12.1234 } + instance_ci_pipelines { 2.344 } + percentage_ci_pipelines { 19.334 } - leader_environments 3.3333 - instance_environments 2.2222 - percentage_environments 66.672 + leader_environments { 3.3333 } + instance_environments { 2.2222 } + percentage_environments { 66.672 } - leader_deployments 1.200 - instance_deployments 0.771 - percentage_deployments 64.25 + leader_deployments { 1.200 } + instance_deployments { 0.771 } + percentage_deployments { 64.25 } - leader_projects_prometheus_active 0.111 - instance_projects_prometheus_active 0.109 - percentage_projects_prometheus_active 98.198 + leader_projects_prometheus_active { 0.111 } + instance_projects_prometheus_active { 0.109 } + percentage_projects_prometheus_active { 98.198 } - leader_service_desk_issues 15.891 - instance_service_desk_issues 13.345 - percentage_service_desk_issues 83.978 + leader_service_desk_issues { 15.891 } + instance_service_desk_issues { 13.345 } + percentage_service_desk_issues { 83.978 } end end diff --git a/spec/factories/deploy_keys_projects.rb b/spec/factories/deploy_keys_projects.rb index 7f82902dee7fdf6b8237ee8cf05d5059139ba90d..2a429bf8e56aa3e81a413969381dd5675d059d08 100644 --- a/spec/factories/deploy_keys_projects.rb +++ b/spec/factories/deploy_keys_projects.rb @@ -6,7 +6,7 @@ project trait :write_access do - can_push true + can_push { true } end end end diff --git a/spec/factories/deploy_tokens.rb b/spec/factories/deploy_tokens.rb index 99486acc2ab3ac515872329a1822a9c657221082..42ed66ac1914edff71bae7c71bfd568ece5312f4 100644 --- a/spec/factories/deploy_tokens.rb +++ b/spec/factories/deploy_tokens.rb @@ -2,20 +2,20 @@ FactoryBot.define do factory :deploy_token do - token nil - token_encrypted { Gitlab::CryptoHelper.aes256_gcm_encrypt( SecureRandom.hex(50) ) } + token { nil } + token_encrypted { Gitlab::CryptoHelper.aes256_gcm_encrypt(SecureRandom.hex(50)) } sequence(:name) { |n| "PDT #{n}" } - read_repository true - read_registry true - revoked false + read_repository { true } + read_registry { true } + revoked { false } expires_at { 5.days.from_now } trait :revoked do - revoked true + revoked { true } end trait :gitlab_deploy_token do - name DeployToken::GITLAB_DEPLOY_TOKEN_NAME + name { DeployToken::GITLAB_DEPLOY_TOKEN_NAME } end trait :expired do diff --git a/spec/factories/deployments.rb b/spec/factories/deployments.rb index 50dc304a10ebe71d2723f051c53be423e7915ca5..f4da206990c3cfb0052dca420708386453db2de8 100644 --- a/spec/factories/deployments.rb +++ b/spec/factories/deployments.rb @@ -2,11 +2,11 @@ FactoryBot.define do factory :deployment, class: Deployment do - sha 'b83d6e391c22777fca1ed3012fce84f633d7fed0' - ref 'master' - tag false - user nil - project nil + sha { 'b83d6e391c22777fca1ed3012fce84f633d7fed0' } + ref { 'master' } + tag { false } + user { nil } + project { nil } deployable factory: :ci_build environment factory: :environment @@ -25,7 +25,7 @@ trait :review_app do sha { TestEnv::BRANCH_SHA['pages-deploy'] } - ref 'pages-deploy' + ref { 'pages-deploy' } end trait :on_cluster do @@ -33,21 +33,21 @@ end trait :running do - status :running + status { :running } end trait :success do - status :success + status { :success } finished_at { Time.now } end trait :failed do - status :failed + status { :failed } finished_at { Time.now } end trait :canceled do - status :canceled + status { :canceled } finished_at { Time.now } end diff --git a/spec/factories/environments.rb b/spec/factories/environments.rb index b5c8f0ca4f0f55982e44d9c1bac43c23cbb6b502..9286f49bc5978d96f97b7e5a6a5bc282864505bb 100644 --- a/spec/factories/environments.rb +++ b/spec/factories/environments.rb @@ -9,7 +9,7 @@ trait :with_review_app do |environment| transient do - ref 'master' + ref { 'master' } end # At this point `review app` is an ephemeral concept related to @@ -41,8 +41,8 @@ end trait :non_playable do - status 'created' - self.when 'manual' + status { 'created' } + self.when { 'manual' } end end end diff --git a/spec/factories/error_tracking/error.rb b/spec/factories/error_tracking/error.rb index ff883a3d22c14d5f471689228cfc656e779b3890..541bc410462a26e9c39ca8eb08ea550b764edff7 100644 --- a/spec/factories/error_tracking/error.rb +++ b/spec/factories/error_tracking/error.rb @@ -2,22 +2,22 @@ FactoryBot.define do factory :error_tracking_error, class: Gitlab::ErrorTracking::Error do - id 'id' - title 'title' - type 'error' - user_count 1 - count 2 + id { 'id' } + title { 'title' } + type { 'error' } + user_count { 1 } + count { 2 } first_seen { Time.now } last_seen { Time.now } - message 'message' - culprit 'culprit' - external_url 'http://example.com/id' - project_id 'project1' - project_name 'project name' - project_slug 'project_name' - short_id 'ID' - status 'unresolved' - frequency [] + message { 'message' } + culprit { 'culprit' } + external_url { 'http://example.com/id' } + project_id { 'project1' } + project_name { 'project name' } + project_slug { 'project_name' } + short_id { 'ID' } + status { 'unresolved' } + frequency { [] } skip_create end diff --git a/spec/factories/error_tracking/project.rb b/spec/factories/error_tracking/project.rb index 5e9219b241f3f4c86f9d5d1d8a21033ec5068c71..885d398d4332adbfe6f4e2a890b019f8a4bdd56b 100644 --- a/spec/factories/error_tracking/project.rb +++ b/spec/factories/error_tracking/project.rb @@ -2,13 +2,13 @@ FactoryBot.define do factory :error_tracking_project, class: Gitlab::ErrorTracking::Project do - id '1' - name 'Sentry Example' - slug 'sentry-example' - status 'active' - organization_name 'Sentry' - organization_id '1' - organization_slug 'sentry' + id { '1' } + name { 'Sentry Example' } + slug { 'sentry-example' } + status { 'active' } + organization_name { 'Sentry' } + organization_id { '1' } + organization_slug { 'sentry' } skip_create end diff --git a/spec/factories/events.rb b/spec/factories/events.rb index b15eb1592fc8095941be1c4ea387d3bfa67ba737..4eedcd02c9a0521e2827898072513ec4f0333953 100644 --- a/spec/factories/events.rb +++ b/spec/factories/events.rb @@ -4,19 +4,19 @@ factory :event do project author(factory: :user) { project.creator } - action Event::JOINED + action { Event::JOINED } - trait(:created) { action Event::CREATED } - trait(:updated) { action Event::UPDATED } - trait(:closed) { action Event::CLOSED } - trait(:reopened) { action Event::REOPENED } - trait(:pushed) { action Event::PUSHED } - trait(:commented) { action Event::COMMENTED } - trait(:merged) { action Event::MERGED } - trait(:joined) { action Event::JOINED } - trait(:left) { action Event::LEFT } - trait(:destroyed) { action Event::DESTROYED } - trait(:expired) { action Event::EXPIRED } + trait(:created) { action { Event::CREATED } } + trait(:updated) { action { Event::UPDATED } } + trait(:closed) { action { Event::CLOSED } } + trait(:reopened) { action { Event::REOPENED } } + trait(:pushed) { action { Event::PUSHED } } + trait(:commented) { action { Event::COMMENTED } } + trait(:merged) { action { Event::MERGED } } + trait(:joined) { action { Event::JOINED } } + trait(:left) { action { Event::LEFT } } + trait(:destroyed) { action { Event::DESTROYED } } + trait(:expired) { action { Event::EXPIRED } } factory :closed_issue_event do action { Event::CLOSED } @@ -27,15 +27,15 @@ factory :push_event, class: PushEvent do project factory: :project_empty_repo author(factory: :user) { project.creator } - action Event::PUSHED + action { Event::PUSHED } end factory :push_event_payload do event - commit_count 1 - action :pushed - ref_type :branch - ref 'master' - commit_to '3cdce97ed87c91368561584e7358f4d46e3e173c' + commit_count { 1 } + action { :pushed } + ref_type { :branch } + ref { 'master' } + commit_to { '3cdce97ed87c91368561584e7358f4d46e3e173c' } end end diff --git a/spec/factories/external_pull_requests.rb b/spec/factories/external_pull_requests.rb index 08d0fa4d41902a27a1a213afa2e888c051e84736..7a6e77f8572a7fde346e92c56086c834f91a3484 100644 --- a/spec/factories/external_pull_requests.rb +++ b/spec/factories/external_pull_requests.rb @@ -4,14 +4,14 @@ factory :external_pull_request do sequence(:pull_request_iid) project - source_branch 'feature' - source_repository 'the-repository' - source_sha '97de212e80737a608d939f648d959671fb0a0142' - target_branch 'master' - target_repository 'the-repository' - target_sha 'a09386439ca39abe575675ffd4b89ae824fec22f' - status :open + source_branch { 'feature' } + source_repository { 'the-repository' } + source_sha { '97de212e80737a608d939f648d959671fb0a0142' } + target_branch { 'master' } + target_repository { 'the-repository' } + target_sha { 'a09386439ca39abe575675ffd4b89ae824fec22f' } + status { :open } - trait(:closed) { status 'closed' } + trait(:closed) { status { 'closed'} } end end diff --git a/spec/factories/file_uploaders.rb b/spec/factories/file_uploaders.rb index ec8f5c9af2d61a92b20f891a8f0bcadf8f4ad773..dc888fdd535f9ffbdffc255941067df35b957ef7 100644 --- a/spec/factories/file_uploaders.rb +++ b/spec/factories/file_uploaders.rb @@ -5,7 +5,7 @@ skip_create project - secret nil + secret { nil } transient do fixture { 'rails_sample.jpg' } diff --git a/spec/factories/gpg_signature.rb b/spec/factories/gpg_signature.rb index a0fc1740d7734e6b6c47ab5c839c4d6ef96d7a85..2ab4d190276adbf891d0cee03a3ea39ba36a4ffa 100644 --- a/spec/factories/gpg_signature.rb +++ b/spec/factories/gpg_signature.rb @@ -6,6 +6,6 @@ project gpg_key gpg_key_primary_keyid { gpg_key.keyid } - verification_status :verified + verification_status { :verified } end end diff --git a/spec/factories/group_members.rb b/spec/factories/group_members.rb index a93f13395a2002157abb9eed54d6d40da9d6acfd..3c9d469f23cd736ea5d85bd8232395c3ec59e7f4 100644 --- a/spec/factories/group_members.rb +++ b/spec/factories/group_members.rb @@ -6,23 +6,23 @@ group user - trait(:guest) { access_level GroupMember::GUEST } - trait(:reporter) { access_level GroupMember::REPORTER } - trait(:developer) { access_level GroupMember::DEVELOPER } - trait(:maintainer) { access_level GroupMember::MAINTAINER } - trait(:owner) { access_level GroupMember::OWNER } + trait(:guest) { access_level { GroupMember::GUEST } } + trait(:reporter) { access_level { GroupMember::REPORTER } } + trait(:developer) { access_level { GroupMember::DEVELOPER } } + trait(:maintainer) { access_level { GroupMember::MAINTAINER } } + trait(:owner) { access_level { GroupMember::OWNER } } trait(:access_request) { requested_at { Time.now } } trait(:invited) do - user_id nil - invite_token 'xxx' + user_id { nil } + invite_token { 'xxx' } sequence :invite_email do |n| "email#{n}@email.com" end end trait(:ldap) do - ldap true + ldap { true } end trait :blocked do diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index d3c6101bad4dd2277fbfa16f5ce0f56939db5472..ba1a4883f85a78ce1287f44d61b987fdb811051b 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -4,9 +4,9 @@ factory :group, class: Group, parent: :namespace do sequence(:name) { |n| "group#{n}" } path { name.downcase.gsub(/\s/, '_') } - type 'Group' - owner nil - project_creation_level ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS + type { 'Group' } + owner { nil } + project_creation_level { ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS} after(:create) do |group| if group.owner @@ -17,15 +17,15 @@ end trait :public do - visibility_level Gitlab::VisibilityLevel::PUBLIC + visibility_level { Gitlab::VisibilityLevel::PUBLIC} end trait :internal do - visibility_level Gitlab::VisibilityLevel::INTERNAL + visibility_level {Gitlab::VisibilityLevel::INTERNAL} end trait :private do - visibility_level Gitlab::VisibilityLevel::PRIVATE + visibility_level { Gitlab::VisibilityLevel::PRIVATE} end trait :with_avatar do @@ -33,7 +33,7 @@ end trait :access_requestable do - request_access_enabled true + request_access_enabled { true } end trait :nested do @@ -41,15 +41,15 @@ end trait :auto_devops_enabled do - auto_devops_enabled true + auto_devops_enabled { true } end trait :auto_devops_disabled do - auto_devops_enabled false + auto_devops_enabled { false } end trait :owner_subgroup_creation_only do - subgroup_creation_level ::Gitlab::Access::OWNER_SUBGROUP_ACCESS + subgroup_creation_level { ::Gitlab::Access::OWNER_SUBGROUP_ACCESS} end end end diff --git a/spec/factories/identities.rb b/spec/factories/identities.rb index 21cfe7fe6239f8bc7cfb3c9b136b3fabe64e4fee..a2615ce30c32d791958e752d43c170a48bde4b3f 100644 --- a/spec/factories/identities.rb +++ b/spec/factories/identities.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :identity do - provider 'ldapmain' - extern_uid 'my-ldap-id' + provider { 'ldapmain' } + extern_uid { 'my-ldap-id' } end end diff --git a/spec/factories/import_states.rb b/spec/factories/import_states.rb index 8e778200389c7fd8608092fb7887ea6946a238d4..576f68ab57f5ef707da28599c1093440cbc49512 100644 --- a/spec/factories/import_states.rb +++ b/spec/factories/import_states.rb @@ -2,12 +2,12 @@ FactoryBot.define do factory :import_state, class: ProjectImportState do - status :none + status { :none } association :project, factory: :project transient do import_url { generate(:url) } - import_type nil + import_type { nil } end trait :repository do @@ -15,23 +15,23 @@ end trait :none do - status :none + status { :none } end trait :scheduled do - status :scheduled + status { :scheduled } end trait :started do - status :started + status { :started } end trait :finished do - status :finished + status { :finished } end trait :failed do - status :failed + status { :failed } end after(:create) do |import_state, evaluator| diff --git a/spec/factories/internal_ids.rb b/spec/factories/internal_ids.rb index df5c5beeb424e28fa6f2ec0da42dbb74a155b61a..bc6ea41ec06c6573004b7eb72d5a25a062c2079b 100644 --- a/spec/factories/internal_ids.rb +++ b/spec/factories/internal_ids.rb @@ -3,7 +3,7 @@ FactoryBot.define do factory :internal_id do project - usage :issues + usage { :issues } last_value { project.issues.maximum(:iid) || 0 } end end diff --git a/spec/factories/issues.rb b/spec/factories/issues.rb index 434225f7022d6b88bbb136efdcad27532cd6e384..70f480a3bcb3fbe57676001def5c225230ef4865 100644 --- a/spec/factories/issues.rb +++ b/spec/factories/issues.rb @@ -8,19 +8,19 @@ updated_by { author } trait :confidential do - confidential true + confidential { true } end trait :opened do - state :opened + state { :opened } end trait :locked do - discussion_locked true + discussion_locked { true } end trait :closed do - state :closed + state { :closed } closed_at { Time.now } end @@ -29,7 +29,7 @@ factory :labeled_issue do transient do - labels [] + labels { [] } end after(:create) do |issue, evaluator| diff --git a/spec/factories/labels.rb b/spec/factories/labels.rb index 3eed750be032df10cecb0e53d47edcb36cbdc6aa..89fcd8b1a9d9c05c7ba604eef41c6382b3c3c0df 100644 --- a/spec/factories/labels.rb +++ b/spec/factories/labels.rb @@ -3,14 +3,14 @@ FactoryBot.define do trait :base_label do title { generate(:label_title) } - color "#990000" + color { "#990000" } end factory :label, traits: [:base_label], class: ProjectLabel do project transient do - priority nil + priority { nil } end after(:create) do |label, evaluator| diff --git a/spec/factories/lfs_file_locks.rb b/spec/factories/lfs_file_locks.rb index 73675d076ab35bf9e110507cf2bcee46109f46d9..a676dabeff28e7b495250f4c4ea437c7364a4c93 100644 --- a/spec/factories/lfs_file_locks.rb +++ b/spec/factories/lfs_file_locks.rb @@ -4,6 +4,6 @@ factory :lfs_file_lock do user project - path 'README.md' + path { 'README.md' } end end diff --git a/spec/factories/lfs_objects.rb b/spec/factories/lfs_objects.rb index 631d87cfb12a33dd7325f6f988737a2c08113b06..35fc4db85192e571e0d3d101c27ef49d457a916d 100644 --- a/spec/factories/lfs_objects.rb +++ b/spec/factories/lfs_objects.rb @@ -5,7 +5,7 @@ FactoryBot.define do factory :lfs_object do sequence(:oid) { |n| "b68143e6463773b1b6c6fd009a76c32aeec041faff32ba2ed42fd7f708a%05x" % n } - size 499013 + size { 499013 } end trait :with_file do @@ -15,8 +15,8 @@ # The uniqueness constraint means we can't use the correct OID for all LFS # objects, so the test needs to decide which (if any) object gets it trait :correct_oid do - oid 'b804383982bb89b00e828e3f44c038cc991d3d1768009fc39ba8e2c081b9fb75' - size 1062 + oid { 'b804383982bb89b00e828e3f44c038cc991d3d1768009fc39ba8e2c081b9fb75' } + size { 1062 } end trait :object_storage do diff --git a/spec/factories/lfs_objects_projects.rb b/spec/factories/lfs_objects_projects.rb index 7b55cc57f7536fb68c2a4eebbc24d18a2df9ea98..7d3e61ea2b1e65d756a566e57e698e738c4ea2f9 100644 --- a/spec/factories/lfs_objects_projects.rb +++ b/spec/factories/lfs_objects_projects.rb @@ -4,6 +4,6 @@ factory :lfs_objects_project do lfs_object project - repository_type :project + repository_type { :project } end end diff --git a/spec/factories/lists.rb b/spec/factories/lists.rb index e68611ec518f1f73a023a7dab2b875137a4d81bb..8785d3f0468684f5a525766ccb53091d36580603 100644 --- a/spec/factories/lists.rb +++ b/spec/factories/lists.rb @@ -4,19 +4,19 @@ factory :list do board label - list_type :label + list_type { :label } sequence(:position) end factory :backlog_list, parent: :list do - list_type :backlog - label nil - position nil + list_type { :backlog } + label { nil } + position { nil } end factory :closed_list, parent: :list do - list_type :closed - label nil - position nil + list_type { :closed } + label { nil } + position { nil } end end diff --git a/spec/factories/merge_request_diff_files.rb b/spec/factories/merge_request_diff_files.rb index 469a7a0ac8d8e058f170f5c969e4b6b5f4ba0854..86eff445ec8d3093a2bd1798e9cd33960cf5894a 100644 --- a/spec/factories/merge_request_diff_files.rb +++ b/spec/factories/merge_request_diff_files.rb @@ -4,44 +4,44 @@ factory :merge_request_diff_file do association :merge_request_diff - relative_order 0 - new_file true - renamed_file false - deleted_file false - too_large false - a_mode 0 - b_mode 100644 - new_path 'foo' - old_path 'foo' - diff '' - binary false + relative_order { 0 } + new_file { true } + renamed_file { false } + deleted_file { false } + too_large { false } + a_mode { 0 } + b_mode { 100644 } + new_path { 'foo' } + old_path { 'foo' } + diff { '' } + binary { false } trait :new_file do - relative_order 0 - new_file true - renamed_file false - deleted_file false - too_large false - a_mode 0 - b_mode 100644 - new_path 'foo' - old_path 'foo' - diff '' - binary false + relative_order { 0 } + new_file { true } + renamed_file { false } + deleted_file { false } + too_large { false } + a_mode { 0 } + b_mode { 100644 } + new_path { 'foo' } + old_path { 'foo' } + diff { '' } + binary { false } end trait :renamed_file do - relative_order 662 - new_file false - renamed_file true - deleted_file false - too_large false - a_mode 100644 - b_mode 100644 - new_path 'bar' - old_path 'baz' - diff '' - binary false + relative_order { 662 } + new_file { false } + renamed_file { true } + deleted_file { false } + too_large { false } + a_mode { 100644 } + b_mode { 100644 } + new_path { 'bar' } + old_path { 'baz' } + diff { '' } + binary { false } end end end diff --git a/spec/factories/merge_request_diffs.rb b/spec/factories/merge_request_diffs.rb index e7b5118953811d4f7d2a6f00691cd10a20ed87bb..0c4c3244af5abb8be81733499e3dc691c9e42069 100644 --- a/spec/factories/merge_request_diffs.rb +++ b/spec/factories/merge_request_diffs.rb @@ -3,8 +3,8 @@ FactoryBot.define do factory :merge_request_diff do association :merge_request - state :collected - commits_count 1 + state { :collected } + commits_count { 1 } base_commit_sha { Digest::SHA1.hexdigest(SecureRandom.hex) } head_commit_sha { Digest::SHA1.hexdigest(SecureRandom.hex) } diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb index 3d12ff9825741b95bb38e73fc824841aaecdaddd..28a3f76d485668ed74959cf5f93c99d6a8b34e91 100644 --- a/spec/factories/merge_requests.rb +++ b/spec/factories/merge_requests.rb @@ -16,36 +16,36 @@ # # See also RepoHelpers.sample_compare # - source_branch "master" - target_branch "feature" + source_branch { "master" } + target_branch { "feature" } - merge_status "can_be_merged" + merge_status { "can_be_merged" } trait :with_diffs do end trait :with_image_diffs do - source_branch "add_images_and_changes" - target_branch "master" + source_branch { "add_images_and_changes" } + target_branch { "master" } end trait :without_diffs do - source_branch "improve/awesome" - target_branch "master" + source_branch { "improve/awesome" } + target_branch { "master" } end trait :conflict do - source_branch "feature_conflict" - target_branch "feature" + source_branch { "feature_conflict" } + target_branch { "feature" } end trait :merged do - state :merged + state { :merged } end trait :merged_target do - source_branch "merged-target" - target_branch "improve/awesome" + source_branch { "merged-target" } + target_branch { "improve/awesome" } end trait :merged_last_month do @@ -57,7 +57,7 @@ end trait :closed do - state :closed + state { :closed } end trait :closed_last_month do @@ -69,36 +69,36 @@ end trait :opened do - state :opened + state { :opened } end trait :invalid do - source_branch "feature_one" - target_branch "feature_two" + source_branch { "feature_one" } + target_branch { "feature_two" } end trait :locked do - state :locked + state { :locked } end trait :simple do - source_branch "feature" - target_branch "master" + source_branch { "feature" } + target_branch { "master" } end trait :rebased do - source_branch "markdown" - target_branch "improve/awesome" + source_branch { "markdown" } + target_branch { "improve/awesome" } end trait :diverged do - source_branch "feature" - target_branch "master" + source_branch { "feature" } + target_branch { "master" } end trait :merge_when_pipeline_succeeds do - auto_merge_enabled true - auto_merge_strategy AutoMergeService::STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS + auto_merge_enabled { true } + auto_merge_strategy { AutoMergeService::STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS } merge_user { author } end @@ -162,7 +162,7 @@ end trait :deployed_review_app do - target_branch 'pages-deploy-target' + target_branch { 'pages-deploy-target' } transient do deployment { create(:deployment, :review_app) } @@ -203,7 +203,7 @@ factory :labeled_merge_request do transient do - labels [] + labels { [] } end after(:create) do |merge_request, evaluator| diff --git a/spec/factories/milestones.rb b/spec/factories/milestones.rb index 7d623000fc97753c28016ffc9ec511b80779b0e2..75ff925774aa4cd79f7d9cbd403bf7757dbc7dd3 100644 --- a/spec/factories/milestones.rb +++ b/spec/factories/milestones.rb @@ -5,19 +5,19 @@ title transient do - project nil - group nil - project_id nil - group_id nil - parent nil + project { nil } + group { nil } + project_id { nil } + group_id { nil } + parent { nil } end trait :active do - state "active" + state { "active" } end trait :closed do - state "closed" + state { "closed" } end trait :with_dates do diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb index 5b9a7e6f864bc2a53da1549b1e236a01c8da97b9..8304b718136ab0c603750c50502e3d33e0837616 100644 --- a/spec/factories/notes.rb +++ b/spec/factories/notes.rb @@ -41,14 +41,14 @@ factory :legacy_diff_note_on_merge_request, traits: [:on_merge_request, :legacy_diff_note], class: LegacyDiffNote do association :project, :repository - position '' + position { '' } end factory :diff_note_on_merge_request, traits: [:on_merge_request], class: DiffNote do association :project, :repository transient do - line_number 14 + line_number { 14 } diff_refs { noteable.try(:diff_refs) } end @@ -87,7 +87,7 @@ association :project, :repository transient do - line_number 14 + line_number { 14 } diff_refs { project.commit(commit_id).try(:diff_refs) } end @@ -104,14 +104,14 @@ trait :on_commit do association :project, :repository - noteable nil - noteable_type 'Commit' - noteable_id nil + noteable { nil } + noteable_type { 'Commit' } + noteable_id { nil } commit_id { RepoHelpers.sample_commit.id } end trait :legacy_diff_note do - line_code "0_184_184" + line_code { "0_184_184" } end trait :on_issue do @@ -132,19 +132,19 @@ trait :on_personal_snippet do noteable { create(:personal_snippet) } - project nil + project { nil } end trait :system do - system true + system { true } end trait :downvote do - note "thumbsdown" + note { "thumbsdown" } end trait :upvote do - note "thumbsup" + note { "thumbsup" } end trait :with_attachment do @@ -156,7 +156,7 @@ end transient do - in_reply_to nil + in_reply_to { nil } end before(:create) do |note, evaluator| diff --git a/spec/factories/notification_settings.rb b/spec/factories/notification_settings.rb index c16b0e456ba501af61c49d14bb82d4c3fec9bd04..025120fefc1167bbd324d1bdaa203e4cad5cfe07 100644 --- a/spec/factories/notification_settings.rb +++ b/spec/factories/notification_settings.rb @@ -4,6 +4,6 @@ factory :notification_setting do source factory: :project user - level 3 + level { 3 } end end diff --git a/spec/factories/oauth_applications.rb b/spec/factories/oauth_applications.rb index 4748b320298a934357187a21f829a8a952376cf1..aff32805f03e9b992e65d6d9ca6f34713058998b 100644 --- a/spec/factories/oauth_applications.rb +++ b/spec/factories/oauth_applications.rb @@ -6,6 +6,6 @@ uid { Doorkeeper::OAuth::Helpers::UniqueToken.generate } redirect_uri { generate(:url) } owner - owner_type 'User' + owner_type { 'User' } end end diff --git a/spec/factories/pages_domains.rb b/spec/factories/pages_domains.rb index ae3988bdd697e97100cbaccca5f7da3c9ef08061..91423832888c15793dbc80e9def362ac67e530b6 100644 --- a/spec/factories/pages_domains.rb +++ b/spec/factories/pages_domains.rb @@ -6,7 +6,8 @@ verified_at { Time.now } enabled_until { 1.week.from_now } - certificate '-----BEGIN CERTIFICATE----- + certificate do + '-----BEGIN CERTIFICATE----- MIICGzCCAYSgAwIBAgIBATANBgkqhkiG9w0BAQUFADAbMRkwFwYDVQQDExB0ZXN0 LWNlcnRpZmljYXRlMB4XDTE2MDIxMjE0MzIwMFoXDTIwMDQxMjE0MzIwMFowGzEZ MBcGA1UEAxMQdGVzdC1jZXJ0aWZpY2F0ZTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw @@ -20,8 +21,10 @@ 5A4K65Nb7Oh1AdQieTBHNXXCdyFsva9/ScfQGEl7p55a52jOPs0StPd7g64uvjlg YHi2yesCrOvVXt+lgPTd -----END CERTIFICATE-----' + end - key '-----BEGIN PRIVATE KEY----- + key do + '-----BEGIN PRIVATE KEY----- MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKS+CfS9GcRSdYSN SzyH5QJQBr5umRL6E+KilOV39iYFO/9oHjUdapTRWkrwnNPCp7qaeck4Jr8iv14t PVNDfNr76eGb6/3YknOAP0QOjLWunoC8kjU+N/JHU52NrUeX3qEy8EKV9LeCDJcB @@ -37,10 +40,11 @@ 63BDJEwvOb2IaP8lDDxNsXx9XJNVvQbv5n15vNsLHbjslHfAhAbxnLQ1fLhUPqSi nNp/xedE1YxutQ== -----END PRIVATE KEY-----' + end trait :disabled do - verified_at nil - enabled_until nil + verified_at { nil } + enabled_until { nil } end trait :scheduled_for_removal do @@ -52,7 +56,7 @@ end trait :unverified do - verified_at nil + verified_at { nil } end trait :reverify do @@ -64,17 +68,18 @@ end trait :without_certificate do - certificate nil + certificate { nil } end trait :without_key do - key nil + key { nil } end trait :with_missing_chain do # This certificate is signed with different key # And misses the CA to build trust chain - certificate '-----BEGIN CERTIFICATE----- + certificate do + '-----BEGIN CERTIFICATE----- MIIDGTCCAgGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADASMRAwDgYDVQQDEwdUZXN0 IENBMB4XDTE2MDIxMjE0MjMwMFoXDTE3MDIxMTE0MjMwMFowHTEbMBkGA1UEAxMS dGVzdC1jZXJ0aWZpY2F0ZS0yMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC @@ -93,13 +98,15 @@ m4AEaojTljX1tMJAF9Rbiw/omam5bDPq2JWtosrz/zB69y5FaQjc6FnCk0M4oN/+ VM+d42lQAgoq318A84Xu5vRh1KCAJuztkhNbM+w= -----END CERTIFICATE-----' + end end trait :with_trusted_chain do # This contains # [Intermediate #2 (SHA-2)] 'Comodo RSA Domain Validation Secure Server CA' # [Intermediate #1 (SHA-2)] 'COMODO RSA Certification Authority' - certificate '-----BEGIN CERTIFICATE----- + certificate do + '-----BEGIN CERTIFICATE----- MIIGCDCCA/CgAwIBAgIQKy5u6tl1NmwUim7bo3yMBzANBgkqhkiG9w0BAQwFADCB hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV @@ -166,13 +173,15 @@ PUsE2JOAWVrgQSQdso8VYFhH2+9uRv0V9dlfmrPb2LjkQLPNlzmuhbsdjrzch5vR pu/xO28QOG8= -----END CERTIFICATE-----' + end end trait :with_trusted_expired_chain do # This contains # Let's Encrypt Authority X3 # DST Root CA X3 - certificate '-----BEGIN CERTIFICATE----- + certificate do + '-----BEGIN CERTIFICATE----- MIIFSjCCBDKgAwIBAgISAw24xGWrFotvTBa6AZI/pzq1MA0GCSqGSIb3DQEBCwUA MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xOTAzMDcxNzU5NTZaFw0x @@ -250,10 +259,12 @@ JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYo Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ -----END CERTIFICATE-----' + end end trait :with_expired_certificate do - certificate '-----BEGIN CERTIFICATE----- + certificate do + '-----BEGIN CERTIFICATE----- MIIBsDCCARmgAwIBAgIBATANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNleHBp cmVkLWNlcnRpZmljYXRlMB4XDTE1MDIxMjE0MzMwMFoXDTE2MDIwMTE0MzMwMFow HjEcMBoGA1UEAxMTZXhwaXJlZC1jZXJ0aWZpY2F0ZTCBnzANBgkqhkiG9w0BAQEF @@ -265,6 +276,7 @@ Iy6oRpHaCF/2obZdIdgf9rlyz0fkqyHJc9GkioSoOhJZxEV2SgAkap8yS0sX2tJ9 ZDXgrA== -----END CERTIFICATE-----' + end end trait :letsencrypt do @@ -273,7 +285,8 @@ end trait :explicit_ecdsa do - certificate '-----BEGIN CERTIFICATE----- + certificate do + '-----BEGIN CERTIFICATE----- MIID1zCCAzkCCQDatOIwBlktwjAKBggqhkjOPQQDAjBPMQswCQYDVQQGEwJVUzEL MAkGA1UECAwCTlkxCzAJBgNVBAcMAk5ZMQswCQYDVQQLDAJJVDEZMBcGA1UEAwwQ dGVzdC1jZXJ0aWZpY2F0ZTAeFw0xOTA4MjkxMTE1NDBaFw0yMTA4MjgxMTE1NDBa @@ -296,8 +309,10 @@ V3ZJgam8EQJCAcnPpJQ0IqoT1pAQkaL3+Ka8ZaaCd6/8RnoDtGvWljisuyH65SRu kmYv87bZe1KqOZDoaDBdfVsoxcGbik19lBPV -----END CERTIFICATE-----' + end - key '-----BEGIN EC PARAMETERS----- + key do + '-----BEGIN EC PARAMETERS----- MIIBwgIBATBNBgcqhkjOPQEBAkIB//////////////////////////////////// //////////////////////////////////////////////////8wgZ4EQgH///// //////////////////////////////////////////////////////////////// @@ -326,10 +341,12 @@ +Iu6YSMSWFwExlVeJeFvm3F/XW5cBafmfpCF7Llgo8w2MsuoOpobX158IsJ3bUDR Nw== -----END EC PRIVATE KEY-----' + end end trait :ecdsa do - certificate '-----BEGIN CERTIFICATE----- + certificate do + '-----BEGIN CERTIFICATE----- MIIB8zCCAVUCCQCGKuPQ6SBxUTAKBggqhkjOPQQDAjA+MQswCQYDVQQGEwJVUzEL MAkGA1UECAwCVVMxCzAJBgNVBAcMAlVTMRUwEwYDVQQDDAxzaHVzaGxpbi5kZXYw HhcNMTkwOTAyMDkyMDUxWhcNMjEwOTAxMDkyMDUxWjA+MQswCQYDVQQGEwJVUzEL @@ -342,8 +359,10 @@ 1ZXdAkIBuVtm9RJXziNOKS4TcpH9os/FuREW8YQlpec58LDZdlivcHnikHZ4LCri T7zu3VY6Rq+V/IKpsQwQjmoTJ0IpCM8= -----END CERTIFICATE-----' + end - key '-----BEGIN EC PARAMETERS----- + key do + '-----BEGIN EC PARAMETERS----- BgUrgQQAIw== -----END EC PARAMETERS----- -----BEGIN EC PRIVATE KEY----- @@ -353,6 +372,7 @@ Da9qZifIFmpsv5xNAGxDvANQRpLI/RHc/hvo7HfjuljNfBJ1I6tr0KbhMxB76mtU x6zG6WoibsbsJMj70nwseUnPTBQNDP+j61RJjC/r -----END EC PRIVATE KEY-----' + end end end end diff --git a/spec/factories/personal_access_tokens.rb b/spec/factories/personal_access_tokens.rb index cc9b2328705f5463f43456c87588a9aab658c461..d8ff2e086572748da6f13ae0f8092a4e1781fed1 100644 --- a/spec/factories/personal_access_tokens.rb +++ b/spec/factories/personal_access_tokens.rb @@ -4,19 +4,19 @@ factory :personal_access_token do user sequence(:name) { |n| "PAT #{n}" } - revoked false + revoked { false } expires_at { 5.days.from_now } - scopes ['api'] - impersonation false + scopes { ['api'] } + impersonation { false } after(:build) { |personal_access_token| personal_access_token.ensure_token } trait :impersonation do - impersonation true + impersonation { true } end trait :revoked do - revoked true + revoked { true } end trait :expired do @@ -24,7 +24,7 @@ end trait :invalid do - token_digest nil + token_digest { nil } end end end diff --git a/spec/factories/pool_repositories.rb b/spec/factories/pool_repositories.rb index 7a8946d47b0fc123ba606e2878acd4dd0512d52c..f0905d28c703b11cdd49d86082d67d4956d9c5b5 100644 --- a/spec/factories/pool_repositories.rb +++ b/spec/factories/pool_repositories.rb @@ -3,7 +3,7 @@ FactoryBot.define do factory :pool_repository do shard { Shard.by_name("default") } - state :none + state { :none } before(:create) do |pool| pool.source_project = create(:project, :repository) @@ -11,19 +11,19 @@ end trait :scheduled do - state :scheduled + state { :scheduled } end trait :failed do - state :failed + state { :failed } end trait :obsolete do - state :obsolete + state { :obsolete } end trait :ready do - state :ready + state { :ready } after(:create) do |pool| pool.create_object_pool diff --git a/spec/factories/programming_languages.rb b/spec/factories/programming_languages.rb index ee8e7765ec9488ac86f9bf3db14eda8cd0e55d6b..7baa63cd4f8b301a09edc8f026a240ecd1cfcc48 100644 --- a/spec/factories/programming_languages.rb +++ b/spec/factories/programming_languages.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :programming_language do - name 'Ruby' - color '#123456' + name { 'Ruby' } + color { '#123456' } end end diff --git a/spec/factories/project_auto_devops.rb b/spec/factories/project_auto_devops.rb index 4cc59c7095c1c1c0a816de03078e8a3f6ac276cd..c87de30211c3e8a718ef4fa6175155d80cf8a2bf 100644 --- a/spec/factories/project_auto_devops.rb +++ b/spec/factories/project_auto_devops.rb @@ -3,23 +3,23 @@ FactoryBot.define do factory :project_auto_devops do project - enabled true - deploy_strategy :continuous + enabled { true } + deploy_strategy { :continuous } trait :continuous_deployment do - deploy_strategy ProjectAutoDevops.deploy_strategies[:continuous] # rubocop:disable FactoryBot/DynamicAttributeDefinedStatically + deploy_strategy { ProjectAutoDevops.deploy_strategies[:continuous] } end trait :manual_deployment do - deploy_strategy ProjectAutoDevops.deploy_strategies[:manual] # rubocop:disable FactoryBot/DynamicAttributeDefinedStatically + deploy_strategy { ProjectAutoDevops.deploy_strategies[:manual] } end trait :timed_incremental_deployment do - deploy_strategy ProjectAutoDevops.deploy_strategies[:timed_incremental] # rubocop:disable FactoryBot/DynamicAttributeDefinedStatically + deploy_strategy { ProjectAutoDevops.deploy_strategies[:timed_incremental] } end trait :disabled do - enabled false + enabled { false } end end end diff --git a/spec/factories/project_daily_statistics.rb b/spec/factories/project_daily_statistics.rb index 7e4142fa4012f3a32a393a0b04bd3a843c3f0483..7aeee55c32762d204a3b7fd2c5bfc8894ba6fef7 100644 --- a/spec/factories/project_daily_statistics.rb +++ b/spec/factories/project_daily_statistics.rb @@ -3,6 +3,6 @@ FactoryBot.define do factory :project_daily_statistic do project - fetch_count 1 + fetch_count { 1 } end end diff --git a/spec/factories/project_error_tracking_settings.rb b/spec/factories/project_error_tracking_settings.rb index be30bd0260a8639232b2ce1ec0709fa4967fb174..f90a2d17846139ae95b5ebf69a6cf7b0253dbc8d 100644 --- a/spec/factories/project_error_tracking_settings.rb +++ b/spec/factories/project_error_tracking_settings.rb @@ -3,10 +3,10 @@ FactoryBot.define do factory :project_error_tracking_setting, class: ErrorTracking::ProjectErrorTrackingSetting do project - api_url 'https://gitlab.com/api/0/projects/sentry-org/sentry-project' - enabled true - token 'access_token_123' - project_name 'Sentry Project' - organization_name 'Sentry Org' + api_url { 'https://gitlab.com/api/0/projects/sentry-org/sentry-project' } + enabled { true } + token { 'access_token_123' } + project_name { 'Sentry Project' } + organization_name { 'Sentry Org' } end end diff --git a/spec/factories/project_group_links.rb b/spec/factories/project_group_links.rb index b02d167a950157b491177493fae67013fb5c1eea..3c8c7a34680f4de998c76fd0ac578410212b5a9c 100644 --- a/spec/factories/project_group_links.rb +++ b/spec/factories/project_group_links.rb @@ -4,6 +4,6 @@ factory :project_group_link do project group - expires_at nil + expires_at { nil } end end diff --git a/spec/factories/project_hooks.rb b/spec/factories/project_hooks.rb index 96c9742c7d0aba5d3137889ed3c3d19d973bf9f3..6592141e26dc731809dd255490be2510865036ad 100644 --- a/spec/factories/project_hooks.rb +++ b/spec/factories/project_hooks.rb @@ -3,7 +3,7 @@ FactoryBot.define do factory :project_hook do url { generate(:url) } - enable_ssl_verification false + enable_ssl_verification { false } project trait :token do @@ -11,16 +11,16 @@ end trait :all_events_enabled do - push_events true - merge_requests_events true - tag_push_events true - issues_events true - confidential_issues_events true - note_events true - confidential_note_events true - job_events true - pipeline_events true - wiki_page_events true + push_events { true } + merge_requests_events { true } + tag_push_events { true } + issues_events { true } + confidential_issues_events { true } + note_events { true } + confidential_note_events { true } + job_events { true } + pipeline_events { true } + wiki_page_events { true } end end end diff --git a/spec/factories/project_members.rb b/spec/factories/project_members.rb index 723fa6058fe1963781a94195afe24e7e06a24f9b..e7004937be31ba1b21ba4d9947e3580169a36c6d 100644 --- a/spec/factories/project_members.rb +++ b/spec/factories/project_members.rb @@ -6,16 +6,16 @@ project maintainer - trait(:guest) { access_level ProjectMember::GUEST } - trait(:reporter) { access_level ProjectMember::REPORTER } - trait(:developer) { access_level ProjectMember::DEVELOPER } - trait(:maintainer) { access_level ProjectMember::MAINTAINER } + trait(:guest) { access_level { ProjectMember::GUEST } } + trait(:reporter) { access_level { ProjectMember::REPORTER } } + trait(:developer) { access_level { ProjectMember::DEVELOPER } } + trait(:maintainer) { access_level { ProjectMember::MAINTAINER } } trait(:access_request) { requested_at { Time.now } } trait(:invited) do - user_id nil - invite_token 'xxx' - invite_email 'email@email.com' + user_id { nil } + invite_token { 'xxx' } + invite_email { 'email@email.com' } end trait :blocked do diff --git a/spec/factories/project_metrics_settings.rb b/spec/factories/project_metrics_settings.rb index 234753f9b87894d285d56172dd52a9feff52a561..51b2ce0e0e9825f9ca90a1eb2481bc55f79f519e 100644 --- a/spec/factories/project_metrics_settings.rb +++ b/spec/factories/project_metrics_settings.rb @@ -3,6 +3,6 @@ FactoryBot.define do factory :project_metrics_setting, class: ProjectMetricsSetting do project - external_dashboard_url 'https://grafana.com' + external_dashboard_url { 'https://grafana.com' } end end diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index ea89555b0d5eee3b424122dcb2cddacaa69536d6..ae1feb73e4de0feaedb4b21c51824d3c1a4970bc 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -13,7 +13,7 @@ sequence(:name) { |n| "project#{n}" } path { name.downcase.gsub(/\s/, '_') } # Behaves differently to nil due to cache_has_external_issue_tracker - has_external_issue_tracker false + has_external_issue_tracker { false } # Associations namespace @@ -21,21 +21,21 @@ transient do # Nest Project Feature attributes - wiki_access_level ProjectFeature::ENABLED - builds_access_level ProjectFeature::ENABLED - snippets_access_level ProjectFeature::ENABLED - issues_access_level ProjectFeature::ENABLED - merge_requests_access_level ProjectFeature::ENABLED - repository_access_level ProjectFeature::ENABLED + wiki_access_level { ProjectFeature::ENABLED } + builds_access_level { ProjectFeature::ENABLED } + snippets_access_level { ProjectFeature::ENABLED } + issues_access_level { ProjectFeature::ENABLED } + merge_requests_access_level { ProjectFeature::ENABLED } + repository_access_level { ProjectFeature::ENABLED } pages_access_level do visibility_level == Gitlab::VisibilityLevel::PUBLIC ? ProjectFeature::ENABLED : ProjectFeature::PRIVATE end # we can't assign the delegated `#ci_cd_settings` attributes directly, as the # `#ci_cd_settings` relation needs to be created first - group_runners_enabled nil - import_status nil - import_jid nil + group_runners_enabled { nil } + import_status { nil } + import_jid { nil } end after(:create) do |project, evaluator| @@ -80,45 +80,45 @@ end trait :public do - visibility_level Gitlab::VisibilityLevel::PUBLIC + visibility_level { Gitlab::VisibilityLevel::PUBLIC } end trait :internal do - visibility_level Gitlab::VisibilityLevel::INTERNAL + visibility_level { Gitlab::VisibilityLevel::INTERNAL } end trait :private do - visibility_level Gitlab::VisibilityLevel::PRIVATE + visibility_level { Gitlab::VisibilityLevel::PRIVATE } end trait :import_scheduled do - import_status :scheduled + import_status { :scheduled } end trait :import_started do - import_status :started + import_status { :started } end trait :import_finished do - import_status :finished + import_status { :finished } end trait :import_failed do - import_status :failed + import_status { :failed } end trait :archived do - archived true + archived { true } end - storage_version Project::LATEST_STORAGE_VERSION + storage_version { Project::LATEST_STORAGE_VERSION } trait :legacy_storage do - storage_version nil + storage_version { nil } end trait :access_requestable do - request_access_enabled true + request_access_enabled { true } end trait :with_avatar do @@ -146,7 +146,7 @@ # will create a repository containing two files, and two commits, in master trait :custom_repo do transient do - files {} + files { {} } end after :create do |project, evaluator| @@ -169,7 +169,7 @@ test_repo transient do - create_templates nil + create_templates { nil } end after :create do |project, evaluator| @@ -206,9 +206,9 @@ trait :remote_mirror do transient do - remote_name "remote_mirror_#{SecureRandom.hex}" - url "http://foo.com" - enabled true + remote_name { "remote_mirror_#{SecureRandom.hex}" } + url { "http://foo.com" } + enabled { true } end after(:create) do |project, evaluator| project.remote_mirrors.create!(url: evaluator.url, enabled: evaluator.enabled) @@ -229,7 +229,7 @@ end trait :read_only do - repository_read_only true + repository_read_only { true } end trait :broken_repo do @@ -249,29 +249,29 @@ end end - trait(:wiki_enabled) { wiki_access_level ProjectFeature::ENABLED } - trait(:wiki_disabled) { wiki_access_level ProjectFeature::DISABLED } - trait(:wiki_private) { wiki_access_level ProjectFeature::PRIVATE } - trait(:builds_enabled) { builds_access_level ProjectFeature::ENABLED } - trait(:builds_disabled) { builds_access_level ProjectFeature::DISABLED } - trait(:builds_private) { builds_access_level ProjectFeature::PRIVATE } - trait(:snippets_enabled) { snippets_access_level ProjectFeature::ENABLED } - trait(:snippets_disabled) { snippets_access_level ProjectFeature::DISABLED } - trait(:snippets_private) { snippets_access_level ProjectFeature::PRIVATE } - trait(:issues_disabled) { issues_access_level ProjectFeature::DISABLED } - trait(:issues_enabled) { issues_access_level ProjectFeature::ENABLED } - trait(:issues_private) { issues_access_level ProjectFeature::PRIVATE } - trait(:merge_requests_enabled) { merge_requests_access_level ProjectFeature::ENABLED } - trait(:merge_requests_disabled) { merge_requests_access_level ProjectFeature::DISABLED } - trait(:merge_requests_private) { merge_requests_access_level ProjectFeature::PRIVATE } - trait(:merge_requests_public) { merge_requests_access_level ProjectFeature::PUBLIC } - trait(:repository_enabled) { repository_access_level ProjectFeature::ENABLED } - trait(:repository_disabled) { repository_access_level ProjectFeature::DISABLED } - trait(:repository_private) { repository_access_level ProjectFeature::PRIVATE } - trait(:pages_public) { pages_access_level ProjectFeature::PUBLIC } - trait(:pages_enabled) { pages_access_level ProjectFeature::ENABLED } - trait(:pages_disabled) { pages_access_level ProjectFeature::DISABLED } - trait(:pages_private) { pages_access_level ProjectFeature::PRIVATE } + trait(:wiki_enabled) { wiki_access_level { ProjectFeature::ENABLED } } + trait(:wiki_disabled) { wiki_access_level { ProjectFeature::DISABLED } } + trait(:wiki_private) { wiki_access_level { ProjectFeature::PRIVATE } } + trait(:builds_enabled) { builds_access_level { ProjectFeature::ENABLED } } + trait(:builds_disabled) { builds_access_level { ProjectFeature::DISABLED } } + trait(:builds_private) { builds_access_level { ProjectFeature::PRIVATE } } + trait(:snippets_enabled) { snippets_access_level { ProjectFeature::ENABLED } } + trait(:snippets_disabled) { snippets_access_level { ProjectFeature::DISABLED } } + trait(:snippets_private) { snippets_access_level { ProjectFeature::PRIVATE } } + trait(:issues_disabled) { issues_access_level { ProjectFeature::DISABLED } } + trait(:issues_enabled) { issues_access_level { ProjectFeature::ENABLED } } + trait(:issues_private) { issues_access_level { ProjectFeature::PRIVATE } } + trait(:merge_requests_enabled) { merge_requests_access_level { ProjectFeature::ENABLED } } + trait(:merge_requests_disabled) { merge_requests_access_level { ProjectFeature::DISABLED } } + trait(:merge_requests_private) { merge_requests_access_level { ProjectFeature::PRIVATE } } + trait(:merge_requests_public) { merge_requests_access_level { ProjectFeature::PUBLIC } } + trait(:repository_enabled) { repository_access_level { ProjectFeature::ENABLED } } + trait(:repository_disabled) { repository_access_level { ProjectFeature::DISABLED } } + trait(:repository_private) { repository_access_level { ProjectFeature::PRIVATE } } + trait(:pages_public) { pages_access_level { ProjectFeature::PUBLIC } } + trait(:pages_enabled) { pages_access_level { ProjectFeature::ENABLED } } + trait(:pages_disabled) { pages_access_level { ProjectFeature::DISABLED } } + trait(:pages_private) { pages_access_level { ProjectFeature::PRIVATE } } trait :auto_devops do association :auto_devops, factory: :project_auto_devops @@ -308,19 +308,19 @@ end factory :redmine_project, parent: :project do - has_external_issue_tracker true + has_external_issue_tracker { true } redmine_service end factory :youtrack_project, parent: :project do - has_external_issue_tracker true + has_external_issue_tracker { true } youtrack_service end factory :jira_project, parent: :project do - has_external_issue_tracker true + has_external_issue_tracker { true } jira_service end diff --git a/spec/factories/prometheus_metrics.rb b/spec/factories/prometheus_metrics.rb index c56644bfb9683e59e5b6be77c86f9a980397f53d..f6b58cf84c3479cebfd5eeac0f5687e7e3282a7b 100644 --- a/spec/factories/prometheus_metrics.rb +++ b/spec/factories/prometheus_metrics.rb @@ -2,17 +2,17 @@ FactoryBot.define do factory :prometheus_metric, class: PrometheusMetric do - title 'title' - query 'avg(metric)' - y_label 'y_label' - unit 'm/s' - group :business + title { 'title' } + query { 'avg(metric)' } + y_label { 'y_label' } + unit { 'm/s' } + group { :business } project - legend 'legend' + legend { 'legend' } trait :common do - common true - project nil + common { true } + project { nil } end end end diff --git a/spec/factories/protected_branches.rb b/spec/factories/protected_branches.rb index 741615bc0d3d7344ceb8bfb51c68abfe3cb02588..2d3abc77350e36a9cf4686f196a68242ccb00084 100644 --- a/spec/factories/protected_branches.rb +++ b/spec/factories/protected_branches.rb @@ -6,14 +6,14 @@ project transient do - default_push_level true - default_merge_level true - default_access_level true + default_push_level { true } + default_merge_level { true } + default_access_level { true } end trait :developers_can_push do transient do - default_push_level false + default_push_level { false } end after(:build) do |protected_branch| @@ -23,7 +23,7 @@ trait :developers_can_merge do transient do - default_merge_level false + default_merge_level { false } end after(:build) do |protected_branch| @@ -33,7 +33,7 @@ trait :no_one_can_push do transient do - default_push_level false + default_push_level { false } end after(:build) do |protected_branch| @@ -43,7 +43,7 @@ trait :maintainers_can_push do transient do - default_push_level false + default_push_level { false } end after(:build) do |protected_branch| diff --git a/spec/factories/protected_tags.rb b/spec/factories/protected_tags.rb index 6ff2a245b584606c4713e6a35da6286e85536ac5..3859267ecafad79620b63a75ba06208d8291801a 100644 --- a/spec/factories/protected_tags.rb +++ b/spec/factories/protected_tags.rb @@ -6,12 +6,12 @@ project transient do - default_access_level true + default_access_level { true } end trait :developers_can_create do transient do - default_access_level false + default_access_level { false } end after(:build) do |protected_tag| @@ -21,7 +21,7 @@ trait :no_one_can_create do transient do - default_access_level false + default_access_level { false } end after(:build) do |protected_tag| @@ -31,7 +31,7 @@ trait :maintainers_can_create do transient do - default_access_level false + default_access_level { false } end after(:build) do |protected_tag| diff --git a/spec/factories/releases.rb b/spec/factories/releases.rb index 34794f572848cc23df10922cbf1b2d631c985d9b..2f77bb95ea3003cf38088e05bc382612f6dc9c90 100644 --- a/spec/factories/releases.rb +++ b/spec/factories/releases.rb @@ -2,17 +2,17 @@ FactoryBot.define do factory :release do - tag "v1.1.0" - sha 'b83d6e391c22777fca1ed3012fce84f633d7fed0' + tag { "v1.1.0" } + sha { 'b83d6e391c22777fca1ed3012fce84f633d7fed0' } name { tag } - description "Awesome release" + description { "Awesome release" } project author released_at { Time.zone.parse('2018-10-20T18:00:00Z') } trait :legacy do - sha nil - author nil + sha { nil } + author { nil } end end end diff --git a/spec/factories/remote_mirrors.rb b/spec/factories/remote_mirrors.rb index ff1d751c86c8525262b6c34ab4c78c22f3bb5b8d..124c0510cabb296d721179ea4e2043dbb270fe06 100644 --- a/spec/factories/remote_mirrors.rb +++ b/spec/factories/remote_mirrors.rb @@ -3,6 +3,6 @@ FactoryBot.define do factory :remote_mirror, class: 'RemoteMirror' do association :project, :repository - url "http://foo:bar@test.com" + url { "http://foo:bar@test.com" } end end diff --git a/spec/factories/repository_languages.rb b/spec/factories/repository_languages.rb index b2b17ebbce22fa938570c8f858199ec802b02b5f..884298033ac28e1e21865dda37c57e22c74330c3 100644 --- a/spec/factories/repository_languages.rb +++ b/spec/factories/repository_languages.rb @@ -4,6 +4,6 @@ factory :repository_language do project programming_language - share 98.5 + share { 98.5 } end end diff --git a/spec/factories/resource_label_events.rb b/spec/factories/resource_label_events.rb index 739ba90105281e6a032feaaa91ab9d46f43631e6..b59da465fc322d683cb48b862c7bbd59d65d006d 100644 --- a/spec/factories/resource_label_events.rb +++ b/spec/factories/resource_label_events.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :resource_label_event do - action :add + action { :add } label user { issuable&.author || create(:user) } diff --git a/spec/factories/services.rb b/spec/factories/services.rb index e063b888d77ddc1765db58295400984ce7d958e0..f9c77dbf87f5f3bd71de05475a1127a9b5ff65f3 100644 --- a/spec/factories/services.rb +++ b/spec/factories/services.rb @@ -3,54 +3,58 @@ FactoryBot.define do factory :service do project - type 'Service' + type { 'Service' } end factory :custom_issue_tracker_service, class: CustomIssueTrackerService do project - active true + active { true } issue_tracker end factory :emails_on_push_service do project - type 'EmailsOnPushService' - active true - push_events true - tag_push_events true - properties( - recipients: 'test@example.com', - disable_diffs: true, - send_from_committer_email: true - ) + type { 'EmailsOnPushService' } + active { true } + push_events { true } + tag_push_events { true } + properties do + { + recipients: 'test@example.com', + disable_diffs: true, + send_from_committer_email: true + } + end end factory :mock_deployment_service do project - type 'MockDeploymentService' - active true + type { 'MockDeploymentService' } + active { true } end factory :prometheus_service do project - active true - properties({ - api_url: 'https://prometheus.example.com/', - manual_configuration: true - }) + active { true } + properties do + { + api_url: 'https://prometheus.example.com/', + manual_configuration: true + } + end end factory :jira_service do project - active true + active { true } transient do - create_data true - url 'https://jira.example.com' - api_url nil - username 'jira_username' - password 'jira_password' - jira_issue_transition_id '56-1' + create_data { true } + url { 'https://jira.example.com' } + api_url { nil } + username { 'jira_username' } + password { 'jira_password' } + jira_issue_transition_id { '56-1' } end after(:build) do |service, evaluator| @@ -65,34 +69,34 @@ factory :bugzilla_service do project - active true + active { true } issue_tracker end factory :redmine_service do project - active true + active { true } issue_tracker end factory :youtrack_service do project - active true + active { true } issue_tracker end factory :gitlab_issue_tracker_service do project - active true + active { true } issue_tracker end trait :issue_tracker do transient do - create_data true - project_url 'http://issuetracker.example.com' - issues_url 'http://issues.example.com/issues/:id' - new_issue_url 'http://new-issue.example.com' + create_data { true } + project_url { 'http://issuetracker.example.com' } + issues_url { 'http://issues.example.com/issues/:id' } + new_issue_url { 'http://new-issue.example.com' } end after(:build) do |service, evaluator| @@ -105,29 +109,29 @@ end trait :jira_cloud_service do - url 'https://mysite.atlassian.net' - username 'jira_user' - password 'my-secret-password' + url { 'https://mysite.atlassian.net' } + username { 'jira_user' } + password { 'my-secret-password' } end factory :hipchat_service do project - type 'HipchatService' - token 'test_token' + type { 'HipchatService' } + token { 'test_token' } end # this is for testing storing values inside properties, which is deprecated and will be removed in # https://gitlab.com/gitlab-org/gitlab/issues/29404 trait :without_properties_callback do - jira_tracker_data nil - issue_tracker_data nil - create_data false + jira_tracker_data { nil } + issue_tracker_data { nil } + create_data { false } after(:build) do |service| IssueTrackerService.skip_callback(:validation, :before, :handle_properties) end - to_create { |instance| instance.save(validate: false)} + to_create { |instance| instance.save(validate: false) } after(:create) do IssueTrackerService.set_callback(:validation, :before, :handle_properties) diff --git a/spec/factories/shards.rb b/spec/factories/shards.rb index c30a38180e89b3a3a7e655e50da0395740fa8d3e..357d3bfbfa1b62dfce95d12f17c94570889a366e 100644 --- a/spec/factories/shards.rb +++ b/spec/factories/shards.rb @@ -2,6 +2,6 @@ FactoryBot.define do factory :shard do - name "default" + name { "default" } end end diff --git a/spec/factories/snippets.rb b/spec/factories/snippets.rb index 9c3a0fbe9b36dbc9897b47e3fe9787472ded330f..ede071ae70c3bd243169ae0a0c18d480583c7eb3 100644 --- a/spec/factories/snippets.rb +++ b/spec/factories/snippets.rb @@ -9,15 +9,15 @@ file_name { generate(:filename) } trait :public do - visibility_level Snippet::PUBLIC + visibility_level { Snippet::PUBLIC } end trait :internal do - visibility_level Snippet::INTERNAL + visibility_level { Snippet::INTERNAL } end trait :private do - visibility_level Snippet::PRIVATE + visibility_level { Snippet::PRIVATE } end end diff --git a/spec/factories/spam_logs.rb b/spec/factories/spam_logs.rb index 42a856832e702184c8fbb7694508a9187b207caa..ec4454cac57d6f7856a052d4d4d8a7a9cb6e5e90 100644 --- a/spec/factories/spam_logs.rb +++ b/spec/factories/spam_logs.rb @@ -4,7 +4,7 @@ factory :spam_log do user sequence(:source_ip) { |n| "42.42.42.#{n % 255}" } - noteable_type 'Issue' + noteable_type { 'Issue' } sequence(:title) { |n| "Spam title #{n}" } description { "Spam description\nwith\nmultiple\nlines" } end diff --git a/spec/factories/suggestions.rb b/spec/factories/suggestions.rb index b1427e0211f9ac040f65832f8c24468fc7fba858..420c59df40e59f19a4f055cc64230b5e5c39cbaa 100644 --- a/spec/factories/suggestions.rb +++ b/spec/factories/suggestions.rb @@ -2,18 +2,18 @@ FactoryBot.define do factory :suggestion do - relative_order 0 + relative_order { 0 } association :note, factory: :diff_note_on_merge_request - from_content " vars = {\n" - to_content " vars = [\n" + from_content { " vars = {\n" } + to_content { " vars = [\n" } trait :unappliable do - from_content "foo" - to_content "foo" + from_content { "foo" } + to_content { "foo" } end trait :applied do - applied true + applied { true } commit_id { RepoHelpers.sample_commit.id } end diff --git a/spec/factories/system_note_metadata.rb b/spec/factories/system_note_metadata.rb index 8cd4b77799cddb0cae0d92c1df9a6be3995437ed..56941edba1feecd631cf276d5f1df1d8c701b8a3 100644 --- a/spec/factories/system_note_metadata.rb +++ b/spec/factories/system_note_metadata.rb @@ -3,6 +3,6 @@ FactoryBot.define do factory :system_note_metadata do note - action 'merge' + action { 'merge' } end end diff --git a/spec/factories/term_agreements.rb b/spec/factories/term_agreements.rb index b7e259bd44b9c6fc2117946c1c932205c4cfdf58..150948df0442d032f64fd1c4f0fd63e63f77265e 100644 --- a/spec/factories/term_agreements.rb +++ b/spec/factories/term_agreements.rb @@ -7,10 +7,10 @@ end trait :declined do - accepted false + accepted { false } end trait :accepted do - accepted true + accepted { true } end end diff --git a/spec/factories/terms.rb b/spec/factories/terms.rb index b890261d293fbf762e51eb4e90821f6081c601bd..b98a2453f7e737675eb09cb976c8556e4ff8b10b 100644 --- a/spec/factories/terms.rb +++ b/spec/factories/terms.rb @@ -2,6 +2,6 @@ FactoryBot.define do factory :term, class: ApplicationSetting::Term do - terms "Lorem ipsum dolor sit amet, consectetur adipiscing elit." + terms { "Lorem ipsum dolor sit amet, consectetur adipiscing elit." } end end diff --git a/spec/factories/timelogs.rb b/spec/factories/timelogs.rb index 056a8833c460b8e280b6bc2624966d6c823908cc..5d34acc635dea582b3a1c804cf6eb7c3264f55f5 100644 --- a/spec/factories/timelogs.rb +++ b/spec/factories/timelogs.rb @@ -4,7 +4,7 @@ FactoryBot.define do factory :timelog do - time_spent 3600 + time_spent { 3600 } issue user { issue.project.creator } end diff --git a/spec/factories/todos.rb b/spec/factories/todos.rb index 2ff024112a4cd0fb0f5a09c37486e61b5442ac26..bb91fc9ac8e2f5103d61a98cf9340a8f6905bd38 100644 --- a/spec/factories/todos.rb +++ b/spec/factories/todos.rb @@ -38,11 +38,11 @@ end trait :pending do - state :pending + state { :pending } end trait :done do - state :done + state { :done } end end @@ -52,6 +52,6 @@ user action { Todo::ASSIGNED } commit_id { RepoHelpers.sample_commit.id } - target_type "Commit" + target_type { "Commit" } end end diff --git a/spec/factories/u2f_registrations.rb b/spec/factories/u2f_registrations.rb index c968468834b3aafd0c90b653bf15cdb81ea070d2..7017b0ee9e785e8b4b8d053a26be70e0a317b047 100644 --- a/spec/factories/u2f_registrations.rb +++ b/spec/factories/u2f_registrations.rb @@ -5,6 +5,6 @@ certificate { FFaker::BaconIpsum.characters(728) } key_handle { FFaker::BaconIpsum.characters(86) } public_key { FFaker::BaconIpsum.characters(88) } - counter 0 + counter { 0 } end end diff --git a/spec/factories/uploads.rb b/spec/factories/uploads.rb index 3f6326114c9bb3fd2a0f98a241e858eecdd79280..bfe02c6010b2679aa810e435b73e2d5783d96c79 100644 --- a/spec/factories/uploads.rb +++ b/spec/factories/uploads.rb @@ -4,28 +4,28 @@ factory :upload do model { build(:project) } size { 100.kilobytes } - uploader "AvatarUploader" - mount_point :avatar - secret nil - store ObjectStorage::Store::LOCAL + uploader { "AvatarUploader" } + mount_point { :avatar } + secret { nil } + store { ObjectStorage::Store::LOCAL } # we should build a mount agnostic upload by default transient do - filename 'myfile.jpg' + filename { 'myfile.jpg' } end # this needs to comply with RecordsUpload::Concern#upload_path path { File.join("uploads/-/system", model.class.underscore, mount_point.to_s, 'avatar.jpg') } trait :personal_snippet_upload do - uploader "PersonalFileUploader" + uploader { "PersonalFileUploader" } path { File.join(secret, filename) } model { build(:personal_snippet) } secret { SecureRandom.hex } end trait :issuable_upload do - uploader "FileUploader" + uploader { "FileUploader" } path { File.join(secret, filename) } secret { SecureRandom.hex } end @@ -38,27 +38,27 @@ end trait :object_storage do - store ObjectStorage::Store::REMOTE + store { ObjectStorage::Store::REMOTE } end trait :namespace_upload do model { build(:group) } path { File.join(secret, filename) } - uploader "NamespaceFileUploader" + uploader { "NamespaceFileUploader" } secret { SecureRandom.hex } end trait :favicon_upload do model { build(:appearance) } path { File.join(secret, filename) } - uploader "FaviconUploader" + uploader { "FaviconUploader" } secret { SecureRandom.hex } end trait :attachment_upload do - mount_point :attachment + mount_point { :attachment } model { build(:note) } - uploader "AttachmentUploader" + uploader { "AttachmentUploader" } end end end diff --git a/spec/factories/user_agent_details.rb b/spec/factories/user_agent_details.rb index 055aea5058551baa08e765536619d6aa84985d5f..3185ded26ce69c4a0df8b518c6d6a063ae68a8e2 100644 --- a/spec/factories/user_agent_details.rb +++ b/spec/factories/user_agent_details.rb @@ -2,8 +2,8 @@ FactoryBot.define do factory :user_agent_detail do - ip_address '127.0.0.1' - user_agent 'AppleWebKit/537.36' + ip_address { '127.0.0.1' } + user_agent { 'AppleWebKit/537.36' } association :subject, factory: :issue end end diff --git a/spec/factories/user_callouts.rb b/spec/factories/user_callouts.rb index c4a217fd3573196ab11195f0c11ccab917d99458..cedc6efd8d7c716d7a8aef0b30954737d1fe4a3b 100644 --- a/spec/factories/user_callouts.rb +++ b/spec/factories/user_callouts.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :user_callout do - feature_name :gke_cluster_integration + feature_name { :gke_cluster_integration } user end diff --git a/spec/factories/user_statuses.rb b/spec/factories/user_statuses.rb index 9998ae9609cf906c4fd47098f4ddcec9a71d8ed0..dbed6031ce14c3c667ad6750bea5088b2b17a079 100644 --- a/spec/factories/user_statuses.rb +++ b/spec/factories/user_statuses.rb @@ -3,7 +3,7 @@ FactoryBot.define do factory :user_status do user - emoji 'coffee' - message 'I crave coffee' + emoji { 'coffee' } + message { 'I crave coffee' } end end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 57e585135295b52924a16be90edd3d721404cd53..e3d20c1f46c06dc69860062365976634a3bb1cfa 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -5,17 +5,17 @@ email { generate(:email) } name { generate(:name) } username { generate(:username) } - password "12345678" + password { "12345678" } confirmed_at { Time.now } confirmation_token { nil } - can_create_group true + can_create_group { true } after(:stub) do |user| user.notification_email = user.email end trait :admin do - admin true + admin { true } end trait :blocked do @@ -23,7 +23,7 @@ end trait :external do - external true + external { true } end trait :two_factor do @@ -31,7 +31,7 @@ end trait :ghost do - ghost true + ghost { true } after(:build) { |user, _| user.block! } end @@ -40,11 +40,11 @@ end trait :with_sign_ins do - sign_in_count 3 + sign_in_count { 3 } current_sign_in_at { Time.now } last_sign_in_at { FFaker::Time.between(10.days.ago, 1.day.ago) } - current_sign_in_ip '127.0.0.1' - last_sign_in_ip '127.0.0.1' + current_sign_in_ip { '127.0.0.1' } + last_sign_in_ip { '127.0.0.1' } end trait :two_factor_via_otp do @@ -57,7 +57,7 @@ end trait :two_factor_via_u2f do - transient { registrations_count 5 } + transient { registrations_count { 5 } } after(:create) do |user, evaluator| create_list(:u2f_registration, evaluator.registrations_count, user: user) @@ -65,7 +65,7 @@ end trait :readme do - project_view :readme + project_view { :readme } end trait :commit_email do @@ -77,7 +77,7 @@ end transient do - developer_projects [] + developer_projects { [] } end after(:create) do |user, evaluator| @@ -88,8 +88,8 @@ factory :omniauth_user do transient do - extern_uid '123456' - provider 'ldapmain' + extern_uid { '123456' } + provider { 'ldapmain' } end after(:create) do |user, evaluator| diff --git a/spec/factories/web_hook_log.rb b/spec/factories/web_hook_log.rb index 5750af85662cb7c21d2c7d32bc43f24adf8595ee..65b91b7183aced1ec9b30bac71bf81e05af0cbfb 100644 --- a/spec/factories/web_hook_log.rb +++ b/spec/factories/web_hook_log.rb @@ -3,14 +3,20 @@ FactoryBot.define do factory :web_hook_log do web_hook factory: :project_hook - trigger 'push_hooks' + trigger { 'push_hooks' } url { generate(:url) } - request_headers {} - request_data {} - response_headers {} - response_body '' - response_status '200' - execution_duration 2.0 - internal_error_message nil + request_headers do + {} + end + request_data do + {} + end + response_headers do + {} + end + response_body { '' } + response_status { '200' } + execution_duration { 2.0 } + internal_error_message { nil } end end diff --git a/spec/factories/wiki_directories.rb b/spec/factories/wiki_directories.rb index de23cf110b59fbb7f7a9663c823a8604d97bd059..afa003617c402b07d1500cc61538ac7e4c2443b5 100644 --- a/spec/factories/wiki_directories.rb +++ b/spec/factories/wiki_directories.rb @@ -4,7 +4,7 @@ factory :wiki_directory do skip_create - slug '/path_up_to/dir' + slug { '/path_up_to/dir' } initialize_with { new(slug) } end end