spec/flipper/dsl_spec.rb in flipper-0.24.0 vs spec/flipper/dsl_spec.rb in flipper-0.24.1
- old
+ new
@@ -4,12 +4,22 @@
subject { described_class.new(adapter) }
let(:adapter) { Flipper::Adapters::Memory.new }
describe '#initialize' do
- it 'sets adapter' do
- dsl = described_class.new(adapter)
- expect(dsl.adapter).not_to be_nil
+ context 'when using default memoize strategy' do
+ it 'wraps the given adapter with Flipper::Adapters::Memoizable' do
+ dsl = described_class.new(adapter)
+ expect(dsl.adapter.class).to be(Flipper::Adapters::Memoizable)
+ expect(dsl.adapter.adapter).to be(adapter)
+ end
+ end
+
+ context 'when disabling memoization' do
+ it 'uses the given adapter directly' do
+ dsl = described_class.new(adapter, memoize: false)
+ expect(dsl.adapter).to be(adapter)
+ end
end
it 'defaults instrumenter to noop' do
dsl = described_class.new(adapter)
expect(dsl.instrumenter).to be(Flipper::Instrumenters::Noop)