summaryrefslogtreecommitdiff
path: root/spec/support_specs/helpers/stub_feature_flags_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support_specs/helpers/stub_feature_flags_spec.rb')
-rw-r--r--spec/support_specs/helpers/stub_feature_flags_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/support_specs/helpers/stub_feature_flags_spec.rb b/spec/support_specs/helpers/stub_feature_flags_spec.rb
index 8d5f16751ae..5d1e4e1627d 100644
--- a/spec/support_specs/helpers/stub_feature_flags_spec.rb
+++ b/spec/support_specs/helpers/stub_feature_flags_spec.rb
@@ -119,6 +119,42 @@ RSpec.describe StubFeatureFlags do
end
end
+ describe 'stub timing' do
+ context 'let_it_be variable' do
+ let_it_be(:let_it_be_var) { Feature.enabled?(:any_feature_flag) }
+
+ it { expect(let_it_be_var).to eq true }
+ end
+
+ context 'before_all variable' do
+ before_all do
+ @suite_var = Feature.enabled?(:any_feature_flag)
+ end
+
+ it { expect(@suite_var).to eq true }
+ end
+
+ context 'before(:all) variable' do
+ before(:all) do
+ @suite_var = Feature.enabled?(:any_feature_flag)
+ end
+
+ it { expect(@suite_var).to eq true }
+ end
+
+ context 'with stub_feature_flags meta' do
+ let(:var) { Feature.enabled?(:any_feature_flag) }
+
+ context 'as true', :stub_feature_flags do
+ it { expect(var).to eq true }
+ end
+
+ context 'as false', stub_feature_flags: false do
+ it { expect(var).to eq false }
+ end
+ end
+ end
+
def actor(actor)
case actor
when Array