diff options
Diffstat (limited to 'spec/lib/feature_spec.rb')
-rw-r--r-- | spec/lib/feature_spec.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/spec/lib/feature_spec.rb b/spec/lib/feature_spec.rb index 9d4820f9a4c..58e7292c125 100644 --- a/spec/lib/feature_spec.rb +++ b/spec/lib/feature_spec.rb @@ -102,12 +102,14 @@ RSpec.describe Feature, stub_feature_flags: false do describe '.flipper' do context 'when request store is inactive' do - it 'memoizes the Flipper instance' do + it 'memoizes the Flipper instance but does not not enable Flipper memoization' do expect(Flipper).to receive(:new).once.and_call_original 2.times do - described_class.send(:flipper) + described_class.flipper end + + expect(described_class.flipper.adapter.memoizing?).to eq(false) end end @@ -115,9 +117,11 @@ RSpec.describe Feature, stub_feature_flags: false do it 'memoizes the Flipper instance' do expect(Flipper).to receive(:new).once.and_call_original - described_class.send(:flipper) + described_class.flipper described_class.instance_variable_set(:@flipper, nil) - described_class.send(:flipper) + described_class.flipper + + expect(described_class.flipper.adapter.memoizing?).to eq(true) end end end @@ -310,7 +314,7 @@ RSpec.describe Feature, stub_feature_flags: false do context 'when database exists' do before do - allow(Gitlab::Database.main).to receive(:exists?).and_return(true) + allow(ApplicationRecord.database).to receive(:exists?).and_return(true) end it 'checks the persisted status and returns false' do @@ -322,7 +326,7 @@ RSpec.describe Feature, stub_feature_flags: false do context 'when database does not exist' do before do - allow(Gitlab::Database.main).to receive(:exists?).and_return(false) + allow(ApplicationRecord.database).to receive(:exists?).and_return(false) end it 'returns false without checking the status in the database' do |