Sha256: 961fdfe6b9d76143a6a57e7093ca7c775c03dd466805f95ca6d6bae8fe78249d

Contents?: true

Size: 993 Bytes

Versions: 12

Compression:

Stored size: 993 Bytes

Contents

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

RSpec.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
      expect(subject.gate).to be(gate)
    end

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

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

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

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

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

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
flipper-ui-0.10.2 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.10.1 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.10.0 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.9.2 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.9.1 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.9.0 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.9.0.beta1 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.8.0 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.7.5 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.7.4 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.7.3 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.7.2 spec/flipper/ui/decorators/gate_spec.rb