debian-mirror-gitlab/spec/support/rspec.rb

36 lines
1.2 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-10-15 14:42:47 +05:30
require_relative "helpers/stub_configuration"
2018-11-18 11:00:15 +05:30
require_relative "helpers/stub_metrics"
2018-10-15 14:42:47 +05:30
require_relative "helpers/stub_object_storage"
require_relative "helpers/stub_env"
2020-07-28 23:09:34 +05:30
require_relative "helpers/fast_rails_root"
2021-01-29 00:20:46 +05:30
# so we need to load rubocop here due to the rubocop support file loading cop_helper
# which monkey patches class Cop
# if cop helper is loaded before rubocop (where class Cop is defined as class Cop < Base)
# we get a `superclass mismatch for class Cop` error when running a rspec for a locally defined
# rubocop cop - therefore we need rubocop required first since it had an inheritance added to the Cop class
require 'rubocop'
2020-07-28 23:09:34 +05:30
require 'rubocop/rspec/support'
2018-10-15 14:42:47 +05:30
RSpec.configure do |config|
2022-01-26 12:08:38 +05:30
config.mock_with :rspec do |mocks|
mocks.verify_doubled_constant_names = true
end
2018-10-15 14:42:47 +05:30
config.raise_errors_for_deprecations!
config.include StubConfiguration
2018-11-18 11:00:15 +05:30
config.include StubMetrics
2018-10-15 14:42:47 +05:30
config.include StubObjectStorage
config.include StubENV
2020-07-28 23:09:34 +05:30
config.include FastRailsRoot
2020-06-23 00:09:42 +05:30
2020-07-28 23:09:34 +05:30
config.include RuboCop::RSpec::ExpectOffense, type: :rubocop
2021-03-08 18:12:59 +05:30
config.define_derived_metadata(file_path: %r{spec/rubocop}) do |metadata|
metadata[:type] = :rubocop
end
2018-10-15 14:42:47 +05:30
end