spec/flipper/instrumentation/statsd_subscriber_spec.rb in flipper-0.26.2 vs spec/flipper/instrumentation/statsd_subscriber_spec.rb in flipper-0.27.0

- old
+ new

@@ -1,9 +1,15 @@ 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+ +end + RSpec.describe Flipper::Instrumentation::StatsdSubscriber do let(:statsd_client) { Statsd.new } let(:socket) { FakeUDPSocket.new } let(:adapter) do memory = Flipper::Adapters::Memory.new @@ -21,9 +27,13 @@ end after do described_class.client = nil Thread.current[:statsd_socket] = nil + end + + after(:all) do + ActiveSupport::Notifications.unsubscribe("flipper") end def assert_timer(metric) regex = /#{Regexp.escape metric}\:\d+\|ms/ result = socket.buffer.detect { |op| op.first =~ regex }