2020-12-16 04:10:26 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-02-01 07:09:03 -05:00
|
|
|
# Require the provided spec helper and matchers.
|
|
|
|
require 'gitlab/experiment/rspec'
|
2021-03-10 10:09:11 -05:00
|
|
|
require_relative 'stub_snowplow'
|
2021-02-01 07:09:03 -05:00
|
|
|
|
2021-01-28 10:09:06 -05:00
|
|
|
# This is a temporary fix until we have a larger discussion around the
|
|
|
|
# challenges raised in https://gitlab.com/gitlab-org/gitlab/-/issues/300104
|
2021-03-15 11:09:07 -04:00
|
|
|
require Rails.root.join('app', 'experiments', 'application_experiment')
|
2021-03-08 16:09:45 -05:00
|
|
|
class ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass
|
2021-02-08 19:09:37 -05:00
|
|
|
def initialize(...)
|
|
|
|
super(...)
|
2021-02-03 10:09:24 -05:00
|
|
|
Feature.persist_used!(feature_flag_name)
|
2021-01-28 10:09:06 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-02-23 04:10:45 -05:00
|
|
|
RSpec.configure do |config|
|
2021-03-10 10:09:11 -05:00
|
|
|
config.include StubSnowplow, :experiment
|
|
|
|
|
2021-02-23 04:10:45 -05:00
|
|
|
# Disable all caching for experiments in tests.
|
|
|
|
config.before do
|
|
|
|
allow(Gitlab::Experiment::Configuration).to receive(:cache).and_return(nil)
|
|
|
|
end
|
2021-03-10 10:09:11 -05:00
|
|
|
|
|
|
|
config.before(:each, :experiment) do
|
|
|
|
stub_snowplow
|
|
|
|
end
|
2021-02-23 04:10:45 -05:00
|
|
|
end
|