Sha256: 410b73617e5b4de21b793bd129fec6edcda8f9baadb334a2abe83bb980a03cff
Contents?: true
Size: 1.7 KB
Versions: 7
Compression:
Stored size: 1.7 KB
Contents
require 'helper' require 'flipper/adapters/memory' require 'flipper/instrumentation/metriks' RSpec.describe Flipper::Instrumentation::MetriksSubscriber do let(:adapter) { memory = Flipper::Adapters::Memory.new Flipper::Adapters::Instrumented.new(memory, :instrumenter => ActiveSupport::Notifications) } let(:flipper) { Flipper.new(adapter, :instrumenter => ActiveSupport::Notifications) } let(:user) { user = Struct.new(:flipper_id).new('1') } before do Metriks::Registry.default.clear end context "for enabled feature" do it "updates feature metrics when calls happen" do flipper[:stats].enable(user) expect(Metriks.timer("flipper.feature_operation.enable").count).to be(1) flipper[:stats].enabled?(user) expect(Metriks.timer("flipper.feature_operation.enabled").count).to be(1) expect(Metriks.meter("flipper.feature.stats.enabled").count).to be(1) end end context "for disabled feature" do it "updates feature metrics when calls happen" do flipper[:stats].disable(user) expect(Metriks.timer("flipper.feature_operation.disable").count).to be(1) flipper[:stats].enabled?(user) expect(Metriks.timer("flipper.feature_operation.enabled").count).to be(1) expect(Metriks.meter("flipper.feature.stats.disabled").count).to be(1) end end it "updates adapter metrics when calls happen" do flipper[:stats].enable(user) expect(Metriks.timer("flipper.adapter.memory.enable").count).to be(1) flipper[:stats].enabled?(user) expect(Metriks.timer("flipper.adapter.memory.get").count).to be(1) flipper[:stats].disable(user) expect(Metriks.timer("flipper.adapter.memory.disable").count).to be(1) end end
Version data entries
7 entries across 7 versions & 1 rubygems