diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/lib/feature_spec.rb | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) | |
download | gitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
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 |