Sha256: bafb2bca6ed0afc5b39519c2695b299258f7469dfd3ddf9173f6c245f7d389c6

Contents?: true

Size: 1021 Bytes

Versions: 25

Compression:

Stored size: 1021 Bytes

Contents

require File.expand_path("../spec_helper", __dir__)

RSpec.describe SearchFlip::NullInstrumenter do
  subject { described_class.new }

  describe "#instrument" do
    it "calls start" do
      allow(subject).to receive(:start)

      subject.instrument("name", { key: "value" }) { true }

      expect(subject).to have_received(:start)
    end

    it "calls finish" do
      allow(subject).to receive(:finish)

      subject.instrument("name", { key: "value" }) { true }

      expect(subject).to have_received(:finish)
    end

    it "yields and passes the payload" do
      yielded_payload = nil

      subject.instrument("name", { key: "value" }) { |payload| yielded_payload = payload }

      expect(yielded_payload).to eq(key: "value")
    end
  end

  describe "#start" do
    it "returns true" do
      expect(subject.start("name", { key: "value" })).to eq(true)
    end
  end

  describe "#finish" do
    it "returns true" do
      expect(subject.finish("name", { key: "value" })).to eq(true)
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
search_flip-4.0.0.beta5 spec/search_flip/null_instrumenter_spec.rb
search_flip-4.0.0.beta4 spec/search_flip/null_instrumenter_spec.rb
search_flip-3.2.1 spec/search_flip/null_instrumenter_spec.rb
search_flip-3.2.0 spec/search_flip/null_instrumenter_spec.rb
search_flip-4.0.0.beta3 spec/search_flip/null_instrumenter_spec.rb