Sha256: b705d0f30dca1e064109b668f7dd1912a6a264fa28749476698e1e2cef6ef679

Contents?: true

Size: 1.51 KB

Versions: 32

Compression:

Stored size: 1.51 KB

Contents

RSpec.describe Flipper::Api::V1::Actions::BooleanGate do
  let(:app) { build_api(flipper) }

  describe 'enable' do
    before do
      flipper[:my_feature].disable
      post '/features/my_feature/boolean'
    end

    it 'enables feature' do
      expect(last_response.status).to eq(200)
      expect(flipper[:my_feature].on?).to be_truthy
    end

    it 'returns decorated feature with boolean gate enabled' do
      boolean_gate = json_response['gates'].find { |gate| gate['key'] == 'boolean' }
      expect(boolean_gate['value']).to be_truthy
    end
  end

  describe 'enable feature with slash in name' do
    before do
      flipper["my/feature"].disable
      post '/features/my/feature/boolean'
    end

    it 'enables feature' do
      expect(last_response.status).to eq(200)
      expect(flipper["my/feature"].on?).to be_truthy
    end

    it 'returns decorated feature with boolean gate enabled' do
      boolean_gate = json_response['gates'].find { |gate| gate['key'] == 'boolean' }
      expect(boolean_gate['value']).to be_truthy
    end
  end

  describe 'disable' do
    before do
      flipper[:my_feature].enable
      delete '/features/my_feature/boolean'
    end

    it 'disables feature' do
      expect(last_response.status).to eq(200)
      expect(flipper[:my_feature].off?).to be_truthy
    end

    it 'returns decorated feature with boolean gate disabled' do
      boolean_gate = json_response['gates'].find { |gate| gate['key'] == 'boolean' }
      expect(boolean_gate['value']).to be_falsy
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
flipper-api-1.3.2 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-1.3.1 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-1.3.0 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-1.3.0.pre spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-1.2.2 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-1.2.1 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-1.2.0 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-1.1.2 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-1.1.1 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-1.1.0 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-1.0.0 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-1.0.0.pre spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-0.28.3 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-0.28.2 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-0.28.1 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-0.28.0 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-0.27.1 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-0.27.0 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-0.26.2 spec/flipper/api/v1/actions/boolean_gate_spec.rb
flipper-api-0.26.1 spec/flipper/api/v1/actions/boolean_gate_spec.rb