diff options
Diffstat (limited to 'spec/support/rspec.rb')
-rw-r--r-- | spec/support/rspec.rb | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/spec/support/rspec.rb b/spec/support/rspec.rb index 7f3aa55fb1d..f2f93fff07e 100644 --- a/spec/support/rspec.rb +++ b/spec/support/rspec.rb @@ -1,11 +1,12 @@ # frozen_string_literal: true -require_relative "rspec_order" -require_relative "system_exit_detected" -require_relative "helpers/stub_configuration" -require_relative "helpers/stub_metrics" -require_relative "helpers/stub_object_storage" -require_relative "helpers/fast_rails_root" +require_relative 'rake' +require_relative 'rspec_order' +require_relative 'system_exit_detected' +require_relative 'helpers/stub_configuration' +require_relative 'helpers/stub_metrics' +require_relative 'helpers/stub_object_storage' +require_relative 'helpers/fast_rails_root' require 'gitlab/rspec/all' require 'gitlab/utils/all' @@ -19,6 +20,15 @@ RSpec.configure do |config| # Re-run failures locally with `--only-failures` config.example_status_persistence_file_path = ENV.fetch('RSPEC_LAST_RUN_RESULTS_FILE', './spec/examples.txt') + config.define_derived_metadata(file_path: %r{(ee)?/spec/.+_spec\.rb\z}) do |metadata| + # Infer metadata tag `type` if not already inferred by + # `infer_spec_type_from_file_location!`. + unless metadata.key?(:type) + match = %r{/spec/([^/]+)/}.match(metadata[:location]) + metadata[:type] = match[1].singularize.to_sym if match + end + end + # Makes diffs show entire non-truncated values. config.around(:each, :unlimited_max_formatted_output_length) do |example| old_max_formatted_output_length = RSpec::Support::ObjectFormatter.default_instance.max_formatted_output_length |