Sha256: 2f5f0162aa4f2bab15083e7684baeac6816883c672bc3c97aa6ffadacec88a7c

Contents?: true

Size: 996 Bytes

Versions: 17

Compression:

Stored size: 996 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 do
    described_class.new(gate, false)
  end

  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

17 entries across 17 versions & 1 rubygems

Version Path
flipper-ui-0.15.0 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.14.0 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.13.0 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.13.0.beta1 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.12.2 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.12.1 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.12.0 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.11.0 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.11.0.rc1 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.11.0.beta9 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.11.0.beta8 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.11.0.beta7 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.11.0.beta6 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.11.0.beta5 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.11.0.beta4 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.11.0.beta3 spec/flipper/ui/decorators/gate_spec.rb
flipper-ui-0.11.0.beta1 spec/flipper/ui/decorators/gate_spec.rb