File: clear_feature_spec.rb

package info (click to toggle)
ruby-flipper 0.26.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,288 kB
  • sloc: ruby: 16,377; sh: 61; javascript: 24; makefile: 14
file content (45 lines) | stat: -rw-r--r-- 1,218 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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.boolean
      feature.enable flipper.group(:admins)
      feature.enable flipper.actor(actor22)
      feature.enable flipper.actors(25)
      feature.enable flipper.time(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.boolean
      feature.enable flipper.group(:admins)
      feature.enable flipper.actor(actor22)
      feature.enable flipper.actors(25)
      feature.enable flipper.time(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