flipper 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +4 -0
- data/Gemfile +1 -1
- data/docs/Adapters.md +2 -1
- data/examples/enabled_for_actor.rb +43 -0
- data/lib/flipper/spec/shared_adapter_specs.rb +71 -71
- data/lib/flipper/version.rb +1 -1
- data/spec/flipper/adapters/instrumented_spec.rb +44 -44
- data/spec/flipper/adapters/memoizable_spec.rb +21 -21
- data/spec/flipper/adapters/memory_spec.rb +1 -1
- data/spec/flipper/adapters/operation_logger_spec.rb +11 -11
- data/spec/flipper/adapters/pstore_spec.rb +2 -2
- data/spec/flipper/dsl_spec.rb +34 -34
- data/spec/flipper/feature_spec.rb +167 -167
- data/spec/flipper/gate_spec.rb +5 -5
- data/spec/flipper/gate_values_spec.rb +17 -17
- data/spec/flipper/gates/actor_spec.rb +1 -1
- data/spec/flipper/gates/boolean_spec.rb +13 -13
- data/spec/flipper/gates/group_spec.rb +6 -6
- data/spec/flipper/gates/percentage_of_actors_spec.rb +3 -3
- data/spec/flipper/gates/percentage_of_time_spec.rb +1 -1
- data/spec/flipper/instrumentation/log_subscriber_spec.rb +10 -10
- data/spec/flipper/instrumentation/metriks_subscriber_spec.rb +14 -14
- data/spec/flipper/instrumentation/statsd_subscriber_spec.rb +5 -3
- data/spec/flipper/instrumenters/memory_spec.rb +4 -4
- data/spec/flipper/instrumenters/noop_spec.rb +3 -3
- data/spec/flipper/middleware/memoizer_spec.rb +8 -8
- data/spec/flipper/registry_spec.rb +17 -17
- data/spec/flipper/typecast_spec.rb +4 -4
- data/spec/flipper/types/actor_spec.rb +14 -14
- data/spec/flipper/types/boolean_spec.rb +5 -5
- data/spec/flipper/types/group_spec.rb +8 -8
- data/spec/flipper/types/percentage_of_actors_spec.rb +1 -1
- data/spec/flipper/types/percentage_of_time_spec.rb +1 -1
- data/spec/flipper/types/percentage_spec.rb +8 -8
- data/spec/flipper_spec.rb +19 -19
- data/spec/helper.rb +14 -14
- data/spec/integration_spec.rb +80 -80
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ead277793aee2dece9038ca1cdd59ac0607a5cc4
|
4
|
+
data.tar.gz: c10127accd784df6b64e54442568e29bd4ddadde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11dea621bb4989d05bf945de1c006e81029259e1996690aecc9327a879877f73d81813cb12c0f0afd47ecf53a93e6dfc235c6f370c9be0a149d0077f5ecf63c0
|
7
|
+
data.tar.gz: 55d930c0fb9031ed9470311805b613e831d610c70d0664338fa0a0e9f008785fa82302380f4dd0dbc3a37d8e019128343769faf5d8d20c4adbb3459370f6f04a
|
data/Changelog.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 0.7.2
|
2
|
+
|
3
|
+
* Add Flipper::UI.application_breadcrumb_href for setting breadcrumb back to original app from Flipper UI
|
4
|
+
|
1
5
|
## 0.7.1
|
2
6
|
|
3
7
|
* Fix bug where features with names that match static file routes were incorrectly routing to the file action (https://github.com/jnunemaker/flipper/issues/80)
|
data/Gemfile
CHANGED
data/docs/Adapters.md
CHANGED
@@ -8,7 +8,8 @@ I plan on supporting the adapters in the flipper repo. Other adapters are welcom
|
|
8
8
|
* [Redis adapter](https://github.com/jnunemaker/flipper/blob/master/docs/redis)
|
9
9
|
* [Cassanity adapter](https://github.com/jnunemaker/flipper-cassanity)
|
10
10
|
* [Active Record 4 adapter](https://github.com/bgentry/flipper-activerecord)
|
11
|
-
* [Active Record 3 adapter](https://github.com/
|
11
|
+
* [Active Record 3 adapter](https://github.com/blueboxjesse/flipper-activerecord)
|
12
|
+
* [Consul adapter](https://github.com/gdavison/flipper-consul)
|
12
13
|
|
13
14
|
The basic API for an adapter is this:
|
14
15
|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.expand_path('../example_setup', __FILE__)
|
2
|
+
|
3
|
+
require 'flipper'
|
4
|
+
require 'flipper/adapters/memory'
|
5
|
+
|
6
|
+
# Some class that represents what will be trying to do something
|
7
|
+
class User
|
8
|
+
attr_reader :id
|
9
|
+
|
10
|
+
def initialize(id, admin)
|
11
|
+
@id = id
|
12
|
+
@admin = admin
|
13
|
+
end
|
14
|
+
|
15
|
+
def admin?
|
16
|
+
@admin
|
17
|
+
end
|
18
|
+
|
19
|
+
# Must respond to flipper_id
|
20
|
+
alias_method :flipper_id, :id
|
21
|
+
end
|
22
|
+
|
23
|
+
user1 = User.new(1, true)
|
24
|
+
user2 = User.new(2, false)
|
25
|
+
|
26
|
+
# pick an adapter
|
27
|
+
adapter = Flipper::Adapters::Memory.new
|
28
|
+
|
29
|
+
# get a handy dsl instance
|
30
|
+
flipper = Flipper.new(adapter)
|
31
|
+
|
32
|
+
Flipper.register :admins do |actor|
|
33
|
+
actor.admin?
|
34
|
+
end
|
35
|
+
|
36
|
+
flipper[:search].enable
|
37
|
+
flipper[:stats].enable_actor user1
|
38
|
+
flipper[:pro_stats].enable_percentage_of_actors 50
|
39
|
+
flipper[:tweets].enable_group :admins
|
40
|
+
flipper[:posts].enable_actor user2
|
41
|
+
|
42
|
+
pp flipper.features.select { |feature| feature.enabled?(user1) }.map(&:name)
|
43
|
+
pp flipper.features.select { |feature| feature.enabled?(user2) }.map(&:name)
|
@@ -27,16 +27,16 @@ shared_examples_for 'a flipper adapter' do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "has name that is a symbol" do
|
30
|
-
subject.name.
|
31
|
-
subject.name.
|
30
|
+
expect(subject.name).to_not be_nil
|
31
|
+
expect(subject.name).to be_instance_of(Symbol)
|
32
32
|
end
|
33
33
|
|
34
34
|
it "has included the flipper adapter module" do
|
35
|
-
subject.class.ancestors.
|
35
|
+
expect(subject.class.ancestors).to include(Flipper::Adapter)
|
36
36
|
end
|
37
37
|
|
38
38
|
it "returns correct default values for the gates if none are enabled" do
|
39
|
-
subject.get(feature).
|
39
|
+
expect(subject.get(feature)).to eq({
|
40
40
|
:boolean => nil,
|
41
41
|
:groups => Set.new,
|
42
42
|
:actors => Set.new,
|
@@ -46,28 +46,28 @@ shared_examples_for 'a flipper adapter' do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
it "can enable, disable and get value for boolean gate" do
|
49
|
-
subject.enable(feature, boolean_gate, flipper.boolean).
|
49
|
+
expect(subject.enable(feature, boolean_gate, flipper.boolean)).to eq(true)
|
50
50
|
|
51
51
|
result = subject.get(feature)
|
52
|
-
result[:boolean].
|
52
|
+
expect(result[:boolean]).to eq('true')
|
53
53
|
|
54
|
-
subject.disable(feature, boolean_gate, flipper.boolean(false)).
|
54
|
+
expect(subject.disable(feature, boolean_gate, flipper.boolean(false))).to eq(true)
|
55
55
|
|
56
56
|
result = subject.get(feature)
|
57
|
-
result[:boolean].
|
57
|
+
expect(result[:boolean]).to eq(nil)
|
58
58
|
end
|
59
59
|
|
60
60
|
it "fully disables all enabled things when boolean gate disabled" do
|
61
61
|
actor_22 = actor_class.new('22')
|
62
|
-
subject.enable(feature, boolean_gate, flipper.boolean).
|
63
|
-
subject.enable(feature, group_gate, flipper.group(:admins)).
|
64
|
-
subject.enable(feature, actor_gate, flipper.actor(actor_22)).
|
65
|
-
subject.enable(feature, actors_gate, flipper.actors(25)).
|
66
|
-
subject.enable(feature, time_gate, flipper.time(45)).
|
62
|
+
expect(subject.enable(feature, boolean_gate, flipper.boolean)).to eq(true)
|
63
|
+
expect(subject.enable(feature, group_gate, flipper.group(:admins))).to eq(true)
|
64
|
+
expect(subject.enable(feature, actor_gate, flipper.actor(actor_22))).to eq(true)
|
65
|
+
expect(subject.enable(feature, actors_gate, flipper.actors(25))).to eq(true)
|
66
|
+
expect(subject.enable(feature, time_gate, flipper.time(45))).to eq(true)
|
67
67
|
|
68
|
-
subject.disable(feature, boolean_gate, flipper.boolean).
|
68
|
+
expect(subject.disable(feature, boolean_gate, flipper.boolean)).to eq(true)
|
69
69
|
|
70
|
-
subject.get(feature).
|
70
|
+
expect(subject.get(feature)).to eq({
|
71
71
|
:boolean => nil,
|
72
72
|
:groups => Set.new,
|
73
73
|
:actors => Set.new,
|
@@ -77,117 +77,117 @@ shared_examples_for 'a flipper adapter' do
|
|
77
77
|
end
|
78
78
|
|
79
79
|
it "can enable, disable and get value for group gate" do
|
80
|
-
subject.enable(feature, group_gate, flipper.group(:admins)).
|
81
|
-
subject.enable(feature, group_gate, flipper.group(:early_access)).
|
80
|
+
expect(subject.enable(feature, group_gate, flipper.group(:admins))).to eq(true)
|
81
|
+
expect(subject.enable(feature, group_gate, flipper.group(:early_access))).to eq(true)
|
82
82
|
|
83
83
|
result = subject.get(feature)
|
84
|
-
result[:groups].
|
84
|
+
expect(result[:groups]).to eq(Set['admins', 'early_access'])
|
85
85
|
|
86
|
-
subject.disable(feature, group_gate, flipper.group(:early_access)).
|
86
|
+
expect(subject.disable(feature, group_gate, flipper.group(:early_access))).to eq(true)
|
87
87
|
result = subject.get(feature)
|
88
|
-
result[:groups].
|
88
|
+
expect(result[:groups]).to eq(Set['admins'])
|
89
89
|
|
90
|
-
subject.disable(feature, group_gate, flipper.group(:admins)).
|
90
|
+
expect(subject.disable(feature, group_gate, flipper.group(:admins))).to eq(true)
|
91
91
|
result = subject.get(feature)
|
92
|
-
result[:groups].
|
92
|
+
expect(result[:groups]).to eq(Set.new)
|
93
93
|
end
|
94
94
|
|
95
95
|
it "can enable, disable and get value for actor gate" do
|
96
96
|
actor_22 = actor_class.new('22')
|
97
97
|
actor_asdf = actor_class.new('asdf')
|
98
98
|
|
99
|
-
subject.enable(feature, actor_gate, flipper.actor(actor_22)).
|
100
|
-
subject.enable(feature, actor_gate, flipper.actor(actor_asdf)).
|
99
|
+
expect(subject.enable(feature, actor_gate, flipper.actor(actor_22))).to eq(true)
|
100
|
+
expect(subject.enable(feature, actor_gate, flipper.actor(actor_asdf))).to eq(true)
|
101
101
|
|
102
102
|
result = subject.get(feature)
|
103
|
-
result[:actors].
|
103
|
+
expect(result[:actors]).to eq(Set['22', 'asdf'])
|
104
104
|
|
105
|
-
subject.disable(feature, actor_gate, flipper.actor(actor_22)).
|
105
|
+
expect(subject.disable(feature, actor_gate, flipper.actor(actor_22))).to eq(true)
|
106
106
|
result = subject.get(feature)
|
107
|
-
result[:actors].
|
107
|
+
expect(result[:actors]).to eq(Set['asdf'])
|
108
108
|
|
109
|
-
subject.disable(feature, actor_gate, flipper.actor(actor_asdf)).
|
109
|
+
expect(subject.disable(feature, actor_gate, flipper.actor(actor_asdf))).to eq(true)
|
110
110
|
result = subject.get(feature)
|
111
|
-
result[:actors].
|
111
|
+
expect(result[:actors]).to eq(Set.new)
|
112
112
|
end
|
113
113
|
|
114
114
|
it "can enable, disable and get value for percentage of actors gate" do
|
115
|
-
subject.enable(feature, actors_gate, flipper.actors(15)).
|
115
|
+
expect(subject.enable(feature, actors_gate, flipper.actors(15))).to eq(true)
|
116
116
|
result = subject.get(feature)
|
117
|
-
result[:percentage_of_actors].
|
117
|
+
expect(result[:percentage_of_actors]).to eq('15')
|
118
118
|
|
119
|
-
subject.disable(feature, actors_gate, flipper.actors(0)).
|
119
|
+
expect(subject.disable(feature, actors_gate, flipper.actors(0))).to eq(true)
|
120
120
|
result = subject.get(feature)
|
121
|
-
result[:percentage_of_actors].
|
121
|
+
expect(result[:percentage_of_actors]).to eq('0')
|
122
122
|
end
|
123
123
|
|
124
124
|
it "can enable, disable and get value for percentage of time gate" do
|
125
|
-
subject.enable(feature, time_gate, flipper.time(10)).
|
125
|
+
expect(subject.enable(feature, time_gate, flipper.time(10))).to eq(true)
|
126
126
|
result = subject.get(feature)
|
127
|
-
result[:percentage_of_time].
|
127
|
+
expect(result[:percentage_of_time]).to eq('10')
|
128
128
|
|
129
|
-
subject.disable(feature, time_gate, flipper.time(0)).
|
129
|
+
expect(subject.disable(feature, time_gate, flipper.time(0))).to eq(true)
|
130
130
|
result = subject.get(feature)
|
131
|
-
result[:percentage_of_time].
|
131
|
+
expect(result[:percentage_of_time]).to eq('0')
|
132
132
|
end
|
133
133
|
|
134
134
|
it "converts boolean value to a string" do
|
135
|
-
subject.enable(feature, boolean_gate, flipper.boolean).
|
135
|
+
expect(subject.enable(feature, boolean_gate, flipper.boolean)).to eq(true)
|
136
136
|
result = subject.get(feature)
|
137
|
-
result[:boolean].
|
137
|
+
expect(result[:boolean]).to eq('true')
|
138
138
|
end
|
139
139
|
|
140
140
|
it "converts the actor value to a string" do
|
141
|
-
subject.enable(feature, actor_gate, flipper.actor(actor_class.new(22))).
|
141
|
+
expect(subject.enable(feature, actor_gate, flipper.actor(actor_class.new(22)))).to eq(true)
|
142
142
|
result = subject.get(feature)
|
143
|
-
result[:actors].
|
143
|
+
expect(result[:actors]).to eq(Set['22'])
|
144
144
|
end
|
145
145
|
|
146
146
|
it "converts group value to a string" do
|
147
|
-
subject.enable(feature, group_gate, flipper.group(:admins)).
|
147
|
+
expect(subject.enable(feature, group_gate, flipper.group(:admins))).to eq(true)
|
148
148
|
result = subject.get(feature)
|
149
|
-
result[:groups].
|
149
|
+
expect(result[:groups]).to eq(Set['admins'])
|
150
150
|
end
|
151
151
|
|
152
152
|
it "converts percentage of time integer value to a string" do
|
153
|
-
subject.enable(feature, time_gate, flipper.time(10)).
|
153
|
+
expect(subject.enable(feature, time_gate, flipper.time(10))).to eq(true)
|
154
154
|
result = subject.get(feature)
|
155
|
-
result[:percentage_of_time].
|
155
|
+
expect(result[:percentage_of_time]).to eq('10')
|
156
156
|
end
|
157
157
|
|
158
158
|
it "converts percentage of actors integer value to a string" do
|
159
|
-
subject.enable(feature, actors_gate, flipper.actors(10)).
|
159
|
+
expect(subject.enable(feature, actors_gate, flipper.actors(10))).to eq(true)
|
160
160
|
result = subject.get(feature)
|
161
|
-
result[:percentage_of_actors].
|
161
|
+
expect(result[:percentage_of_actors]).to eq('10')
|
162
162
|
end
|
163
163
|
|
164
164
|
it "can add, remove and list known features" do
|
165
|
-
subject.features.
|
165
|
+
expect(subject.features).to eq(Set.new)
|
166
166
|
|
167
|
-
subject.add(flipper[:stats]).
|
168
|
-
subject.features.
|
167
|
+
expect(subject.add(flipper[:stats])).to eq(true)
|
168
|
+
expect(subject.features).to eq(Set['stats'])
|
169
169
|
|
170
|
-
subject.add(flipper[:search]).
|
171
|
-
subject.features.
|
170
|
+
expect(subject.add(flipper[:search])).to eq(true)
|
171
|
+
expect(subject.features).to eq(Set['stats', 'search'])
|
172
172
|
|
173
|
-
subject.remove(flipper[:stats]).
|
174
|
-
subject.features.
|
173
|
+
expect(subject.remove(flipper[:stats])).to eq(true)
|
174
|
+
expect(subject.features).to eq(Set['search'])
|
175
175
|
|
176
|
-
subject.remove(flipper[:search]).
|
177
|
-
subject.features.
|
176
|
+
expect(subject.remove(flipper[:search])).to eq(true)
|
177
|
+
expect(subject.features).to eq(Set.new)
|
178
178
|
end
|
179
179
|
|
180
180
|
it "clears all the gate values for the feature on remove" do
|
181
181
|
actor_22 = actor_class.new('22')
|
182
|
-
subject.enable(feature, boolean_gate, flipper.boolean).
|
183
|
-
subject.enable(feature, group_gate, flipper.group(:admins)).
|
184
|
-
subject.enable(feature, actor_gate, flipper.actor(actor_22)).
|
185
|
-
subject.enable(feature, actors_gate, flipper.actors(25)).
|
186
|
-
subject.enable(feature, time_gate, flipper.time(45)).
|
182
|
+
expect(subject.enable(feature, boolean_gate, flipper.boolean)).to eq(true)
|
183
|
+
expect(subject.enable(feature, group_gate, flipper.group(:admins))).to eq(true)
|
184
|
+
expect(subject.enable(feature, actor_gate, flipper.actor(actor_22))).to eq(true)
|
185
|
+
expect(subject.enable(feature, actors_gate, flipper.actors(25))).to eq(true)
|
186
|
+
expect(subject.enable(feature, time_gate, flipper.time(45))).to eq(true)
|
187
187
|
|
188
|
-
subject.remove(feature).
|
188
|
+
expect(subject.remove(feature)).to eq(true)
|
189
189
|
|
190
|
-
subject.get(feature).
|
190
|
+
expect(subject.get(feature)).to eq({
|
191
191
|
:boolean => nil,
|
192
192
|
:groups => Set.new,
|
193
193
|
:actors => Set.new,
|
@@ -198,15 +198,15 @@ shared_examples_for 'a flipper adapter' do
|
|
198
198
|
|
199
199
|
it "can clear all the gate values for a feature" do
|
200
200
|
actor_22 = actor_class.new('22')
|
201
|
-
subject.enable(feature, boolean_gate, flipper.boolean).
|
202
|
-
subject.enable(feature, group_gate, flipper.group(:admins)).
|
203
|
-
subject.enable(feature, actor_gate, flipper.actor(actor_22)).
|
204
|
-
subject.enable(feature, actors_gate, flipper.actors(25)).
|
205
|
-
subject.enable(feature, time_gate, flipper.time(45)).
|
201
|
+
expect(subject.enable(feature, boolean_gate, flipper.boolean)).to eq(true)
|
202
|
+
expect(subject.enable(feature, group_gate, flipper.group(:admins))).to eq(true)
|
203
|
+
expect(subject.enable(feature, actor_gate, flipper.actor(actor_22))).to eq(true)
|
204
|
+
expect(subject.enable(feature, actors_gate, flipper.actors(25))).to eq(true)
|
205
|
+
expect(subject.enable(feature, time_gate, flipper.time(45))).to eq(true)
|
206
206
|
|
207
|
-
subject.clear(feature).
|
207
|
+
expect(subject.clear(feature)).to eq(true)
|
208
208
|
|
209
|
-
subject.get(feature).
|
209
|
+
expect(subject.get(feature)).to eq({
|
210
210
|
:boolean => nil,
|
211
211
|
:groups => Set.new,
|
212
212
|
:actors => Set.new,
|
@@ -216,6 +216,6 @@ shared_examples_for 'a flipper adapter' do
|
|
216
216
|
end
|
217
217
|
|
218
218
|
it "does not complain clearing a feature that does not exist in adapter" do
|
219
|
-
subject.clear(flipper[:stats]).
|
219
|
+
expect(subject.clear(flipper[:stats])).to eq(true)
|
220
220
|
end
|
221
221
|
end
|
data/lib/flipper/version.rb
CHANGED
@@ -4,7 +4,7 @@ require 'flipper/adapters/instrumented'
|
|
4
4
|
require 'flipper/instrumenters/memory'
|
5
5
|
require 'flipper/spec/shared_adapter_specs'
|
6
6
|
|
7
|
-
describe Flipper::Adapters::Instrumented do
|
7
|
+
RSpec.describe Flipper::Adapters::Instrumented do
|
8
8
|
let(:instrumenter) { Flipper::Instrumenters::Memory.new }
|
9
9
|
let(:adapter) { Flipper::Adapters::Memory.new }
|
10
10
|
let(:flipper) { Flipper.new(adapter) }
|
@@ -24,12 +24,12 @@ describe Flipper::Adapters::Instrumented do
|
|
24
24
|
result = subject.get(feature)
|
25
25
|
|
26
26
|
event = instrumenter.events.last
|
27
|
-
event.
|
28
|
-
event.name.
|
29
|
-
event.payload[:operation].
|
30
|
-
event.payload[:adapter_name].
|
31
|
-
event.payload[:feature_name].
|
32
|
-
event.payload[:result].
|
27
|
+
expect(event).not_to be_nil
|
28
|
+
expect(event.name).to eq('adapter_operation.flipper')
|
29
|
+
expect(event.payload[:operation]).to eq(:get)
|
30
|
+
expect(event.payload[:adapter_name]).to eq(:memory)
|
31
|
+
expect(event.payload[:feature_name]).to eq(:stats)
|
32
|
+
expect(event.payload[:result]).to be(result)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -38,13 +38,13 @@ describe Flipper::Adapters::Instrumented do
|
|
38
38
|
result = subject.enable(feature, gate, thing)
|
39
39
|
|
40
40
|
event = instrumenter.events.last
|
41
|
-
event.
|
42
|
-
event.name.
|
43
|
-
event.payload[:operation].
|
44
|
-
event.payload[:adapter_name].
|
45
|
-
event.payload[:feature_name].
|
46
|
-
event.payload[:gate_name].
|
47
|
-
event.payload[:result].
|
41
|
+
expect(event).not_to be_nil
|
42
|
+
expect(event.name).to eq('adapter_operation.flipper')
|
43
|
+
expect(event.payload[:operation]).to eq(:enable)
|
44
|
+
expect(event.payload[:adapter_name]).to eq(:memory)
|
45
|
+
expect(event.payload[:feature_name]).to eq(:stats)
|
46
|
+
expect(event.payload[:gate_name]).to eq(:percentage_of_actors)
|
47
|
+
expect(event.payload[:result]).to be(result)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -53,13 +53,13 @@ describe Flipper::Adapters::Instrumented do
|
|
53
53
|
result = subject.disable(feature, gate, thing)
|
54
54
|
|
55
55
|
event = instrumenter.events.last
|
56
|
-
event.
|
57
|
-
event.name.
|
58
|
-
event.payload[:operation].
|
59
|
-
event.payload[:adapter_name].
|
60
|
-
event.payload[:feature_name].
|
61
|
-
event.payload[:gate_name].
|
62
|
-
event.payload[:result].
|
56
|
+
expect(event).not_to be_nil
|
57
|
+
expect(event.name).to eq('adapter_operation.flipper')
|
58
|
+
expect(event.payload[:operation]).to eq(:disable)
|
59
|
+
expect(event.payload[:adapter_name]).to eq(:memory)
|
60
|
+
expect(event.payload[:feature_name]).to eq(:stats)
|
61
|
+
expect(event.payload[:gate_name]).to eq(:percentage_of_actors)
|
62
|
+
expect(event.payload[:result]).to be(result)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -68,12 +68,12 @@ describe Flipper::Adapters::Instrumented do
|
|
68
68
|
result = subject.add(feature)
|
69
69
|
|
70
70
|
event = instrumenter.events.last
|
71
|
-
event.
|
72
|
-
event.name.
|
73
|
-
event.payload[:operation].
|
74
|
-
event.payload[:adapter_name].
|
75
|
-
event.payload[:feature_name].
|
76
|
-
event.payload[:result].
|
71
|
+
expect(event).not_to be_nil
|
72
|
+
expect(event.name).to eq('adapter_operation.flipper')
|
73
|
+
expect(event.payload[:operation]).to eq(:add)
|
74
|
+
expect(event.payload[:adapter_name]).to eq(:memory)
|
75
|
+
expect(event.payload[:feature_name]).to eq(:stats)
|
76
|
+
expect(event.payload[:result]).to be(result)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -82,12 +82,12 @@ describe Flipper::Adapters::Instrumented do
|
|
82
82
|
result = subject.remove(feature)
|
83
83
|
|
84
84
|
event = instrumenter.events.last
|
85
|
-
event.
|
86
|
-
event.name.
|
87
|
-
event.payload[:operation].
|
88
|
-
event.payload[:adapter_name].
|
89
|
-
event.payload[:feature_name].
|
90
|
-
event.payload[:result].
|
85
|
+
expect(event).not_to be_nil
|
86
|
+
expect(event.name).to eq('adapter_operation.flipper')
|
87
|
+
expect(event.payload[:operation]).to eq(:remove)
|
88
|
+
expect(event.payload[:adapter_name]).to eq(:memory)
|
89
|
+
expect(event.payload[:feature_name]).to eq(:stats)
|
90
|
+
expect(event.payload[:result]).to be(result)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -96,12 +96,12 @@ describe Flipper::Adapters::Instrumented do
|
|
96
96
|
result = subject.clear(feature)
|
97
97
|
|
98
98
|
event = instrumenter.events.last
|
99
|
-
event.
|
100
|
-
event.name.
|
101
|
-
event.payload[:operation].
|
102
|
-
event.payload[:adapter_name].
|
103
|
-
event.payload[:feature_name].
|
104
|
-
event.payload[:result].
|
99
|
+
expect(event).not_to be_nil
|
100
|
+
expect(event.name).to eq('adapter_operation.flipper')
|
101
|
+
expect(event.payload[:operation]).to eq(:clear)
|
102
|
+
expect(event.payload[:adapter_name]).to eq(:memory)
|
103
|
+
expect(event.payload[:feature_name]).to eq(:stats)
|
104
|
+
expect(event.payload[:result]).to be(result)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -110,11 +110,11 @@ describe Flipper::Adapters::Instrumented do
|
|
110
110
|
result = subject.features
|
111
111
|
|
112
112
|
event = instrumenter.events.last
|
113
|
-
event.
|
114
|
-
event.name.
|
115
|
-
event.payload[:operation].
|
116
|
-
event.payload[:adapter_name].
|
117
|
-
event.payload[:result].
|
113
|
+
expect(event).not_to be_nil
|
114
|
+
expect(event.name).to eq('adapter_operation.flipper')
|
115
|
+
expect(event.payload[:operation]).to eq(:features)
|
116
|
+
expect(event.payload[:adapter_name]).to eq(:memory)
|
117
|
+
expect(event.payload[:result]).to be(result)
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|