diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-02 09:09:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-02 09:09:47 +0300 |
commit | bcd0f3a2f6bd59a9de40f5a9f2829cec3d456207 (patch) | |
tree | 61512d781122c114e0049971264f031845a857a1 /spec/experiments | |
parent | 7580728fc297c86cc5a31fb67e7153217facf1c0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/experiments')
-rw-r--r-- | spec/experiments/application_experiment_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/experiments/application_experiment_spec.rb b/spec/experiments/application_experiment_spec.rb index 76fdcd222d1..5c5f563a803 100644 --- a/spec/experiments/application_experiment_spec.rb +++ b/spec/experiments/application_experiment_spec.rb @@ -5,6 +5,14 @@ require 'spec_helper' RSpec.describe ApplicationExperiment, :experiment do subject { described_class.new(:stub) } + let(:feature_definition) { { name: 'stub', type: 'experiment', group: 'group::adoption', default_enabled: false } } + + around do |example| + Feature::Definition.definitions[:stub] = Feature::Definition.new('stub.yml', feature_definition) + example.run + Feature::Definition.definitions.delete(:stub) + end + before do allow(subject).to receive(:enabled?).and_return(true) end @@ -105,6 +113,12 @@ RSpec.describe ApplicationExperiment, :experiment do end describe "variant resolution" do + it "uses the default value as specified in the yaml" do + expect(Feature).to receive(:enabled?).with('stub', subject, type: :experiment, default_enabled: :yaml) + + expect(subject.variant.name).to eq('control') + end + it "returns nil when not rolled out" do stub_feature_flags(stub: false) |