Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-11 06:12:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-11 06:12:21 +0300
commit9fbfd2ebf45c0d22b844306c51b673106e1fdf17 (patch)
tree681d21abcfadb2843eab19e42a2f3ed198dd0729 /spec/experiments
parent18ad304adc191b31f11a311fc4b89e3ea8f0f328 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/experiments')
-rw-r--r--spec/experiments/application_experiment_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/experiments/application_experiment_spec.rb b/spec/experiments/application_experiment_spec.rb
index 896cb1e5d55..70ee4bd3c5a 100644
--- a/spec/experiments/application_experiment_spec.rb
+++ b/spec/experiments/application_experiment_spec.rb
@@ -391,4 +391,29 @@ RSpec.describe ApplicationExperiment, :experiment do
end
end
end
+
+ context "with deprecation warnings" do
+ before do
+ Gitlab::Experiment::Configuration.instance_variable_set(:@__dep_versions, nil) # clear the internal memoization
+
+ allow(ActiveSupport::Deprecation).to receive(:new).and_call_original
+ end
+
+ it "doesn't warn on non dev/test environments" do
+ allow(Gitlab).to receive(:dev_or_test_env?).and_return(false)
+
+ expect { experiment(:example) { |e| e.use { } } }.not_to raise_error
+ expect(ActiveSupport::Deprecation).not_to have_received(:new).with(anything, 'Gitlab::Experiment')
+ end
+
+ it "warns on dev and test environments" do
+ allow(Gitlab).to receive(:dev_or_test_env?).and_return(true)
+
+ # This will eventually raise an ActiveSupport::Deprecation exception,
+ # it's ok to change it when that happens.
+ expect { experiment(:example) { |e| e.use { } } }.not_to raise_error
+
+ expect(ActiveSupport::Deprecation).to have_received(:new).with(anything, 'Gitlab::Experiment')
+ end
+ end
end