spec/flipper/adapters/instrumented_spec.rb in flipper-0.26.2 vs spec/flipper/adapters/instrumented_spec.rb in flipper-0.27.0
- old
+ new
@@ -14,20 +14,10 @@
described_class.new(adapter, instrumenter: instrumenter)
end
it_should_behave_like 'a flipper adapter'
- it 'forwards missing methods to underlying adapter' do
- adapter = Class.new do
- def foo
- :foo
- end
- end.new
- instrumented = described_class.new(adapter)
- expect(instrumented.foo).to eq(:foo)
- end
-
describe '#name' do
it 'is instrumented' do
expect(subject.name).to be(:instrumented)
end
end
@@ -141,9 +131,37 @@
event = instrumenter.events.last
expect(event).not_to be_nil
expect(event.name).to eq('adapter_operation.flipper')
expect(event.payload[:operation]).to eq(:features)
expect(event.payload[:adapter_name]).to eq(:memory)
+ expect(event.payload[:result]).to be(result)
+ end
+ end
+
+ describe '#import' do
+ it 'records instrumentation' do
+ result = subject.import(Flipper::Adapters::Memory.new)
+
+ event = instrumenter.events.last
+ expect(event).not_to be_nil
+ expect(event.name).to eq('adapter_operation.flipper')
+ expect(event.payload[:operation]).to eq(:import)
+ expect(event.payload[:adapter_name]).to eq(:memory)
+ expect(event.payload[:result]).to be(result)
+ end
+ end
+
+ describe '#export' do
+ it 'records instrumentation' do
+ result = subject.export(format: :json, version: 1)
+
+ event = instrumenter.events.last
+ expect(event).not_to be_nil
+ expect(event.name).to eq('adapter_operation.flipper')
+ expect(event.payload[:operation]).to eq(:export)
+ expect(event.payload[:adapter_name]).to eq(:memory)
+ expect(event.payload[:format]).to be(:json)
+ expect(event.payload[:version]).to be(1)
expect(event.payload[:result]).to be(result)
end
end
end