Commit bcb852e9 authored by Peter Leitzen's avatar Peter Leitzen

Extract stub_settings_source into spec support file

Rename `stubbing_settings_source` to `stub_settings_source` to keep
consistency across other support files.

Require this support file in spec where `stub_settings_source: true` is
used.

This avoids order dependent flaky specs like:

  bin/rspec \
    spec/commands/sidekiq_cluster/cli_spec.rb \
    spec/lib/gitlab/pagination/offset_header_builder_spec.rb

Note, both specs about are run with `fast_spec_helper` so previously
they would fail because RSpec trait `stubbing_settings_source` was not
available.
parent 4d235c06
......@@ -3,9 +3,10 @@
require 'fast_spec_helper'
require 'rspec-parameterized'
require_relative '../../support/stub_settings_source'
require_relative '../../../sidekiq_cluster/cli'
RSpec.describe Gitlab::SidekiqCluster::CLI, stubbing_settings_source: true do # rubocop:disable RSpec/FilePath
RSpec.describe Gitlab::SidekiqCluster::CLI, stub_settings_source: true do # rubocop:disable RSpec/FilePath
let(:cli) { described_class.new('/dev/null') }
let(:timeout) { Gitlab::SidekiqCluster::DEFAULT_SOFT_TIMEOUT_SECONDS }
let(:default_options) do
......
......@@ -462,14 +462,6 @@ RSpec.configure do |config|
$stdout = STDOUT
end
config.around(:each, stubbing_settings_source: true) do |example|
original_instance = ::Settings.instance_variable_get(:@instance)
example.run
::Settings.instance_variable_set(:@instance, original_instance)
end
config.disable_monkey_patching!
end
......
# frozen_string_literal: true
RSpec.configure do |config|
config.around(:each, stub_settings_source: true) do |example|
original_instance = ::Settings.instance_variable_get(:@instance)
example.run
::Settings.instance_variable_set(:@instance, original_instance)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment