Sha256: f6e83e7e5d91bf7ce77c000d7fa59195f50284e4c1addd42ae6a346f36f09ef1

Contents?: true

Size: 901 Bytes

Versions: 5

Compression:

Stored size: 901 Bytes

Contents

require 'helper'

describe Flipper::Gate do
  let(:feature_name) { :stats }

  subject {
    described_class.new(feature_name)
  }

  describe "#initialize" do
    it "sets feature_name" do
      gate = described_class.new(feature_name)
      gate.feature_name.should be(feature_name)
    end

    it "defaults instrumenter" do
      gate = described_class.new(feature_name)
      gate.instrumenter.should be(Flipper::Instrumenters::Noop)
    end

    it "allows overriding instrumenter" do
      instrumenter = double('Instrumentor')
      gate = described_class.new(feature_name, :instrumenter => instrumenter)
      gate.instrumenter.should be(instrumenter)
    end
  end

  describe "#inspect" do
    it "returns easy to read string representation" do
      string = subject.inspect
      string.should include('Flipper::Gate')
      string.should include('feature_name=:stats')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
flipper-0.6.3 spec/flipper/gate_spec.rb
flipper-0.6.2 spec/flipper/gate_spec.rb
flipper-0.6.1 spec/flipper/gate_spec.rb
flipper-0.6.0 spec/flipper/gate_spec.rb
flipper-0.5.0 spec/flipper/gate_spec.rb