diff options
author | Rémy Coutable <remy@rymai.me> | 2018-03-29 11:47:54 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-04-23 12:20:30 +0200 |
commit | 023d4f6f2f3d88d0966fe01e6ef921fd03a309fe (patch) | |
tree | 6aabb650fe2ba200222c57f1a4ac66ff0a9143e8 | |
parent | eb1cb7bed6951bdda54abd55e86fd793e6954a56 (diff) | |
download | gitlab-ce-023d4f6f2f3d88d0966fe01e6ef921fd03a309fe.tar.gz |
Move spec helpers/matchers/shared examples/contexts to their relevant folder
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r-- | .rubocop_todo.yml | 8 | ||||
-rw-r--r-- | db/fixtures/development/17_cycle_analytics.rb | 2 | ||||
-rw-r--r-- | doc/development/testing_guide/testing_rake_tasks.md | 2 | ||||
-rw-r--r-- | features/support/env.rb | 6 | ||||
-rw-r--r-- | spec/factories/commits.rb | 2 | ||||
-rw-r--r-- | spec/factories/gpg_key_subkeys.rb | 2 | ||||
-rw-r--r-- | spec/factories/gpg_keys.rb | 2 | ||||
-rw-r--r-- | spec/factories/gpg_signature.rb | 2 | ||||
-rw-r--r-- | spec/factories/notes.rb | 2 | ||||
-rw-r--r-- | spec/factories/projects.rb | 2 | ||||
-rw-r--r-- | spec/spec_helper.rb | 59 | ||||
-rw-r--r-- | spec/support/capybara.rb | 2 | ||||
-rw-r--r-- | spec/support/factory_bot.rb | 3 | ||||
-rwxr-xr-x | spec/support/generate-seed-repo-rb | 2 | ||||
-rw-r--r-- | spec/support/gitlab-git-test.git/README.md | 2 | ||||
-rw-r--r-- | spec/support/helpers/api_helpers.rb (renamed from spec/support/api_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/bare_repo_operations.rb (renamed from spec/support/bare_repo_operations.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/board_helpers.rb (renamed from spec/support/board_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/capybara_helpers.rb (renamed from spec/support/capybara_helpers.rb) | 4 | ||||
-rw-r--r-- | spec/support/helpers/cookie_helper.rb (renamed from spec/support/cookie_helper.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/cycle_analytics_helpers.rb (renamed from spec/support/cycle_analytics_helpers.rb) | 4 | ||||
-rw-r--r-- | spec/support/helpers/database_connection_helpers.rb (renamed from spec/support/database_connection_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/devise_helpers.rb (renamed from spec/support/devise_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/drag_to_helper.rb (renamed from spec/support/drag_to_helper.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/dropzone_helper.rb (renamed from spec/support/dropzone_helper.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/email_helpers.rb (renamed from spec/support/email_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/fake_migration_classes.rb (renamed from spec/support/fake_migration_classes.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/fake_u2f_device.rb (renamed from spec/support/fake_u2f_device.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/filter_item_select_helper.rb (renamed from spec/support/filter_item_select_helper.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/filter_spec_helper.rb (renamed from spec/support/filter_spec_helper.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/filtered_search_helpers.rb (renamed from spec/support/filtered_search_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/fixture_helpers.rb (renamed from spec/support/fixture_helpers.rb) | 4 | ||||
-rw-r--r-- | spec/support/helpers/git_http_helpers.rb (renamed from spec/support/git_http_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/gitlab_verify_helpers.rb | 25 | ||||
-rw-r--r-- | spec/support/helpers/gpg_helpers.rb (renamed from spec/support/gpg_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/import_spec_helper.rb (renamed from spec/support/import_spec_helper.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/input_helper.rb (renamed from spec/support/input_helper.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/inspect_requests.rb (renamed from spec/support/inspect_requests.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/issue_helpers.rb (renamed from spec/support/issue_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/javascript_fixtures_helpers.rb (renamed from spec/support/javascript_fixtures_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/jira_service_helper.rb (renamed from spec/support/jira_service_helper.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/kubernetes_helpers.rb (renamed from spec/support/kubernetes_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/ldap_helpers.rb (renamed from spec/support/ldap_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/live_debugger.rb (renamed from spec/support/live_debugger.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/login_helpers.rb (renamed from spec/support/login_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/markdown_feature.rb (renamed from spec/support/markdown_feature.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/merge_request_helpers.rb (renamed from spec/support/merge_request_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/migrations_helpers.rb (renamed from spec/support/migrations_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/mobile_helpers.rb (renamed from spec/support/mobile_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/project_forks_helper.rb (renamed from spec/support/project_forks_helper.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/prometheus_helpers.rb (renamed from spec/support/prometheus_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/query_recorder.rb | 38 | ||||
-rw-r--r-- | spec/support/helpers/quick_actions_helpers.rb | 10 | ||||
-rw-r--r-- | spec/support/helpers/rake_helpers.rb (renamed from spec/support/rake_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/reactive_caching_helpers.rb (renamed from spec/support/reactive_caching_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/redis_without_keys.rb (renamed from spec/support/redis_without_keys.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/reference_parser_helpers.rb (renamed from spec/support/reference_parser_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/repo_helpers.rb (renamed from spec/support/repo_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/search_helpers.rb (renamed from spec/support/search_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/seed_helper.rb (renamed from spec/support/seed_helper.rb) | 10 | ||||
-rw-r--r-- | spec/support/helpers/seed_repo.rb (renamed from spec/support/seed_repo.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/select2_helper.rb (renamed from spec/support/select2_helper.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/selection_helper.rb (renamed from spec/support/selection_helper.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/sorting_helper.rb | 18 | ||||
-rw-r--r-- | spec/support/helpers/stub_configuration.rb (renamed from spec/support/stub_configuration.rb) | 3 | ||||
-rw-r--r-- | spec/support/helpers/stub_env.rb (renamed from spec/support/stub_env.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/stub_feature_flags.rb (renamed from spec/support/stub_feature_flags.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/stub_gitlab_calls.rb (renamed from spec/support/stub_gitlab_calls.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/stub_gitlab_data.rb (renamed from spec/support/stub_gitlab_data.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/stub_object_storage.rb (renamed from spec/support/stub_object_storage.rb) | 2 | ||||
-rw-r--r-- | spec/support/helpers/test_env.rb (renamed from spec/support/test_env.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/upload_helpers.rb (renamed from spec/support/upload_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/user_activities_helpers.rb (renamed from spec/support/user_activities_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/wait_for_requests.rb (renamed from spec/support/wait_for_requests.rb) | 0 | ||||
-rw-r--r-- | spec/support/helpers/workhorse_helpers.rb (renamed from spec/support/workhorse_helpers.rb) | 0 | ||||
-rw-r--r-- | spec/support/json_response.rb (renamed from spec/support/json_response_helpers.rb) | 4 | ||||
-rw-r--r-- | spec/support/matchers/background_migrations_matchers.rb (renamed from spec/support/background_migrations_matchers.rb) | 0 | ||||
-rw-r--r-- | spec/support/matchers/exceed_query_limit.rb (renamed from spec/support/query_recorder.rb) | 39 | ||||
-rwxr-xr-x | spec/support/prepare-gitlab-git-test-for-commit | 2 | ||||
-rw-r--r-- | spec/support/routing_helpers.rb | 3 | ||||
-rw-r--r-- | spec/support/rspec.rb | 12 | ||||
-rw-r--r-- | spec/support/seed.rb | 7 | ||||
-rw-r--r-- | spec/support/shared_contexts/json_response_shared_context.rb | 3 | ||||
-rw-r--r-- | spec/support/shared_contexts/services_shared_context.rb (renamed from spec/support/services_shared_context.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/chat_slash_commands_shared_examples.rb (renamed from spec/support/chat_slash_commands_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/email_format_shared_examples.rb (renamed from spec/support/email_format_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/gitlab_verify.rb (renamed from spec/support/gitlab_verify.rb) | 26 | ||||
-rw-r--r-- | spec/support/shared_examples/group_members_shared_example.rb (renamed from spec/support/group_members_shared_example.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/issuable_shared_examples.rb (renamed from spec/support/issuable_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/issuables_list_metadata_shared_examples.rb (renamed from spec/support/issuables_list_metadata_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/issue_tracker_service_shared_example.rb (renamed from spec/support/issue_tracker_service_shared_example.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/ldap_shared_examples.rb (renamed from spec/support/ldap_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/legacy_path_redirect_shared_examples.rb (renamed from spec/support/legacy_path_redirect_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/malicious_regexp_shared_examples.rb (renamed from spec/support/malicious_regexp_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/mentionable_shared_examples.rb (renamed from spec/support/mentionable_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/milestone_tabs_examples.rb (renamed from spec/support/milestone_tabs_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/notify_shared_examples.rb (renamed from spec/support/notify_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/reference_parser_shared_examples.rb (renamed from spec/support/reference_parser_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/slack_mattermost_notifications_shared_examples.rb (renamed from spec/support/slack_mattermost_notifications_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/snippet_visibility.rb (renamed from spec/support/snippet_visibility.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/snippets_shared_examples.rb (renamed from spec/support/snippets_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/taskable_shared_examples.rb (renamed from spec/support/taskable_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/time_tracking_shared_examples.rb (renamed from spec/support/time_tracking_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/unique_ip_check_shared_examples.rb (renamed from spec/support/unique_ip_check_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/update_invalid_issuable.rb (renamed from spec/support/update_invalid_issuable.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/updating_mentions_shared_examples.rb (renamed from spec/support/updating_mentions_shared_examples.rb) | 0 |
106 files changed, 169 insertions, 143 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d443238b9e1..16b0b5c95e2 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -143,7 +143,7 @@ Lint/MissingCopEnableDirective: Lint/NestedPercentLiteral: Exclude: - 'lib/gitlab/git/repository.rb' - - 'spec/support/email_format_shared_examples.rb' + - 'spec/support/shared_examples/email_format_shared_examples.rb' # Offense count: 1 Lint/ReturnInVoidContext: @@ -195,8 +195,8 @@ Naming/HeredocDelimiterCase: - 'spec/lib/gitlab/diff/parser_spec.rb' - 'spec/lib/json_web_token/rsa_token_spec.rb' - 'spec/models/commit_spec.rb' - - 'spec/support/repo_helpers.rb' - - 'spec/support/seed_repo.rb' + - 'spec/support/helpers/repo_helpers.rb' + - 'spec/support/helpers/seed_repo.rb' # Offense count: 112 # Configuration parameters: Blacklist. @@ -496,7 +496,7 @@ Style/EmptyLiteral: - 'spec/lib/gitlab/request_context_spec.rb' - 'spec/lib/gitlab/workhorse_spec.rb' - 'spec/requests/api/jobs_spec.rb' - - 'spec/support/chat_slash_commands_shared_examples.rb' + - 'spec/support/shared_examples/chat_slash_commands_shared_examples.rb' # Offense count: 102 # Cop supports --auto-correct. diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb index d7be6f5950f..7b9a4bad449 100644 --- a/db/fixtures/development/17_cycle_analytics.rb +++ b/db/fixtures/development/17_cycle_analytics.rb @@ -1,5 +1,5 @@ require './spec/support/sidekiq' -require './spec/support/test_env' +require './spec/support/helpers/test_env' class Gitlab::Seeder::CycleAnalytics def initialize(project, perf: false) diff --git a/doc/development/testing_guide/testing_rake_tasks.md b/doc/development/testing_guide/testing_rake_tasks.md index 60163f1a230..db8ca87e9f8 100644 --- a/doc/development/testing_guide/testing_rake_tasks.md +++ b/doc/development/testing_guide/testing_rake_tasks.md @@ -9,7 +9,7 @@ At a minimum, requiring the Rake helper will redirect `stdout`, include the runtime task helpers, and include the `RakeHelpers` Spec support module. The `RakeHelpers` module exposes a `run_rake_task(<task>)` method to make -executing tasks simple. See `spec/support/rake_helpers.rb` for all available +executing tasks simple. See `spec/support/helpers/rake_helpers.rb` for all available methods. Example: diff --git a/features/support/env.rb b/features/support/env.rb index 15211995918..8fa2fcb6e3e 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -12,7 +12,11 @@ end WebMock.enable! -%w(select2_helper test_env repo_helpers wait_for_requests sidekiq project_forks_helper webmock).each do |f| +%w(select2_helper test_env repo_helpers wait_for_requests project_forks_helper).each do |f| + require Rails.root.join('spec', 'support', 'helpers', f) +end + +%w(sidekiq webmock).each do |f| require Rails.root.join('spec', 'support', f) end diff --git a/spec/factories/commits.rb b/spec/factories/commits.rb index d5d819d862a..818f7b046f6 100644 --- a/spec/factories/commits.rb +++ b/spec/factories/commits.rb @@ -1,4 +1,4 @@ -require_relative '../support/repo_helpers' +require_relative '../support/helpers/repo_helpers' FactoryBot.define do factory :commit do diff --git a/spec/factories/gpg_key_subkeys.rb b/spec/factories/gpg_key_subkeys.rb index 57eaaee345f..6c7db5379a9 100644 --- a/spec/factories/gpg_key_subkeys.rb +++ b/spec/factories/gpg_key_subkeys.rb @@ -1,5 +1,3 @@ -require_relative '../support/gpg_helpers' - FactoryBot.define do factory :gpg_key_subkey do gpg_key diff --git a/spec/factories/gpg_keys.rb b/spec/factories/gpg_keys.rb index b8aabf74221..51b8ddc9934 100644 --- a/spec/factories/gpg_keys.rb +++ b/spec/factories/gpg_keys.rb @@ -1,4 +1,4 @@ -require_relative '../support/gpg_helpers' +require_relative '../support/helpers/gpg_helpers' FactoryBot.define do factory :gpg_key do diff --git a/spec/factories/gpg_signature.rb b/spec/factories/gpg_signature.rb index 4620caff823..b89e6ffc4b3 100644 --- a/spec/factories/gpg_signature.rb +++ b/spec/factories/gpg_signature.rb @@ -1,5 +1,3 @@ -require_relative '../support/gpg_helpers' - FactoryBot.define do factory :gpg_signature do commit_sha { Digest::SHA1.hexdigest(SecureRandom.hex) } diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb index 857333f222d..40f3fa7d69b 100644 --- a/spec/factories/notes.rb +++ b/spec/factories/notes.rb @@ -1,4 +1,4 @@ -require_relative '../support/repo_helpers' +require_relative '../support/helpers/repo_helpers' include ActionDispatch::TestProcess diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 1761b6e2a3b..1ae6152a1f0 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -1,4 +1,4 @@ -require_relative '../support/test_env' +require_relative '../support/helpers/test_env' FactoryBot.define do # Project without repository diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 83664bae046..53045815a6a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -32,42 +32,19 @@ require 'rainbow/ext/string' # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. +# Requires helpers, and shared contexts/examples first since they're used in other support files +Dir[Rails.root.join("spec/support/helpers/*.rb")].each { |f| require f } +Dir[Rails.root.join("spec/support/shared_contexts/*.rb")].each { |f| require f } +Dir[Rails.root.join("spec/support/shared_examples/*.rb")].each { |f| require f } Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } RSpec.configure do |config| config.use_transactional_fixtures = false config.use_instantiated_fixtures = false - config.mock_with :rspec config.verbose_retry = true config.display_try_failure_messages = true - config.include Devise::Test::ControllerHelpers, type: :controller - config.include Devise::Test::ControllerHelpers, type: :view - config.include Devise::Test::IntegrationHelpers, type: :feature - config.include Warden::Test::Helpers, type: :request - config.include LoginHelpers, type: :feature - config.include SearchHelpers, type: :feature - config.include CookieHelper, :js - config.include InputHelper, :js - config.include SelectionHelper, :js - config.include InspectRequests, :js - config.include WaitForRequests, :js - config.include LiveDebugger, :js - config.include StubConfiguration - config.include EmailHelpers, :mailer, type: :mailer - config.include TestEnv - config.include ActiveJob::TestHelper - config.include ActiveSupport::Testing::TimeHelpers - config.include StubGitlabCalls - config.include StubGitlabData - config.include ApiHelpers, :api - config.include Gitlab::Routing, type: :routing - config.include MigrationsHelpers, :migration - config.include StubFeatureFlags - config.include StubENV - config.include ExpectOffense - config.infer_spec_type_from_file_location! config.define_derived_metadata(file_path: %r{/spec/}) do |metadata| @@ -82,7 +59,33 @@ RSpec.configure do |config| metadata[:type] = match[1].singularize.to_sym if match end - config.raise_errors_for_deprecations! + config.include ActiveJob::TestHelper + config.include ActiveSupport::Testing::TimeHelpers + config.include CycleAnalyticsHelpers + config.include ExpectOffense + config.include FactoryBot::Syntax::Methods + config.include FixtureHelpers + config.include GitlabRoutingHelper + config.include StubFeatureFlags + config.include StubGitlabCalls + config.include StubGitlabData + config.include TestEnv + config.include Devise::Test::ControllerHelpers, type: :controller + config.include Devise::Test::IntegrationHelpers, type: :feature + config.include LoginHelpers, type: :feature + config.include SearchHelpers, type: :feature + config.include EmailHelpers, :mailer, type: :mailer + config.include Warden::Test::Helpers, type: :request + config.include Gitlab::Routing, type: :routing + config.include Devise::Test::ControllerHelpers, type: :view + config.include ApiHelpers, :api + config.include CookieHelper, :js + config.include InputHelper, :js + config.include SelectionHelper, :js + config.include InspectRequests, :js + config.include WaitForRequests, :js + config.include LiveDebugger, :js + config.include MigrationsHelpers, :migration if ENV['CI'] # This includes the first try, i.e. tests will be run 4 times before failing. diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 9ddcc5f2fbf..c0ceb0f6605 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -60,6 +60,8 @@ Capybara::Screenshot.register_driver(:chrome) do |driver, path| end RSpec.configure do |config| + config.include CapybaraHelpers, type: :feature + config.before(:context, :js) do next if $capybara_server_already_started diff --git a/spec/support/factory_bot.rb b/spec/support/factory_bot.rb deleted file mode 100644 index c7890e49c66..00000000000 --- a/spec/support/factory_bot.rb +++ /dev/null @@ -1,3 +0,0 @@ -RSpec.configure do |config| - config.include FactoryBot::Syntax::Methods -end diff --git a/spec/support/generate-seed-repo-rb b/spec/support/generate-seed-repo-rb index 876b3b8242d..44b3de23b99 100755 --- a/spec/support/generate-seed-repo-rb +++ b/spec/support/generate-seed-repo-rb @@ -8,7 +8,7 @@ # # Usage: # -# ./spec/support/generate-seed-repo-rb > spec/support/seed_repo.rb +# ./spec/support/generate-seed-repo-rb > spec/support/helpers/seed_repo.rb # # diff --git a/spec/support/gitlab-git-test.git/README.md b/spec/support/gitlab-git-test.git/README.md index f072cd421be..f757e613ee6 100644 --- a/spec/support/gitlab-git-test.git/README.md +++ b/spec/support/gitlab-git-test.git/README.md @@ -12,5 +12,5 @@ inflate the size of the gitlab-ce repository. - make changes in your local clone of gitlab-git-test - run `git push` which will push to your local source `gitlab-ce/spec/support/gitlab-git-test.git` - in gitlab-ce: run `spec/support/prepare-gitlab-git-test-for-commit` -- in gitlab-ce: `git add spec/support/seed_repo.rb spec/support/gitlab-git-test.git` +- in gitlab-ce: `git add spec/support/helpers/seed_repo.rb spec/support/gitlab-git-test.git` - commit your changes in gitlab-ce diff --git a/spec/support/api_helpers.rb b/spec/support/helpers/api_helpers.rb index ac0c7a9b493..ac0c7a9b493 100644 --- a/spec/support/api_helpers.rb +++ b/spec/support/helpers/api_helpers.rb diff --git a/spec/support/bare_repo_operations.rb b/spec/support/helpers/bare_repo_operations.rb index 3f4a4243cb6..3f4a4243cb6 100644 --- a/spec/support/bare_repo_operations.rb +++ b/spec/support/helpers/bare_repo_operations.rb diff --git a/spec/support/board_helpers.rb b/spec/support/helpers/board_helpers.rb index 507d0432d7f..507d0432d7f 100644 --- a/spec/support/board_helpers.rb +++ b/spec/support/helpers/board_helpers.rb diff --git a/spec/support/capybara_helpers.rb b/spec/support/helpers/capybara_helpers.rb index 868233416bf..bcc2df44708 100644 --- a/spec/support/capybara_helpers.rb +++ b/spec/support/helpers/capybara_helpers.rb @@ -41,7 +41,3 @@ module CapybaraHelpers page.driver.browser.manage.delete_cookie('_gitlab_session') end end - -RSpec.configure do |config| - config.include CapybaraHelpers, type: :feature -end diff --git a/spec/support/cookie_helper.rb b/spec/support/helpers/cookie_helper.rb index 5ff7b0b68c9..5ff7b0b68c9 100644 --- a/spec/support/cookie_helper.rb +++ b/spec/support/helpers/cookie_helper.rb diff --git a/spec/support/cycle_analytics_helpers.rb b/spec/support/helpers/cycle_analytics_helpers.rb index 73cc64c0b74..55359d36597 100644 --- a/spec/support/cycle_analytics_helpers.rb +++ b/spec/support/helpers/cycle_analytics_helpers.rb @@ -135,7 +135,3 @@ module CycleAnalyticsHelpers end end end - -RSpec.configure do |config| - config.include CycleAnalyticsHelpers -end diff --git a/spec/support/database_connection_helpers.rb b/spec/support/helpers/database_connection_helpers.rb index 763329499f0..763329499f0 100644 --- a/spec/support/database_connection_helpers.rb +++ b/spec/support/helpers/database_connection_helpers.rb diff --git a/spec/support/devise_helpers.rb b/spec/support/helpers/devise_helpers.rb index 66874e10f38..66874e10f38 100644 --- a/spec/support/devise_helpers.rb +++ b/spec/support/helpers/devise_helpers.rb diff --git a/spec/support/drag_to_helper.rb b/spec/support/helpers/drag_to_helper.rb index ae149631ed9..ae149631ed9 100644 --- a/spec/support/drag_to_helper.rb +++ b/spec/support/helpers/drag_to_helper.rb diff --git a/spec/support/dropzone_helper.rb b/spec/support/helpers/dropzone_helper.rb index fe72d320fcf..fe72d320fcf 100644 --- a/spec/support/dropzone_helper.rb +++ b/spec/support/helpers/dropzone_helper.rb diff --git a/spec/support/email_helpers.rb b/spec/support/helpers/email_helpers.rb index 1fb8252459f..1fb8252459f 100644 --- a/spec/support/email_helpers.rb +++ b/spec/support/helpers/email_helpers.rb diff --git a/spec/support/fake_migration_classes.rb b/spec/support/helpers/fake_migration_classes.rb index b0fc8422857..b0fc8422857 100644 --- a/spec/support/fake_migration_classes.rb +++ b/spec/support/helpers/fake_migration_classes.rb diff --git a/spec/support/fake_u2f_device.rb b/spec/support/helpers/fake_u2f_device.rb index a7605cd483a..a7605cd483a 100644 --- a/spec/support/fake_u2f_device.rb +++ b/spec/support/helpers/fake_u2f_device.rb diff --git a/spec/support/filter_item_select_helper.rb b/spec/support/helpers/filter_item_select_helper.rb index 519e84d359e..519e84d359e 100644 --- a/spec/support/filter_item_select_helper.rb +++ b/spec/support/helpers/filter_item_select_helper.rb diff --git a/spec/support/filter_spec_helper.rb b/spec/support/helpers/filter_spec_helper.rb index 721d359c2ee..721d359c2ee 100644 --- a/spec/support/filter_spec_helper.rb +++ b/spec/support/helpers/filter_spec_helper.rb diff --git a/spec/support/filtered_search_helpers.rb b/spec/support/helpers/filtered_search_helpers.rb index 5f42ff77fb2..5f42ff77fb2 100644 --- a/spec/support/filtered_search_helpers.rb +++ b/spec/support/helpers/filtered_search_helpers.rb diff --git a/spec/support/fixture_helpers.rb b/spec/support/helpers/fixture_helpers.rb index 8854382dc6b..611d19f36a0 100644 --- a/spec/support/fixture_helpers.rb +++ b/spec/support/helpers/fixture_helpers.rb @@ -9,7 +9,3 @@ module FixtureHelpers File.expand_path(Rails.root.join(dir, 'spec', 'fixtures', filename)) end end - -RSpec.configure do |config| - config.include FixtureHelpers -end diff --git a/spec/support/git_http_helpers.rb b/spec/support/helpers/git_http_helpers.rb index b8289e6c5f1..b8289e6c5f1 100644 --- a/spec/support/git_http_helpers.rb +++ b/spec/support/helpers/git_http_helpers.rb diff --git a/spec/support/helpers/gitlab_verify_helpers.rb b/spec/support/helpers/gitlab_verify_helpers.rb new file mode 100644 index 00000000000..5df4bf24ec2 --- /dev/null +++ b/spec/support/helpers/gitlab_verify_helpers.rb @@ -0,0 +1,25 @@ +module GitlabVerifyHelpers + def collect_ranges(args = {}) + verifier = described_class.new(args.merge(batch_size: 1)) + + collect_results(verifier).map { |range, _| range } + end + + def collect_failures + verifier = described_class.new(batch_size: 1) + + out = {} + + collect_results(verifier).map { |_, failures| out.merge!(failures) } + + out + end + + def collect_results(verifier) + out = [] + + verifier.run_batches { |*args| out << args } + + out + end +end diff --git a/spec/support/gpg_helpers.rb b/spec/support/helpers/gpg_helpers.rb index 3f7279a50e0..3f7279a50e0 100644 --- a/spec/support/gpg_helpers.rb +++ b/spec/support/helpers/gpg_helpers.rb diff --git a/spec/support/import_spec_helper.rb b/spec/support/helpers/import_spec_helper.rb index d4eced724fa..d4eced724fa 100644 --- a/spec/support/import_spec_helper.rb +++ b/spec/support/helpers/import_spec_helper.rb diff --git a/spec/support/input_helper.rb b/spec/support/helpers/input_helper.rb index acbb42274ec..acbb42274ec 100644 --- a/spec/support/input_helper.rb +++ b/spec/support/helpers/input_helper.rb diff --git a/spec/support/inspect_requests.rb b/spec/support/helpers/inspect_requests.rb index 88ddc5c7f6c..88ddc5c7f6c 100644 --- a/spec/support/inspect_requests.rb +++ b/spec/support/helpers/inspect_requests.rb diff --git a/spec/support/issue_helpers.rb b/spec/support/helpers/issue_helpers.rb index ffd72515f37..ffd72515f37 100644 --- a/spec/support/issue_helpers.rb +++ b/spec/support/helpers/issue_helpers.rb diff --git a/spec/support/javascript_fixtures_helpers.rb b/spec/support/helpers/javascript_fixtures_helpers.rb index 2197bc9d853..2197bc9d853 100644 --- a/spec/support/javascript_fixtures_helpers.rb +++ b/spec/support/helpers/javascript_fixtures_helpers.rb diff --git a/spec/support/jira_service_helper.rb b/spec/support/helpers/jira_service_helper.rb index 88a7aeba461..88a7aeba461 100644 --- a/spec/support/jira_service_helper.rb +++ b/spec/support/helpers/jira_service_helper.rb diff --git a/spec/support/kubernetes_helpers.rb b/spec/support/helpers/kubernetes_helpers.rb index e46b61b6461..e46b61b6461 100644 --- a/spec/support/kubernetes_helpers.rb +++ b/spec/support/helpers/kubernetes_helpers.rb diff --git a/spec/support/ldap_helpers.rb b/spec/support/helpers/ldap_helpers.rb index 0e87b3d359d..0e87b3d359d 100644 --- a/spec/support/ldap_helpers.rb +++ b/spec/support/helpers/ldap_helpers.rb diff --git a/spec/support/live_debugger.rb b/spec/support/helpers/live_debugger.rb index 911eb48a8ca..911eb48a8ca 100644 --- a/spec/support/live_debugger.rb +++ b/spec/support/helpers/live_debugger.rb diff --git a/spec/support/login_helpers.rb b/spec/support/helpers/login_helpers.rb index db34090e971..db34090e971 100644 --- a/spec/support/login_helpers.rb +++ b/spec/support/helpers/login_helpers.rb diff --git a/spec/support/markdown_feature.rb b/spec/support/helpers/markdown_feature.rb index 39e94ad53de..39e94ad53de 100644 --- a/spec/support/markdown_feature.rb +++ b/spec/support/helpers/markdown_feature.rb diff --git a/spec/support/merge_request_helpers.rb b/spec/support/helpers/merge_request_helpers.rb index 772adff4626..772adff4626 100644 --- a/spec/support/merge_request_helpers.rb +++ b/spec/support/helpers/merge_request_helpers.rb diff --git a/spec/support/migrations_helpers.rb b/spec/support/helpers/migrations_helpers.rb index 5d6f662e8fe..5d6f662e8fe 100644 --- a/spec/support/migrations_helpers.rb +++ b/spec/support/helpers/migrations_helpers.rb diff --git a/spec/support/mobile_helpers.rb b/spec/support/helpers/mobile_helpers.rb index 3b9eb84e824..3b9eb84e824 100644 --- a/spec/support/mobile_helpers.rb +++ b/spec/support/helpers/mobile_helpers.rb diff --git a/spec/support/project_forks_helper.rb b/spec/support/helpers/project_forks_helper.rb index 2c501a2a27c..2c501a2a27c 100644 --- a/spec/support/project_forks_helper.rb +++ b/spec/support/helpers/project_forks_helper.rb diff --git a/spec/support/prometheus_helpers.rb b/spec/support/helpers/prometheus_helpers.rb index 4212be2cc88..4212be2cc88 100644 --- a/spec/support/prometheus_helpers.rb +++ b/spec/support/helpers/prometheus_helpers.rb diff --git a/spec/support/helpers/query_recorder.rb b/spec/support/helpers/query_recorder.rb new file mode 100644 index 00000000000..28536bbef5e --- /dev/null +++ b/spec/support/helpers/query_recorder.rb @@ -0,0 +1,38 @@ +module ActiveRecord + class QueryRecorder + attr_reader :log, :cached + + def initialize(&block) + @log = [] + @cached = [] + ActiveSupport::Notifications.subscribed(method(:callback), 'sql.active_record', &block) + end + + def show_backtrace(values) + Rails.logger.debug("QueryRecorder SQL: #{values[:sql]}") + caller.each { |line| Rails.logger.debug(" --> #{line}") } + end + + def callback(name, start, finish, message_id, values) + show_backtrace(values) if ENV['QUERY_RECORDER_DEBUG'] + + if values[:name]&.include?("CACHE") + @cached << values[:sql] + elsif !values[:name]&.include?("SCHEMA") + @log << values[:sql] + end + end + + def count + @log.count + end + + def cached_count + @cached.count + end + + def log_message + @log.join("\n\n") + end + end +end diff --git a/spec/support/helpers/quick_actions_helpers.rb b/spec/support/helpers/quick_actions_helpers.rb new file mode 100644 index 00000000000..361190aa352 --- /dev/null +++ b/spec/support/helpers/quick_actions_helpers.rb @@ -0,0 +1,10 @@ +module QuickActionsHelpers + def write_note(text) + Sidekiq::Testing.fake! do + page.within('.js-main-target-form') do + fill_in 'note[note]', with: text + find('.js-comment-submit-button').click + end + end + end +end diff --git a/spec/support/rake_helpers.rb b/spec/support/helpers/rake_helpers.rb index 86bfeed107c..86bfeed107c 100644 --- a/spec/support/rake_helpers.rb +++ b/spec/support/helpers/rake_helpers.rb diff --git a/spec/support/reactive_caching_helpers.rb b/spec/support/helpers/reactive_caching_helpers.rb index e22dd974c6a..e22dd974c6a 100644 --- a/spec/support/reactive_caching_helpers.rb +++ b/spec/support/helpers/reactive_caching_helpers.rb diff --git a/spec/support/redis_without_keys.rb b/spec/support/helpers/redis_without_keys.rb index 6220167dee6..6220167dee6 100644 --- a/spec/support/redis_without_keys.rb +++ b/spec/support/helpers/redis_without_keys.rb diff --git a/spec/support/reference_parser_helpers.rb b/spec/support/helpers/reference_parser_helpers.rb index c01897ed1a1..c01897ed1a1 100644 --- a/spec/support/reference_parser_helpers.rb +++ b/spec/support/helpers/reference_parser_helpers.rb diff --git a/spec/support/repo_helpers.rb b/spec/support/helpers/repo_helpers.rb index 3c6956cf5e0..3c6956cf5e0 100644 --- a/spec/support/repo_helpers.rb +++ b/spec/support/helpers/repo_helpers.rb diff --git a/spec/support/search_helpers.rb b/spec/support/helpers/search_helpers.rb index abbbb636d66..abbbb636d66 100644 --- a/spec/support/search_helpers.rb +++ b/spec/support/helpers/search_helpers.rb diff --git a/spec/support/seed_helper.rb b/spec/support/helpers/seed_helper.rb index 11ef1fc477f..8fd107260cc 100644 --- a/spec/support/seed_helper.rb +++ b/spec/support/helpers/seed_helper.rb @@ -9,7 +9,7 @@ TEST_MUTABLE_REPO_PATH = 'mutable-repo.git'.freeze TEST_BROKEN_REPO_PATH = 'broken-repo.git'.freeze module SeedHelper - GITLAB_GIT_TEST_REPO_URL = File.expand_path('../gitlab-git-test.git', __FILE__).freeze + GITLAB_GIT_TEST_REPO_URL = File.expand_path('../gitlab-git-test.git', __dir__).freeze def ensure_seeds if File.exist?(SEED_STORAGE_PATH) @@ -108,11 +108,3 @@ bla/bla.txt { 'GIT_TEMPLATE_DIR' => '' } end end - -RSpec.configure do |config| - config.include SeedHelper, :seed_helper - - config.before(:all, :seed_helper) do - ensure_seeds - end -end diff --git a/spec/support/seed_repo.rb b/spec/support/helpers/seed_repo.rb index b4868e82cd7..b4868e82cd7 100644 --- a/spec/support/seed_repo.rb +++ b/spec/support/helpers/seed_repo.rb diff --git a/spec/support/select2_helper.rb b/spec/support/helpers/select2_helper.rb index 90618ba5b19..90618ba5b19 100644 --- a/spec/support/select2_helper.rb +++ b/spec/support/helpers/select2_helper.rb diff --git a/spec/support/selection_helper.rb b/spec/support/helpers/selection_helper.rb index b4725b137b2..b4725b137b2 100644 --- a/spec/support/selection_helper.rb +++ b/spec/support/helpers/selection_helper.rb diff --git a/spec/support/helpers/sorting_helper.rb b/spec/support/helpers/sorting_helper.rb new file mode 100644 index 00000000000..577518d726c --- /dev/null +++ b/spec/support/helpers/sorting_helper.rb @@ -0,0 +1,18 @@ +# Helper allows you to sort items +# +# Params +# value - value for sorting +# +# Usage: +# include SortingHelper +# +# sorting_by('Oldest updated') +# +module SortingHelper + def sorting_by(value) + find('button.dropdown-toggle').click + page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do + click_link value + end + end +end diff --git a/spec/support/stub_configuration.rb b/spec/support/helpers/stub_configuration.rb index a75a3eaefcb..1823099dd9c 100644 --- a/spec/support/stub_configuration.rb +++ b/spec/support/helpers/stub_configuration.rb @@ -1,3 +1,6 @@ +require 'active_support/core_ext/hash/transform_values' +require 'active_support/hash_with_indifferent_access' + module StubConfiguration def stub_application_setting(messages) add_predicates(messages) diff --git a/spec/support/stub_env.rb b/spec/support/helpers/stub_env.rb index 36b90fc68d6..36b90fc68d6 100644 --- a/spec/support/stub_env.rb +++ b/spec/support/helpers/stub_env.rb diff --git a/spec/support/stub_feature_flags.rb b/spec/support/helpers/stub_feature_flags.rb index b96338bf548..b96338bf548 100644 --- a/spec/support/stub_feature_flags.rb +++ b/spec/support/helpers/stub_feature_flags.rb diff --git a/spec/support/stub_gitlab_calls.rb b/spec/support/helpers/stub_gitlab_calls.rb index c1618f5086c..c1618f5086c 100644 --- a/spec/support/stub_gitlab_calls.rb +++ b/spec/support/helpers/stub_gitlab_calls.rb diff --git a/spec/support/stub_gitlab_data.rb b/spec/support/helpers/stub_gitlab_data.rb index fa402f35b95..fa402f35b95 100644 --- a/spec/support/stub_gitlab_data.rb +++ b/spec/support/helpers/stub_gitlab_data.rb diff --git a/spec/support/stub_object_storage.rb b/spec/support/helpers/stub_object_storage.rb index 6e88641da42..19d744b959a 100644 --- a/spec/support/stub_object_storage.rb +++ b/spec/support/helpers/stub_object_storage.rb @@ -1,4 +1,4 @@ -module StubConfiguration +module StubObjectStorage def stub_object_storage_uploader( config:, uploader:, diff --git a/spec/support/test_env.rb b/spec/support/helpers/test_env.rb index d87f265cdf0..d87f265cdf0 100644 --- a/spec/support/test_env.rb +++ b/spec/support/helpers/test_env.rb diff --git a/spec/support/upload_helpers.rb b/spec/support/helpers/upload_helpers.rb index 5eead80c935..5eead80c935 100644 --- a/spec/support/upload_helpers.rb +++ b/spec/support/helpers/upload_helpers.rb diff --git a/spec/support/user_activities_helpers.rb b/spec/support/helpers/user_activities_helpers.rb index 44feb104644..44feb104644 100644 --- a/spec/support/user_activities_helpers.rb +++ b/spec/support/helpers/user_activities_helpers.rb diff --git a/spec/support/wait_for_requests.rb b/spec/support/helpers/wait_for_requests.rb index fda0e29f983..fda0e29f983 100644 --- a/spec/support/wait_for_requests.rb +++ b/spec/support/helpers/wait_for_requests.rb diff --git a/spec/support/workhorse_helpers.rb b/spec/support/helpers/workhorse_helpers.rb index ef1f9f68671..ef1f9f68671 100644 --- a/spec/support/workhorse_helpers.rb +++ b/spec/support/helpers/workhorse_helpers.rb diff --git a/spec/support/json_response_helpers.rb b/spec/support/json_response.rb index aa235529c56..210b0e6d867 100644 --- a/spec/support/json_response_helpers.rb +++ b/spec/support/json_response.rb @@ -1,7 +1,3 @@ -shared_context 'JSON response' do - let(:json_response) { JSON.parse(response.body) } -end - RSpec.configure do |config| config.include_context 'JSON response' config.include_context 'JSON response', type: :request diff --git a/spec/support/background_migrations_matchers.rb b/spec/support/matchers/background_migrations_matchers.rb index f4127efc6ae..f4127efc6ae 100644 --- a/spec/support/background_migrations_matchers.rb +++ b/spec/support/matchers/background_migrations_matchers.rb diff --git a/spec/support/query_recorder.rb b/spec/support/matchers/exceed_query_limit.rb index 8cf8f45a8b2..88d22a3ddd9 100644 --- a/spec/support/query_recorder.rb +++ b/spec/support/matchers/exceed_query_limit.rb @@ -1,42 +1,3 @@ -module ActiveRecord - class QueryRecorder - attr_reader :log, :cached - - def initialize(&block) - @log = [] - @cached = [] - ActiveSupport::Notifications.subscribed(method(:callback), 'sql.active_record', &block) - end - - def show_backtrace(values) - Rails.logger.debug("QueryRecorder SQL: #{values[:sql]}") - caller.each { |line| Rails.logger.debug(" --> #{line}") } - end - - def callback(name, start, finish, message_id, values) - show_backtrace(values) if ENV['QUERY_RECORDER_DEBUG'] - - if values[:name]&.include?("CACHE") - @cached << values[:sql] - elsif !values[:name]&.include?("SCHEMA") - @log << values[:sql] - end - end - - def count - @log.count - end - - def cached_count - @cached.count - end - - def log_message - @log.join("\n\n") - end - end -end - RSpec::Matchers.define :exceed_query_limit do |expected| supports_block_expectations diff --git a/spec/support/prepare-gitlab-git-test-for-commit b/spec/support/prepare-gitlab-git-test-for-commit index 3047786a599..d08e3ba5481 100755 --- a/spec/support/prepare-gitlab-git-test-for-commit +++ b/spec/support/prepare-gitlab-git-test-for-commit @@ -1,7 +1,7 @@ #!/usr/bin/env ruby abort unless [ - system('spec/support/generate-seed-repo-rb', out: 'spec/support/seed_repo.rb'), + system('spec/support/generate-seed-repo-rb', out: 'spec/support/helpers/seed_repo.rb'), system('spec/support/unpack-gitlab-git-test') ].all? diff --git a/spec/support/routing_helpers.rb b/spec/support/routing_helpers.rb deleted file mode 100644 index af1f4760804..00000000000 --- a/spec/support/routing_helpers.rb +++ /dev/null @@ -1,3 +0,0 @@ -RSpec.configure do |config| - config.include GitlabRoutingHelper -end diff --git a/spec/support/rspec.rb b/spec/support/rspec.rb new file mode 100644 index 00000000000..dffab22d8b5 --- /dev/null +++ b/spec/support/rspec.rb @@ -0,0 +1,12 @@ +require_relative "helpers/stub_configuration" +require_relative "helpers/stub_object_storage" +require_relative "helpers/stub_env" + +RSpec.configure do |config| + config.mock_with :rspec + config.raise_errors_for_deprecations! + + config.include StubConfiguration + config.include StubObjectStorage + config.include StubENV +end diff --git a/spec/support/seed.rb b/spec/support/seed.rb new file mode 100644 index 00000000000..bea2e9c3044 --- /dev/null +++ b/spec/support/seed.rb @@ -0,0 +1,7 @@ +RSpec.configure do |config| + config.include SeedHelper, :seed_helper + + config.before(:all, :seed_helper) do + ensure_seeds + end +end diff --git a/spec/support/shared_contexts/json_response_shared_context.rb b/spec/support/shared_contexts/json_response_shared_context.rb new file mode 100644 index 00000000000..df5fc288089 --- /dev/null +++ b/spec/support/shared_contexts/json_response_shared_context.rb @@ -0,0 +1,3 @@ +shared_context 'JSON response' do + let(:json_response) { JSON.parse(response.body) } +end diff --git a/spec/support/services_shared_context.rb b/spec/support/shared_contexts/services_shared_context.rb index 23f9b46ae0c..23f9b46ae0c 100644 --- a/spec/support/services_shared_context.rb +++ b/spec/support/shared_contexts/services_shared_context.rb diff --git a/spec/support/chat_slash_commands_shared_examples.rb b/spec/support/shared_examples/chat_slash_commands_shared_examples.rb index dc97a39f051..dc97a39f051 100644 --- a/spec/support/chat_slash_commands_shared_examples.rb +++ b/spec/support/shared_examples/chat_slash_commands_shared_examples.rb diff --git a/spec/support/email_format_shared_examples.rb b/spec/support/shared_examples/email_format_shared_examples.rb index b924a208e71..b924a208e71 100644 --- a/spec/support/email_format_shared_examples.rb +++ b/spec/support/shared_examples/email_format_shared_examples.rb diff --git a/spec/support/gitlab_verify.rb b/spec/support/shared_examples/gitlab_verify.rb index 13e2e37624d..560913ca92f 100644 --- a/spec/support/gitlab_verify.rb +++ b/spec/support/shared_examples/gitlab_verify.rb @@ -17,29 +17,3 @@ RSpec.shared_examples 'Gitlab::Verify::BatchVerifier subclass' do end end end - -module GitlabVerifyHelpers - def collect_ranges(args = {}) - verifier = described_class.new(args.merge(batch_size: 1)) - - collect_results(verifier).map { |range, _| range } - end - - def collect_failures - verifier = described_class.new(batch_size: 1) - - out = {} - - collect_results(verifier).map { |_, failures| out.merge!(failures) } - - out - end - - def collect_results(verifier) - out = [] - - verifier.run_batches { |*args| out << args } - - out - end -end diff --git a/spec/support/group_members_shared_example.rb b/spec/support/shared_examples/group_members_shared_example.rb index 547c83c7955..547c83c7955 100644 --- a/spec/support/group_members_shared_example.rb +++ b/spec/support/shared_examples/group_members_shared_example.rb diff --git a/spec/support/issuable_shared_examples.rb b/spec/support/shared_examples/issuable_shared_examples.rb index 42f3b4db23c..42f3b4db23c 100644 --- a/spec/support/issuable_shared_examples.rb +++ b/spec/support/shared_examples/issuable_shared_examples.rb diff --git a/spec/support/issuables_list_metadata_shared_examples.rb b/spec/support/shared_examples/issuables_list_metadata_shared_examples.rb index e61983c60b4..e61983c60b4 100644 --- a/spec/support/issuables_list_metadata_shared_examples.rb +++ b/spec/support/shared_examples/issuables_list_metadata_shared_examples.rb diff --git a/spec/support/issue_tracker_service_shared_example.rb b/spec/support/shared_examples/issue_tracker_service_shared_example.rb index a6ab03cb808..a6ab03cb808 100644 --- a/spec/support/issue_tracker_service_shared_example.rb +++ b/spec/support/shared_examples/issue_tracker_service_shared_example.rb diff --git a/spec/support/ldap_shared_examples.rb b/spec/support/shared_examples/ldap_shared_examples.rb index 52c34e78965..52c34e78965 100644 --- a/spec/support/ldap_shared_examples.rb +++ b/spec/support/shared_examples/ldap_shared_examples.rb diff --git a/spec/support/legacy_path_redirect_shared_examples.rb b/spec/support/shared_examples/legacy_path_redirect_shared_examples.rb index f300bdd48b1..f300bdd48b1 100644 --- a/spec/support/legacy_path_redirect_shared_examples.rb +++ b/spec/support/shared_examples/legacy_path_redirect_shared_examples.rb diff --git a/spec/support/malicious_regexp_shared_examples.rb b/spec/support/shared_examples/malicious_regexp_shared_examples.rb index ac5d22298bb..ac5d22298bb 100644 --- a/spec/support/malicious_regexp_shared_examples.rb +++ b/spec/support/shared_examples/malicious_regexp_shared_examples.rb diff --git a/spec/support/mentionable_shared_examples.rb b/spec/support/shared_examples/mentionable_shared_examples.rb index 1685decbe94..1685decbe94 100644 --- a/spec/support/mentionable_shared_examples.rb +++ b/spec/support/shared_examples/mentionable_shared_examples.rb diff --git a/spec/support/milestone_tabs_examples.rb b/spec/support/shared_examples/milestone_tabs_examples.rb index 70b499198bf..70b499198bf 100644 --- a/spec/support/milestone_tabs_examples.rb +++ b/spec/support/shared_examples/milestone_tabs_examples.rb diff --git a/spec/support/notify_shared_examples.rb b/spec/support/shared_examples/notify_shared_examples.rb index e2c23607406..e2c23607406 100644 --- a/spec/support/notify_shared_examples.rb +++ b/spec/support/shared_examples/notify_shared_examples.rb diff --git a/spec/support/reference_parser_shared_examples.rb b/spec/support/shared_examples/reference_parser_shared_examples.rb index baf8bcc04b8..baf8bcc04b8 100644 --- a/spec/support/reference_parser_shared_examples.rb +++ b/spec/support/shared_examples/reference_parser_shared_examples.rb diff --git a/spec/support/slack_mattermost_notifications_shared_examples.rb b/spec/support/shared_examples/slack_mattermost_notifications_shared_examples.rb index 07bc3a51fd8..07bc3a51fd8 100644 --- a/spec/support/slack_mattermost_notifications_shared_examples.rb +++ b/spec/support/shared_examples/slack_mattermost_notifications_shared_examples.rb diff --git a/spec/support/snippet_visibility.rb b/spec/support/shared_examples/snippet_visibility.rb index 3a7c69b7877..3a7c69b7877 100644 --- a/spec/support/snippet_visibility.rb +++ b/spec/support/shared_examples/snippet_visibility.rb diff --git a/spec/support/snippets_shared_examples.rb b/spec/support/shared_examples/snippets_shared_examples.rb index 85f0facd5c3..85f0facd5c3 100644 --- a/spec/support/snippets_shared_examples.rb +++ b/spec/support/shared_examples/snippets_shared_examples.rb diff --git a/spec/support/taskable_shared_examples.rb b/spec/support/shared_examples/taskable_shared_examples.rb index 4056ff06b84..4056ff06b84 100644 --- a/spec/support/taskable_shared_examples.rb +++ b/spec/support/shared_examples/taskable_shared_examples.rb diff --git a/spec/support/time_tracking_shared_examples.rb b/spec/support/shared_examples/time_tracking_shared_examples.rb index 909d4e2ee8d..909d4e2ee8d 100644 --- a/spec/support/time_tracking_shared_examples.rb +++ b/spec/support/shared_examples/time_tracking_shared_examples.rb diff --git a/spec/support/unique_ip_check_shared_examples.rb b/spec/support/shared_examples/unique_ip_check_shared_examples.rb index e5c8ac6a004..e5c8ac6a004 100644 --- a/spec/support/unique_ip_check_shared_examples.rb +++ b/spec/support/shared_examples/unique_ip_check_shared_examples.rb diff --git a/spec/support/update_invalid_issuable.rb b/spec/support/shared_examples/update_invalid_issuable.rb index 1490287681b..1490287681b 100644 --- a/spec/support/update_invalid_issuable.rb +++ b/spec/support/shared_examples/update_invalid_issuable.rb diff --git a/spec/support/updating_mentions_shared_examples.rb b/spec/support/shared_examples/updating_mentions_shared_examples.rb index 5e3f19ba19e..5e3f19ba19e 100644 --- a/spec/support/updating_mentions_shared_examples.rb +++ b/spec/support/shared_examples/updating_mentions_shared_examples.rb |