Sha256: dc307a124af57f04f9a50a6d139f6eee087fbeef28164ea45d8fcf317a0b805e

Contents?: true

Size: 963 Bytes

Versions: 8

Compression:

Stored size: 963 Bytes

Contents

require 'helper'
require 'flipper/adapters/memory'
require 'flipper/ui/decorators/gate'

describe Flipper::UI::Decorators::Gate do
  let(:source)  { {} }
  let(:adapter) { Flipper::Adapters::Memory.new(source) }
  let(:flipper) { build_flipper }
  let(:feature) { flipper[:some_awesome_feature] }
  let(:gate) { feature.gate(:boolean) }

  subject {
    described_class.new(gate, false)
  }

  describe "#initialize" do
    it "sets gate" do
      subject.gate.should be(gate)
    end

    it "sets value" do
      subject.value.should eq(false)
    end
  end

  describe "#as_json" do
    before do
      @result = subject.as_json
    end

    it "returns Hash" do
      @result.should be_instance_of(Hash)
    end

    it "includes key" do
      @result['key'].should eq('boolean')
    end

    it "includes pretty name" do
      @result['name'].should eq('boolean')
    end

    it "includes value" do
      @result['value'].should be(false)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
flipper-ui-0.7.1 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.7.0 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.7.0.beta6 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.7.0.beta5 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.7.0.beta4 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.2.0.beta5 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.2.0.beta4 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.2.0.beta3 spec/flipper/ui/decorators/gate_spec.rb