diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-01 06:08:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-01 06:08:46 +0300 |
commit | 0548fa357572b5c834613fe57b417777a3fda92f (patch) | |
tree | d3854ff39ff5c4695f34b186c9867abfee89e800 /spec | |
parent | 83e25d14371953c18ac41b3a0cc27aadefd9bc69 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
58 files changed, 70 insertions, 63 deletions
diff --git a/spec/controllers/import/manifest_controller_spec.rb b/spec/controllers/import/manifest_controller_spec.rb index 69eb736375c..c06bd660cd2 100644 --- a/spec/controllers/import/manifest_controller_spec.rb +++ b/spec/controllers/import/manifest_controller_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Import::ManifestController, :clean_gitlab_redis_shared_state, fea let_it_be(:user) { create(:user) } let_it_be(:group) { create(:group) } - before(:all) do + before_all do group.add_maintainer(user) end diff --git a/spec/finders/packages/go/version_finder_spec.rb b/spec/finders/packages/go/version_finder_spec.rb index b67842d1e05..a4d40c0a59a 100644 --- a/spec/finders/packages/go/version_finder_spec.rb +++ b/spec/finders/packages/go/version_finder_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Packages::Go::VersionFinder do let(:finder) { described_class.new mod } - before :all do + before_all do create :go_module_commit, :files, project: project, tag: 'v1.0.0', files: { 'README.md' => 'Hi' } create :go_module_commit, :module, project: project, tag: 'v1.0.1' create :go_module_commit, :package, project: project, tag: 'v1.0.2', path: 'pkg' diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb index 95a25e03c91..6745dba2f3c 100644 --- a/spec/helpers/users_helper_spec.rb +++ b/spec/helpers/users_helper_spec.rb @@ -604,7 +604,7 @@ RSpec.describe UsersHelper do describe '#load_max_project_member_accesses' do let_it_be(:projects) { create_list(:project, 3) } - before(:all) do + before_all do projects.first.add_developer(user) end diff --git a/spec/initializers/action_cable_subscription_adapter_identifier_spec.rb b/spec/initializers/action_cable_subscription_adapter_identifier_spec.rb index 94134ce44fd..cf82fd751dd 100644 --- a/spec/initializers/action_cable_subscription_adapter_identifier_spec.rb +++ b/spec/initializers/action_cable_subscription_adapter_identifier_spec.rb @@ -6,8 +6,13 @@ RSpec.describe 'ActionCableSubscriptionAdapterIdentifier override' do describe '#identifier' do let!(:original_config) { ::ActionCable::Server::Base.config.cable } + before do + ActionCable.server.restart + end + after do ::ActionCable::Server::Base.config.cable = original_config + ActionCable.server.restart end context 'when id key is nil on cable.yml' do diff --git a/spec/lib/backup/database_spec.rb b/spec/lib/backup/database_spec.rb index e0ca090d96a..5d53ad9fe22 100644 --- a/spec/lib/backup/database_spec.rb +++ b/spec/lib/backup/database_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Backup::Database, feature_category: :backup_restore do end end - before(:all) do + before_all do Rake::Task.define_task(:environment) Rake.application.rake_require 'active_record/railties/databases' Rake.application.rake_require 'tasks/gitlab/backup' diff --git a/spec/lib/generators/batched_background_migration/expected_files/ee_my_batched_migration.txt b/spec/lib/generators/batched_background_migration/expected_files/ee_my_batched_migration.txt index 004ae46ca5f..f88e3a5ee09 100644 --- a/spec/lib/generators/batched_background_migration/expected_files/ee_my_batched_migration.txt +++ b/spec/lib/generators/batched_background_migration/expected_files/ee_my_batched_migration.txt @@ -13,7 +13,7 @@ module EE extend ::Gitlab::Utils::Override prepended do - # operation_name :my_operation + # operation_name :my_operation # This is used as the key on collecting metrics # scope_to ->(relation) { relation.where(column: "value") } end diff --git a/spec/lib/generators/batched_background_migration/expected_files/my_batched_migration.txt b/spec/lib/generators/batched_background_migration/expected_files/my_batched_migration.txt index b2378b414b1..03908928fb8 100644 --- a/spec/lib/generators/batched_background_migration/expected_files/my_batched_migration.txt +++ b/spec/lib/generators/batched_background_migration/expected_files/my_batched_migration.txt @@ -8,7 +8,7 @@ module Gitlab module BackgroundMigration class MyBatchedMigration < BatchedMigrationJob - # operation_name :my_operation + # operation_name :my_operation # This is used as the key on collecting metrics # scope_to ->(relation) { relation.where(column: "value") } feature_category :database diff --git a/spec/lib/gitlab/analytics/cycle_analytics/records_fetcher_spec.rb b/spec/lib/gitlab/analytics/cycle_analytics/records_fetcher_spec.rb index e9a9dfeca82..276f797536b 100644 --- a/spec/lib/gitlab/analytics/cycle_analytics/records_fetcher_spec.rb +++ b/spec/lib/gitlab/analytics/cycle_analytics/records_fetcher_spec.rb @@ -117,7 +117,7 @@ RSpec.describe Gitlab::Analytics::CycleAnalytics::RecordsFetcher do }) end - before(:all) do + before_all do issue1.metrics.update!(first_added_to_board_at: 3.days.ago, first_mentioned_in_commit_at: 2.days.ago) issue2.metrics.update!(first_added_to_board_at: 3.days.ago, first_mentioned_in_commit_at: 2.days.ago) issue3.metrics.update!(first_added_to_board_at: 3.days.ago, first_mentioned_in_commit_at: 2.days.ago) diff --git a/spec/lib/gitlab/ci/artifacts/decompressed_artifact_size_validator_spec.rb b/spec/lib/gitlab/ci/artifacts/decompressed_artifact_size_validator_spec.rb index ef39a431d63..47d91e2478e 100644 --- a/spec/lib/gitlab/ci/artifacts/decompressed_artifact_size_validator_spec.rb +++ b/spec/lib/gitlab/ci/artifacts/decompressed_artifact_size_validator_spec.rb @@ -12,7 +12,7 @@ RSpec.describe Gitlab::Ci::Artifacts::DecompressedArtifactSizeValidator, feature let(:gzip_valid?) { true } let(:validator) { instance_double(::Gitlab::Ci::DecompressedGzipSizeValidator, valid?: gzip_valid?) } - before(:all) do + before_all do Zlib::GzipWriter.open(file_path) do |gz| gz.write('Hello World!') end diff --git a/spec/lib/gitlab/ci/components/instance_path_spec.rb b/spec/lib/gitlab/ci/components/instance_path_spec.rb index 511036efd37..f4bc706f9b4 100644 --- a/spec/lib/gitlab/ci/components/instance_path_spec.rb +++ b/spec/lib/gitlab/ci/components/instance_path_spec.rb @@ -106,7 +106,7 @@ RSpec.describe Gitlab::Ci::Components::InstancePath, feature_category: :pipeline create(:release, project: existing_project, sha: 'sha-1', released_at: Time.zone.now) end - before(:all) do + before_all do # Previous release create(:release, project: existing_project, sha: 'sha-2', released_at: Time.zone.now - 1.day) end diff --git a/spec/lib/gitlab/ci/decompressed_gzip_size_validator_spec.rb b/spec/lib/gitlab/ci/decompressed_gzip_size_validator_spec.rb index 6ca3f4d415e..ee0d9f4c625 100644 --- a/spec/lib/gitlab/ci/decompressed_gzip_size_validator_spec.rb +++ b/spec/lib/gitlab/ci/decompressed_gzip_size_validator_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe Gitlab::Ci::DecompressedGzipSizeValidator, feature_category: :importers do let_it_be(:filepath) { File.join(Dir.tmpdir, 'decompressed_gzip_size_validator_spec.gz') } - before(:all) do + before_all do create_compressed_file end diff --git a/spec/lib/gitlab/data_builder/deployment_spec.rb b/spec/lib/gitlab/data_builder/deployment_spec.rb index 82ec3e791a4..bbcfa1973ea 100644 --- a/spec/lib/gitlab/data_builder/deployment_spec.rb +++ b/spec/lib/gitlab/data_builder/deployment_spec.rb @@ -56,7 +56,7 @@ RSpec.describe Gitlab::DataBuilder::Deployment, feature_category: :continuous_de subject(:data) { described_class.build(deployment, 'created', Time.current) } - before(:all) do + before_all do project.repository.remove end @@ -74,7 +74,7 @@ RSpec.describe Gitlab::DataBuilder::Deployment, feature_category: :continuous_de subject(:data) { described_class.build(deployment, 'created', Time.current) } - before(:all) do + before_all do deployment.user = nil end diff --git a/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb b/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb index c5b44b260c6..d320b9c4091 100644 --- a/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb +++ b/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Gitlab::Git::RuggedImpl::UseRugged, feature_category: :gitaly do let(:feature_flag_name) { wrapper.rugged_feature_keys.first } let(:temp_gitaly_metadata_file) { create_temporary_gitaly_metadata_file } - before(:all) do + before_all do create_gitaly_metadata_file end diff --git a/spec/lib/gitlab/graphql/pagination/connections_spec.rb b/spec/lib/gitlab/graphql/pagination/connections_spec.rb index 97389b6250e..0c4ca5570f8 100644 --- a/spec/lib/gitlab/graphql/pagination/connections_spec.rb +++ b/spec/lib/gitlab/graphql/pagination/connections_spec.rb @@ -6,7 +6,7 @@ require 'spec_helper' RSpec.describe ::Gitlab::Graphql::Pagination::Connections do include GraphqlHelpers - before(:all) do + before_all do ActiveRecord::Schema.define do create_table :_test_testing_pagination_nodes, force: true do |t| t.integer :value, null: false diff --git a/spec/lib/gitlab/http_spec.rb b/spec/lib/gitlab/http_spec.rb index 133cd3b2f49..93d48379414 100644 --- a/spec/lib/gitlab/http_spec.rb +++ b/spec/lib/gitlab/http_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Gitlab::HTTP do end context 'when reading the response is too slow' do - before(:all) do + before_all do # Override Net::HTTP to add a delay between sending each response chunk mocked_http = Class.new(Net::HTTP) do def request(*) diff --git a/spec/lib/gitlab/import_export/decompressed_archive_size_validator_spec.rb b/spec/lib/gitlab/import_export/decompressed_archive_size_validator_spec.rb index a6cb74c3c9f..f9439e82668 100644 --- a/spec/lib/gitlab/import_export/decompressed_archive_size_validator_spec.rb +++ b/spec/lib/gitlab/import_export/decompressed_archive_size_validator_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe Gitlab::ImportExport::DecompressedArchiveSizeValidator do let_it_be(:filepath) { File.join(Dir.tmpdir, 'decompressed_archive_size_validator_spec.gz') } - before(:all) do + before_all do create_compressed_file end diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/count_bulk_imports_entities_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/count_bulk_imports_entities_metric_spec.rb index eee5396bdbf..0deb586d488 100644 --- a/spec/lib/gitlab/usage/metrics/instrumentations/count_bulk_imports_entities_metric_spec.rb +++ b/spec/lib/gitlab/usage/metrics/instrumentations/count_bulk_imports_entities_metric_spec.rb @@ -165,7 +165,7 @@ RSpec.describe Gitlab::Usage::Metrics::Instrumentations::CountBulkImportsEntitie end context 'with has_failures: true' do - before(:all) do + before_all do create_list(:bulk_import_entity, 3, :project_entity, :finished, created_at: 3.weeks.ago, has_failures: true) create_list(:bulk_import_entity, 2, :project_entity, :finished, created_at: 2.months.ago, has_failures: true) create_list(:bulk_import_entity, 3, :group_entity, :finished, created_at: 3.weeks.ago, has_failures: true) diff --git a/spec/lib/unnested_in_filters/rewriter_spec.rb b/spec/lib/unnested_in_filters/rewriter_spec.rb index fe34fba579b..e094563e8fb 100644 --- a/spec/lib/unnested_in_filters/rewriter_spec.rb +++ b/spec/lib/unnested_in_filters/rewriter_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe UnnestedInFilters::Rewriter do let(:rewriter) { described_class.new(relation) } - before(:all) do + before_all do User.include(UnnestedInFilters::Dsl) end diff --git a/spec/models/ci/commit_with_pipeline_spec.rb b/spec/models/ci/commit_with_pipeline_spec.rb index 766e99288c0..063cff0e63f 100644 --- a/spec/models/ci/commit_with_pipeline_spec.rb +++ b/spec/models/ci/commit_with_pipeline_spec.rb @@ -44,7 +44,7 @@ RSpec.describe Ci::CommitWithPipeline, feature_category: :continuous_integration ] end - before(:all) do + before_all do commits_with_pipelines.each do |commit| create(:ci_empty_pipeline, project: commit.project, sha: commit.sha) end diff --git a/spec/models/concerns/bulk_insert_safe_spec.rb b/spec/models/concerns/bulk_insert_safe_spec.rb index 65b7da20bbc..3c50003ba2f 100644 --- a/spec/models/concerns/bulk_insert_safe_spec.rb +++ b/spec/models/concerns/bulk_insert_safe_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe BulkInsertSafe, feature_category: :database do - before(:all) do + before_all do ActiveRecord::Schema.define do create_table :_test_bulk_insert_parent_items, force: true do |t| t.string :name, null: false diff --git a/spec/models/concerns/bulk_insertable_associations_spec.rb b/spec/models/concerns/bulk_insertable_associations_spec.rb index 3187dcd8f93..3796f60c705 100644 --- a/spec/models/concerns/bulk_insertable_associations_spec.rb +++ b/spec/models/concerns/bulk_insertable_associations_spec.rb @@ -40,7 +40,7 @@ RSpec.describe BulkInsertableAssociations do end end - before(:all) do + before_all do ActiveRecord::Schema.define do create_table :_test_bulk_parents, force: true do |t| t.string :name, null: true diff --git a/spec/models/concerns/token_authenticatable_spec.rb b/spec/models/concerns/token_authenticatable_spec.rb index cbfc1df64f1..822e2817d84 100644 --- a/spec/models/concerns/token_authenticatable_spec.rb +++ b/spec/models/concerns/token_authenticatable_spec.rb @@ -89,7 +89,7 @@ RSpec.describe ApplicationSetting, 'TokenAuthenticatable' do end describe 'multiple token fields' do - before(:all) do + before_all do described_class.send(:add_authentication_token_field, :yet_another_token) end diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb index 1f0f89fea60..15bcbb3962c 100644 --- a/spec/models/milestone_spec.rb +++ b/spec/models/milestone_spec.rb @@ -322,7 +322,7 @@ RSpec.describe Milestone, feature_category: :team_planning do let_it_be(:group) { create(:group) } let_it_be(:group_other) { create(:group) } - before(:all) do + before_all do create(:milestone, project: project) create(:milestone, project: project_other) create(:milestone, group: group) diff --git a/spec/models/postgresql/replication_slot_spec.rb b/spec/models/postgresql/replication_slot_spec.rb index 35c166ab064..ae338864af3 100644 --- a/spec/models/postgresql/replication_slot_spec.rb +++ b/spec/models/postgresql/replication_slot_spec.rb @@ -72,7 +72,7 @@ RSpec.describe Postgresql::ReplicationSlot do context 'with enough slots available' do skip_examples = described_class.max_replication_slots <= described_class.count - before(:all) do + before_all do skip('max_replication_slots too small') if skip_examples @current_slot_count = described_class diff --git a/spec/rack_servers/puma_spec.rb b/spec/rack_servers/puma_spec.rb index 6729119fe92..1d7efe67564 100644 --- a/spec/rack_servers/puma_spec.rb +++ b/spec/rack_servers/puma_spec.rb @@ -6,7 +6,7 @@ require 'fileutils' require 'excon' RSpec.describe 'Puma' do - before(:all) do + before_all do project_root = Rails.root.to_s config_lines = File.read(Rails.root.join('config/puma.example.development.rb')) .gsub('config.ru', File.join(__dir__, 'configs/config.ru')) diff --git a/spec/requests/api/composer_packages_spec.rb b/spec/requests/api/composer_packages_spec.rb index 2bb2ffa03c4..3652bee5e44 100644 --- a/spec/requests/api/composer_packages_spec.rb +++ b/spec/requests/api/composer_packages_spec.rb @@ -289,7 +289,7 @@ RSpec.describe API::ComposerPackages, feature_category: :package_registry do let(:url) { "/projects/#{project.id}/packages/composer" } let(:params) { {} } - before(:all) do + before_all do project.repository.add_tag(user, 'v1.2.99', 'master') end diff --git a/spec/requests/api/graphql/mutations/work_items/create_spec.rb b/spec/requests/api/graphql/mutations/work_items/create_spec.rb index ac416978781..78b93c3210b 100644 --- a/spec/requests/api/graphql/mutations/work_items/create_spec.rb +++ b/spec/requests/api/graphql/mutations/work_items/create_spec.rb @@ -140,7 +140,7 @@ RSpec.describe 'Create a work item', feature_category: :team_planning do } end - before(:all) do + before_all do create(:parent_link, work_item_parent: parent, work_item: adjacent, relative_position: 0) end diff --git a/spec/requests/api/graphql/mutations/work_items/update_spec.rb b/spec/requests/api/graphql/mutations/work_items/update_spec.rb index ea9516f256c..cff21c10a5a 100644 --- a/spec/requests/api/graphql/mutations/work_items/update_spec.rb +++ b/spec/requests/api/graphql/mutations/work_items/update_spec.rb @@ -573,7 +573,7 @@ RSpec.describe 'Update a work item', feature_category: :team_planning do end context 'when updating relative position' do - before(:all) do + before_all do create(:parent_link, work_item_parent: valid_parent, work_item: valid_child1) create(:parent_link, work_item_parent: valid_parent, work_item: valid_child2) end @@ -655,7 +655,7 @@ RSpec.describe 'Update a work item', feature_category: :team_planning do let_it_be(:work_item, reload: true) { create(:work_item, :task, project: project) } context "when parent is already assigned" do - before(:all) do + before_all do create(:parent_link, work_item_parent: valid_parent, work_item: work_item) create(:parent_link, work_item_parent: valid_parent, work_item: valid_child1) create(:parent_link, work_item_parent: valid_parent, work_item: valid_child2) diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 2bbcf6b3f38..81881532240 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -4789,7 +4789,7 @@ RSpec.describe API::Users, :aggregate_failures, feature_category: :user_profile }.as_json end - before :all do + before_all do group.add_member(user, Gitlab::Access::OWNER) project.add_member(user, Gitlab::Access::OWNER) create(:merge_request, source_project: project, source_branch: "my-personal-branch-1", author: user) diff --git a/spec/scripts/lib/glfm/update_example_snapshots_spec.rb b/spec/scripts/lib/glfm/update_example_snapshots_spec.rb index 78ea31c8e39..717a584f931 100644 --- a/spec/scripts/lib/glfm/update_example_snapshots_spec.rb +++ b/spec/scripts/lib/glfm/update_example_snapshots_spec.rb @@ -576,7 +576,7 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process', feature_category: :team end context 'with full processing of static and WYSIWYG HTML' do - before(:all) do + before(:all) do # rubocop: disable RSpec/BeforeAll # NOTE: It is a necessary to do a `yarn install` in order to ensure that # `scripts/lib/glfm/render_wysiwyg_html_and_json.js` can be invoked successfully # on the CI job (which will not be set up for frontend specs since this is diff --git a/spec/services/bulk_imports/relation_batch_export_service_spec.rb b/spec/services/bulk_imports/relation_batch_export_service_spec.rb index c3abd02aff8..09f55f14a96 100644 --- a/spec/services/bulk_imports/relation_batch_export_service_spec.rb +++ b/spec/services/bulk_imports/relation_batch_export_service_spec.rb @@ -12,7 +12,7 @@ RSpec.describe BulkImports::RelationBatchExportService, feature_category: :impor subject(:service) { described_class.new(user.id, batch.id) } - before(:all) do + before_all do Gitlab::Cache::Import::Caching.set_add(cache_key, label.id) end diff --git a/spec/services/loose_foreign_keys/batch_cleaner_service_spec.rb b/spec/services/loose_foreign_keys/batch_cleaner_service_spec.rb index 6eee83d5ee9..86f528d1ea7 100644 --- a/spec/services/loose_foreign_keys/batch_cleaner_service_spec.rb +++ b/spec/services/loose_foreign_keys/batch_cleaner_service_spec.rb @@ -50,7 +50,7 @@ RSpec.describe LooseForeignKeys::BatchCleanerService, feature_category: :databas let(:parent_record_1) { loose_fk_parent_table.create! } let(:other_parent_record) { loose_fk_parent_table.create! } - before(:all) do + before_all do create_table_structure end diff --git a/spec/services/loose_foreign_keys/process_deleted_records_service_spec.rb b/spec/services/loose_foreign_keys/process_deleted_records_service_spec.rb index af010547cc9..b59339b24b4 100644 --- a/spec/services/loose_foreign_keys/process_deleted_records_service_spec.rb +++ b/spec/services/loose_foreign_keys/process_deleted_records_service_spec.rb @@ -71,7 +71,7 @@ RSpec.describe LooseForeignKeys::ProcessDeletedRecordsService, feature_category: let(:loose_fk_child_table_1_2) { table(:_test_loose_fk_child_table_1_2) } let(:loose_fk_child_table_2_1) { table(:_test_loose_fk_child_table_2_1) } - before(:all) do + before_all do create_table_structure end diff --git a/spec/services/packages/composer/create_package_service_spec.rb b/spec/services/packages/composer/create_package_service_spec.rb index 78d5d76fe4f..a2f5b973fd9 100644 --- a/spec/services/packages/composer/create_package_service_spec.rb +++ b/spec/services/packages/composer/create_package_service_spec.rb @@ -50,7 +50,7 @@ RSpec.describe Packages::Composer::CreatePackageService, feature_category: :pack context 'with a tag' do let(:tag) { project.repository.find_tag('v1.2.3') } - before(:all) do + before_all do project.repository.add_tag(user, 'v1.2.3', 'master') end diff --git a/spec/services/packages/go/create_package_service_spec.rb b/spec/services/packages/go/create_package_service_spec.rb index f552af81077..fcef06bfa03 100644 --- a/spec/services/packages/go/create_package_service_spec.rb +++ b/spec/services/packages/go/create_package_service_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Packages::Go::CreatePackageService, feature_category: :package_re let_it_be(:project) { create :project_empty_repo, path: 'my-go-lib' } let_it_be(:mod) { create :go_module, project: project } - before :all do + before_all do create :go_module_commit, :module, project: project, tag: 'v1.0.0' end diff --git a/spec/services/work_items/widgets/hierarchy_service/create_service_spec.rb b/spec/services/work_items/widgets/hierarchy_service/create_service_spec.rb index 8d834c9a4f8..a4adb72c616 100644 --- a/spec/services/work_items/widgets/hierarchy_service/create_service_spec.rb +++ b/spec/services/work_items/widgets/hierarchy_service/create_service_spec.rb @@ -13,7 +13,7 @@ RSpec.describe WorkItems::Widgets::HierarchyService::CreateService, feature_cate it { expect { subject }.to raise_error(described_class::WidgetError, message) } end - before(:all) do + before_all do project.add_developer(user) end diff --git a/spec/support/shared_examples/models/concerns/integrations/slack_mattermost_notifier_shared_examples.rb b/spec/support/shared_examples/models/concerns/integrations/slack_mattermost_notifier_shared_examples.rb index 28d2d4f1597..2985763426f 100644 --- a/spec/support/shared_examples/models/concerns/integrations/slack_mattermost_notifier_shared_examples.rb +++ b/spec/support/shared_examples/models/concerns/integrations/slack_mattermost_notifier_shared_examples.rb @@ -327,7 +327,7 @@ RSpec.shared_examples Integrations::SlackMattermostNotifier do |integration_name end context 'on a protected branch' do - before(:all) do + before_all do create(:protected_branch, :create_branch_on_repository, project: project, name: 'a-protected-branch') end @@ -369,7 +369,7 @@ RSpec.shared_examples Integrations::SlackMattermostNotifier do |integration_name end context 'on a protected branch with protected branches defined using wildcards' do - before(:all) do + before_all do create(:protected_branch, :create_branch_on_repository, repository_branch_name: '1-stable', project: project, name: '*-stable') end @@ -578,7 +578,7 @@ RSpec.shared_examples Integrations::SlackMattermostNotifier do |integration_name end context 'on a protected branch' do - before(:all) do + before_all do create(:protected_branch, :create_branch_on_repository, project: project, name: 'a-protected-branch') end @@ -606,7 +606,7 @@ RSpec.shared_examples Integrations::SlackMattermostNotifier do |integration_name end context 'on a protected branch with protected branches defined usin wildcards' do - before(:all) do + before_all do create(:protected_branch, :create_branch_on_repository, repository_branch_name: '1-stable', project: project, name: '*-stable') end @@ -682,7 +682,7 @@ RSpec.shared_examples Integrations::SlackMattermostNotifier do |integration_name it_behaves_like "triggered #{integration_name} integration", event_type: "deployment" context 'on a protected branch' do - before(:all) do + before_all do create(:protected_branch, :create_branch_on_repository, project: project, name: 'a-protected-branch') end diff --git a/spec/support_specs/helpers/stub_feature_flags_spec.rb b/spec/support_specs/helpers/stub_feature_flags_spec.rb index a59d8a20a40..f90b4c9f50d 100644 --- a/spec/support_specs/helpers/stub_feature_flags_spec.rb +++ b/spec/support_specs/helpers/stub_feature_flags_spec.rb @@ -17,7 +17,7 @@ RSpec.describe StubFeatureFlags do # We inject dummy feature flag defintion # to ensure that we strong validate it's usage # as well - before(:all) do + before_all do Feature::Definition.definitions[dummy_feature_flag] = dummy_definition end @@ -154,6 +154,7 @@ RSpec.describe StubFeatureFlags do it { expect(let_it_be_var).to eq true } end + # rubocop: disable RSpec/BeforeAll context 'before_all variable' do before_all do @suite_var = Feature.enabled?(dummy_feature_flag) @@ -169,6 +170,7 @@ RSpec.describe StubFeatureFlags do it { expect(@suite_var).to eq true } end + # rubocop: enable RSpec/BeforeAll context 'with stub_feature_flags meta' do let(:var) { Feature.enabled?(dummy_feature_flag) } diff --git a/spec/tasks/gitlab/backup_rake_spec.rb b/spec/tasks/gitlab/backup_rake_spec.rb index d534e59d8a6..23df8d4ef85 100644 --- a/spec/tasks/gitlab/backup_rake_spec.rb +++ b/spec/tasks/gitlab/backup_rake_spec.rb @@ -38,7 +38,7 @@ RSpec.describe 'gitlab:backup namespace rake tasks', :delete, feature_category: %w[db repositories] end - before(:all) do + before_all do Rake.application.rake_require 'active_record/railties/databases' Rake.application.rake_require 'tasks/gitlab/backup' Rake.application.rake_require 'tasks/gitlab/shell' diff --git a/spec/tasks/gitlab/ci_secure_files/migrate_rake_spec.rb b/spec/tasks/gitlab/ci_secure_files/migrate_rake_spec.rb index ed6b5914f3e..37ae0d694eb 100644 --- a/spec/tasks/gitlab/ci_secure_files/migrate_rake_spec.rb +++ b/spec/tasks/gitlab/ci_secure_files/migrate_rake_spec.rb @@ -8,7 +8,7 @@ RSpec.describe 'gitlab:ci_secure_files', feature_category: :mobile_devops do let(:logger) { instance_double(Logger) } let(:helper) { double } - before(:all) do + before_all do Rake.application.rake_require 'tasks/gitlab/ci_secure_files/migrate' end diff --git a/spec/tasks/gitlab/container_registry_rake_spec.rb b/spec/tasks/gitlab/container_registry_rake_spec.rb index f19e93fc6cb..f4bd8560cd0 100644 --- a/spec/tasks/gitlab/container_registry_rake_spec.rb +++ b/spec/tasks/gitlab/container_registry_rake_spec.rb @@ -5,7 +5,7 @@ require 'rake_helper' RSpec.describe 'gitlab:container_registry namespace rake tasks', :silence_stdout do let_it_be(:api_url) { 'http://registry.gitlab' } - before :all do + before_all do Rake.application.rake_require 'tasks/gitlab/container_registry' end diff --git a/spec/tasks/gitlab/db/decomposition/connection_status_rake_spec.rb b/spec/tasks/gitlab/db/decomposition/connection_status_rake_spec.rb index 4c161faf733..5116ee5663e 100644 --- a/spec/tasks/gitlab/db/decomposition/connection_status_rake_spec.rb +++ b/spec/tasks/gitlab/db/decomposition/connection_status_rake_spec.rb @@ -8,7 +8,7 @@ RSpec.describe 'gitlab:db:decomposition:connection_status', feature_category: :c subject { run_rake_task('gitlab:db:decomposition:connection_status') } - before :all do + before_all do Rake.application.rake_require 'tasks/gitlab/db/decomposition/connection_status' end diff --git a/spec/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences_rake_spec.rb b/spec/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences_rake_spec.rb index 5a9d44221ba..f923d09bdaa 100644 --- a/spec/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences_rake_spec.rb +++ b/spec/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences_rake_spec.rb @@ -4,7 +4,7 @@ require 'rake_helper' RSpec.describe 'gitlab:db:decomposition:rollback:bump_ci_sequences', :silence_stdout, :suppress_gitlab_schemas_validate_connection, feature_category: :cell, query_analyzers: false do - before :all do + before_all do Rake.application.rake_require 'tasks/gitlab/db/decomposition/rollback/bump_ci_sequences' # empty task as env is already loaded diff --git a/spec/tasks/gitlab/db/lock_writes_rake_spec.rb b/spec/tasks/gitlab/db/lock_writes_rake_spec.rb index 90612bcf9f7..069f5dc7d84 100644 --- a/spec/tasks/gitlab/db/lock_writes_rake_spec.rb +++ b/spec/tasks/gitlab/db/lock_writes_rake_spec.rb @@ -3,7 +3,7 @@ require 'rake_helper' RSpec.describe 'gitlab:db:lock_writes', :reestablished_active_record_base, feature_category: :cell do - before :all do + before_all do Rake.application.rake_require 'active_record/railties/databases' Rake.application.rake_require 'tasks/seed_fu' Rake.application.rake_require 'tasks/gitlab/db/validate_config' diff --git a/spec/tasks/gitlab/db/migration_fix_15_11_rake_spec.rb b/spec/tasks/gitlab/db/migration_fix_15_11_rake_spec.rb index 3ff07698ad4..41d77d6efc7 100644 --- a/spec/tasks/gitlab/db/migration_fix_15_11_rake_spec.rb +++ b/spec/tasks/gitlab/db/migration_fix_15_11_rake_spec.rb @@ -7,7 +7,7 @@ RSpec.describe 'migration_fix_15_11', :reestablished_active_record_base, feature let(:target_init_schema) { '20220314184009' } let(:earlier_init_schema) { '20210101010101' } - before :all do + before_all do Rake.application.rake_require 'active_record/railties/databases' Rake.application.rake_require 'tasks/gitlab/db/migration_fix_15_11' diff --git a/spec/tasks/gitlab/db/truncate_legacy_tables_rake_spec.rb b/spec/tasks/gitlab/db/truncate_legacy_tables_rake_spec.rb index 301da891244..78d2bcba8a2 100644 --- a/spec/tasks/gitlab/db/truncate_legacy_tables_rake_spec.rb +++ b/spec/tasks/gitlab/db/truncate_legacy_tables_rake_spec.rb @@ -9,7 +9,7 @@ RSpec.describe 'gitlab:db:truncate_legacy_tables', :silence_stdout, :reestablish let(:test_gitlab_main_table) { '_test_gitlab_main_table' } let(:test_gitlab_ci_table) { '_test_gitlab_ci_table' } - before :all do + before_all do Rake.application.rake_require 'active_record/railties/databases' Rake.application.rake_require 'tasks/seed_fu' Rake.application.rake_require 'tasks/gitlab/db/validate_config' diff --git a/spec/tasks/gitlab/db/validate_config_rake_spec.rb b/spec/tasks/gitlab/db/validate_config_rake_spec.rb index 94808232d7e..e2e1cf249f0 100644 --- a/spec/tasks/gitlab/db/validate_config_rake_spec.rb +++ b/spec/tasks/gitlab/db/validate_config_rake_spec.rb @@ -7,7 +7,7 @@ RSpec.describe 'gitlab:db:validate_config', :silence_stdout, :suppress_gitlab_sc # which would not be cleaned either by `DbCleaner` self.use_transactional_tests = false - before :all do + before_all do Rake.application.rake_require 'active_record/railties/databases' Rake.application.rake_require 'tasks/seed_fu' Rake.application.rake_require 'tasks/gitlab/db/validate_config' diff --git a/spec/tasks/gitlab/db_rake_spec.rb b/spec/tasks/gitlab/db_rake_spec.rb index 11c541ddfed..b12f2b839af 100644 --- a/spec/tasks/gitlab/db_rake_spec.rb +++ b/spec/tasks/gitlab/db_rake_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require 'rake' RSpec.describe 'gitlab:db namespace rake task', :silence_stdout, feature_category: :database do - before :all do + before_all do Rake.application.rake_require 'active_record/railties/databases' Rake.application.rake_require 'tasks/seed_fu' Rake.application.rake_require 'tasks/gitlab/db' diff --git a/spec/tasks/gitlab/dependency_proxy/migrate_rake_spec.rb b/spec/tasks/gitlab/dependency_proxy/migrate_rake_spec.rb index edd56f1667f..e1504a8aaf5 100644 --- a/spec/tasks/gitlab/dependency_proxy/migrate_rake_spec.rb +++ b/spec/tasks/gitlab/dependency_proxy/migrate_rake_spec.rb @@ -3,7 +3,7 @@ require 'rake_helper' RSpec.describe 'gitlab:dependency_proxy namespace rake task', :silence_stdout do - before :all do + before_all do Rake.application.rake_require 'tasks/gitlab/dependency_proxy/migrate' end diff --git a/spec/tasks/gitlab/gitaly_rake_spec.rb b/spec/tasks/gitlab/gitaly_rake_spec.rb index a161f33373d..7eca2773cf2 100644 --- a/spec/tasks/gitlab/gitaly_rake_spec.rb +++ b/spec/tasks/gitlab/gitaly_rake_spec.rb @@ -3,7 +3,7 @@ require 'rake_helper' RSpec.describe 'gitlab:gitaly namespace rake task', :silence_stdout do - before :all do + before_all do Rake.application.rake_require 'tasks/gitlab/gitaly' end diff --git a/spec/tasks/gitlab/lfs/migrate_rake_spec.rb b/spec/tasks/gitlab/lfs/migrate_rake_spec.rb index bc3113c2926..09c95783867 100644 --- a/spec/tasks/gitlab/lfs/migrate_rake_spec.rb +++ b/spec/tasks/gitlab/lfs/migrate_rake_spec.rb @@ -3,7 +3,7 @@ require 'rake_helper' RSpec.describe 'gitlab:lfs namespace rake task', :silence_stdout do - before :all do + before_all do Rake.application.rake_require 'tasks/gitlab/lfs/migrate' end diff --git a/spec/tasks/gitlab/packages/migrate_rake_spec.rb b/spec/tasks/gitlab/packages/migrate_rake_spec.rb index bf34034ee57..be69990a745 100644 --- a/spec/tasks/gitlab/packages/migrate_rake_spec.rb +++ b/spec/tasks/gitlab/packages/migrate_rake_spec.rb @@ -3,7 +3,7 @@ require 'rake_helper' RSpec.describe 'gitlab:packages namespace rake task', :silence_stdout do - before :all do + before_all do Rake.application.rake_require 'tasks/gitlab/packages/migrate' end diff --git a/spec/tasks/gitlab/snippets_rake_spec.rb b/spec/tasks/gitlab/snippets_rake_spec.rb index c50b04b4600..f0ba5ac2d92 100644 --- a/spec/tasks/gitlab/snippets_rake_spec.rb +++ b/spec/tasks/gitlab/snippets_rake_spec.rb @@ -9,7 +9,7 @@ RSpec.describe 'gitlab:snippets namespace rake task', :silence_stdout do let(:non_migrated) { create_list(:personal_snippet, 3, author: user) } let(:non_migrated_ids) { non_migrated.pluck(:id) } - before :all do + before_all do Rake.application.rake_require 'tasks/gitlab/snippets' end diff --git a/spec/tasks/gitlab/terraform/migrate_rake_spec.rb b/spec/tasks/gitlab/terraform/migrate_rake_spec.rb index 8d911010a2e..0547d351065 100644 --- a/spec/tasks/gitlab/terraform/migrate_rake_spec.rb +++ b/spec/tasks/gitlab/terraform/migrate_rake_spec.rb @@ -8,7 +8,7 @@ RSpec.describe 'gitlab:terraform_states', :silence_stdout do let(:logger) { instance_double(Logger) } let(:helper) { double } - before(:all) do + before_all do Rake.application.rake_require 'tasks/gitlab/terraform/migrate' end diff --git a/spec/tasks/gitlab/workhorse_rake_spec.rb b/spec/tasks/gitlab/workhorse_rake_spec.rb index 4255e16b0e4..17f3133ecdc 100644 --- a/spec/tasks/gitlab/workhorse_rake_spec.rb +++ b/spec/tasks/gitlab/workhorse_rake_spec.rb @@ -3,7 +3,7 @@ require 'rake_helper' RSpec.describe 'gitlab:workhorse namespace rake task', :silence_stdout, feature_category: :source_code_management do - before :all do + before_all do Rake.application.rake_require 'tasks/gitlab/workhorse' end diff --git a/spec/tasks/gitlab/x509/update_rake_spec.rb b/spec/tasks/gitlab/x509/update_rake_spec.rb index dca4f07cda7..abf8316d978 100644 --- a/spec/tasks/gitlab/x509/update_rake_spec.rb +++ b/spec/tasks/gitlab/x509/update_rake_spec.rb @@ -3,7 +3,7 @@ require 'rake_helper' RSpec.describe 'gitlab:x509 namespace rake task', :silence_stdout do - before :all do + before_all do Rake.application.rake_require 'tasks/gitlab/x509/update' end diff --git a/spec/tasks/migrate/schema_check_rake_spec.rb b/spec/tasks/migrate/schema_check_rake_spec.rb index ede55f23ba8..5afad752982 100644 --- a/spec/tasks/migrate/schema_check_rake_spec.rb +++ b/spec/tasks/migrate/schema_check_rake_spec.rb @@ -7,7 +7,7 @@ RSpec.describe 'schema_version_check rake task', :silence_stdout do include StubENV let(:valid_schema_version) { 20211004170422 } - before :all do + before_all do Rake.application.rake_require 'active_record/railties/databases' Rake.application.rake_require 'tasks/migrate/schema_check' diff --git a/spec/workers/loose_foreign_keys/cleanup_worker_spec.rb b/spec/workers/loose_foreign_keys/cleanup_worker_spec.rb index e49b4707eb3..2e77f38e221 100644 --- a/spec/workers/loose_foreign_keys/cleanup_worker_spec.rb +++ b/spec/workers/loose_foreign_keys/cleanup_worker_spec.rb @@ -70,7 +70,7 @@ RSpec.describe LooseForeignKeys::CleanupWorker, feature_category: :cell do let(:loose_fk_child_table_1_2) { table(:_test_loose_fk_child_table_1_2) } let(:loose_fk_child_table_2_1) { table(:_test_loose_fk_child_table_2_1) } - before(:all) do + before_all do create_table_structure end |