spec/flipper/instrumentation/statsd_subscriber_spec.rb in flipper-1.0.0 vs spec/flipper/instrumentation/statsd_subscriber_spec.rb in flipper-1.1.0

- old
+ new

@@ -1,8 +1,7 @@ require 'flipper/adapters/instrumented' require 'flipper/instrumentation/statsd' -require 'statsd' begin require 'active_support/isolated_execution_state' rescue LoadError # ActiveSupport::IsolatedExecutionState is only available in Rails 5.2+ @@ -75,7 +74,22 @@ flipper[:stats].enabled?(user) assert_timer 'flipper.adapter.memory.get' flipper[:stats].disable(user) assert_timer 'flipper.adapter.memory.disable' + end + + context 'when client is nil' do + before do + described_class.client = nil + end + + it 'does not raise error' do + expect { flipper[:stats].enable(user) }.not_to raise_error + end + + it 'does not update metrics' do + flipper[:stats].enable(user) + expect(socket.buffer).to be_empty + end end end