diff options
author | Michael Kozono <mkozono@gmail.com> | 2018-09-24 22:29:22 +0300 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2018-09-24 22:29:22 +0300 |
commit | 74ae135888f55c17f6c53bcba9c1ca979a33724e (patch) | |
tree | 4035eda9d5a80652b5e6748d5355245363b7ee19 /spec | |
parent | a54a5d9f39df505fe7c68e14c693553bd29bd725 (diff) |
Refactor Feature.flipper method
* Fix typo in context 'when request store is active'
* Rearrange test since the instance variable always gets set now,
even if RequestStore is active
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/feature_spec.rb | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/spec/lib/feature_spec.rb b/spec/lib/feature_spec.rb index 48c0ba8a653..9d56c62ae57 100644 --- a/spec/lib/feature_spec.rb +++ b/spec/lib/feature_spec.rb @@ -91,7 +91,11 @@ describe Feature do end describe '.flipper' do - shared_examples 'a memoized Flipper instance' do + before do + described_class.instance_variable_set(:@flipper, nil) + end + + context 'when request store is inactive' do it 'memoizes the Flipper instance' do expect(Flipper).to receive(:new).once.and_call_original @@ -101,16 +105,14 @@ describe Feature do end end - context 'when request store is inactive' do - before do + context 'when request store is active', :request_store do + it 'memoizes the Flipper instance' do + expect(Flipper).to receive(:new).once.and_call_original + + described_class.flipper described_class.instance_variable_set(:@flipper, nil) + described_class.flipper end - - it_behaves_like 'a memoized Flipper instance' - end - - context 'when request store is inactive', :request_store do - it_behaves_like 'a memoized Flipper instance' end end |