Sha256: 7559aa98cba0ee65cda45124e8661f8fb8e1cb6c2c2f0c510c7b1807ed8eae42

Contents?: true

Size: 1.33 KB

Versions: 12

Compression:

Stored size: 1.33 KB

Contents

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

  describe 'clear' do
    before do
      Flipper.register(:admins) {}
      actor22 = Flipper::Actor.new('22')

      feature = flipper[:my_feature]
      feature.enable Flipper::Types::Boolean.new
      feature.enable flipper.group(:admins)
      feature.enable Flipper::Types::Actor.new(actor22)
      feature.enable Flipper::Types::PercentageOfActors.new(25)
      feature.enable Flipper::Types::PercentageOfTime.new(45)

      delete '/features/my_feature/clear'
    end

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

  describe 'clear feature with slash in name' do
    before do
      Flipper.register(:admins) {}
      actor22 = Flipper::Actor.new('22')

      feature = flipper["my/feature"]
      feature.enable Flipper::Types::Boolean.new
      feature.enable flipper.group(:admins)
      feature.enable Flipper::Types::Actor.new(actor22)
      feature.enable Flipper::Types::PercentageOfActors.new(25)
      feature.enable Flipper::Types::PercentageOfTime.new(45)

      delete '/features/my/feature/clear'
    end

    it 'clears feature' do
      expect(last_response.status).to eq(204)
      expect(flipper["my/feature"].off?).to be_truthy
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
flipper-api-1.3.2 spec/flipper/api/v1/actions/clear_feature_spec.rb
flipper-api-1.3.1 spec/flipper/api/v1/actions/clear_feature_spec.rb
flipper-api-1.3.0 spec/flipper/api/v1/actions/clear_feature_spec.rb
flipper-api-1.3.0.pre spec/flipper/api/v1/actions/clear_feature_spec.rb
flipper-api-1.2.2 spec/flipper/api/v1/actions/clear_feature_spec.rb
flipper-api-1.2.1 spec/flipper/api/v1/actions/clear_feature_spec.rb
flipper-api-1.2.0 spec/flipper/api/v1/actions/clear_feature_spec.rb
flipper-api-1.1.2 spec/flipper/api/v1/actions/clear_feature_spec.rb
flipper-api-1.1.1 spec/flipper/api/v1/actions/clear_feature_spec.rb
flipper-api-1.1.0 spec/flipper/api/v1/actions/clear_feature_spec.rb
flipper-api-1.0.0 spec/flipper/api/v1/actions/clear_feature_spec.rb
flipper-api-1.0.0.pre spec/flipper/api/v1/actions/clear_feature_spec.rb