rollout 2.1.0 → 2.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.circleci/config.yml +80 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +11 -0
- data/.travis.yml +13 -3
- data/Gemfile +3 -1
- data/Gemfile.lock +52 -27
- data/README.md +193 -0
- data/Rakefile +7 -0
- data/lib/rollout/version.rb +3 -1
- data/lib/rollout.rb +166 -72
- data/rollout.gemspec +26 -22
- data/spec/rollout_spec.rb +465 -95
- data/spec/spec_helper.rb +17 -7
- metadata +50 -39
- data/.document +0 -5
- data/README.rdoc +0 -130
- data/lib/rollout/legacy.rb +0 -134
- data/misc/check_rollout.rb +0 -16
- data/spec/legacy_spec.rb +0 -221
- /data/{spec/spec.opts → .rspec} +0 -0
data/spec/legacy_spec.rb
DELETED
@@ -1,221 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "Rollout::Legacy" do
|
4
|
-
before do
|
5
|
-
@redis = Redis.new
|
6
|
-
@rollout = Rollout::Legacy.new(@redis)
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "when a group is activated" do
|
10
|
-
before do
|
11
|
-
@rollout.define_group(:fivesonly) { |user| user.id == 5 }
|
12
|
-
@rollout.activate_group(:chat, :fivesonly)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "the feature is active for users for which the block evaluates to true" do
|
16
|
-
@rollout.should be_active(:chat, stub(:id => 5))
|
17
|
-
end
|
18
|
-
|
19
|
-
it "is not active for users for which the block evaluates to false" do
|
20
|
-
@rollout.should_not be_active(:chat, stub(:id => 1))
|
21
|
-
end
|
22
|
-
|
23
|
-
it "is not active if a group is found in Redis but not defined in Rollout" do
|
24
|
-
@rollout.activate_group(:chat, :fake)
|
25
|
-
@rollout.should_not be_active(:chat, stub(:id => 1))
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "the default all group" do
|
30
|
-
before do
|
31
|
-
@rollout.activate_group(:chat, :all)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "evaluates to true no matter what" do
|
35
|
-
@rollout.should be_active(:chat, stub(:id => 0))
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "deactivating a group" do
|
40
|
-
before do
|
41
|
-
@rollout.define_group(:fivesonly) { |user| user.id == 5 }
|
42
|
-
@rollout.activate_group(:chat, :all)
|
43
|
-
@rollout.activate_group(:chat, :fivesonly)
|
44
|
-
@rollout.deactivate_group(:chat, :all)
|
45
|
-
end
|
46
|
-
|
47
|
-
it "deactivates the rules for that group" do
|
48
|
-
@rollout.should_not be_active(:chat, stub(:id => 10))
|
49
|
-
end
|
50
|
-
|
51
|
-
it "leaves the other groups active" do
|
52
|
-
@rollout.should be_active(:chat, stub(:id => 5))
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe "deactivating a feature completely" do
|
57
|
-
before do
|
58
|
-
@rollout.define_group(:fivesonly) { |user| user.id == 5 }
|
59
|
-
@rollout.activate_group(:chat, :all)
|
60
|
-
@rollout.activate_group(:chat, :fivesonly)
|
61
|
-
@rollout.activate_user(:chat, stub(:id => 51))
|
62
|
-
@rollout.activate_percentage(:chat, 100)
|
63
|
-
@rollout.activate_globally(:chat)
|
64
|
-
@rollout.deactivate_all(:chat)
|
65
|
-
end
|
66
|
-
|
67
|
-
it "removes all of the groups" do
|
68
|
-
@rollout.should_not be_active(:chat, stub(:id => 0))
|
69
|
-
end
|
70
|
-
|
71
|
-
it "removes all of the users" do
|
72
|
-
@rollout.should_not be_active(:chat, stub(:id => 51))
|
73
|
-
end
|
74
|
-
|
75
|
-
it "removes the percentage" do
|
76
|
-
@rollout.should_not be_active(:chat, stub(:id => 24))
|
77
|
-
end
|
78
|
-
|
79
|
-
it "removes globally" do
|
80
|
-
@rollout.should_not be_active(:chat)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe "activating a specific user" do
|
85
|
-
before do
|
86
|
-
@rollout.activate_user(:chat, stub(:id => 42))
|
87
|
-
end
|
88
|
-
|
89
|
-
it "is active for that user" do
|
90
|
-
@rollout.should be_active(:chat, stub(:id => 42))
|
91
|
-
end
|
92
|
-
|
93
|
-
it "remains inactive for other users" do
|
94
|
-
@rollout.should_not be_active(:chat, stub(:id => 24))
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
describe "deactivating a specific user" do
|
99
|
-
before do
|
100
|
-
@rollout.activate_user(:chat, stub(:id => 42))
|
101
|
-
@rollout.activate_user(:chat, stub(:id => 24))
|
102
|
-
@rollout.deactivate_user(:chat, stub(:id => 42))
|
103
|
-
end
|
104
|
-
|
105
|
-
it "that user should no longer be active" do
|
106
|
-
@rollout.should_not be_active(:chat, stub(:id => 42))
|
107
|
-
end
|
108
|
-
|
109
|
-
it "remains active for other active users" do
|
110
|
-
@rollout.should be_active(:chat, stub(:id => 24))
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe "activating a feature globally" do
|
115
|
-
before do
|
116
|
-
@rollout.activate_globally(:chat)
|
117
|
-
end
|
118
|
-
|
119
|
-
it "activates the feature" do
|
120
|
-
@rollout.should be_active(:chat)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
describe "activating a feature for a percentage of users" do
|
125
|
-
before do
|
126
|
-
@rollout.activate_percentage(:chat, 20)
|
127
|
-
end
|
128
|
-
|
129
|
-
it "activates the feature for that percentage of the users" do
|
130
|
-
(1..120).select { |id| @rollout.active?(:chat, stub(:id => id)) }.length.should == 39
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe "activating a feature for a percentage of users" do
|
135
|
-
before do
|
136
|
-
@rollout.activate_percentage(:chat, 20)
|
137
|
-
end
|
138
|
-
|
139
|
-
it "activates the feature for that percentage of the users" do
|
140
|
-
(1..200).select { |id| @rollout.active?(:chat, stub(:id => id)) }.length.should == 40
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
describe "activating a feature for a percentage of users" do
|
145
|
-
before do
|
146
|
-
@rollout.activate_percentage(:chat, 5)
|
147
|
-
end
|
148
|
-
|
149
|
-
it "activates the feature for that percentage of the users" do
|
150
|
-
(1..100).select { |id| @rollout.active?(:chat, stub(:id => id)) }.length.should == 5
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
|
155
|
-
describe "deactivating the percentage of users" do
|
156
|
-
before do
|
157
|
-
@rollout.activate_percentage(:chat, 100)
|
158
|
-
@rollout.deactivate_percentage(:chat)
|
159
|
-
end
|
160
|
-
|
161
|
-
it "becomes inactivate for all users" do
|
162
|
-
@rollout.should_not be_active(:chat, stub(:id => 24))
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
describe "deactivating the feature globally" do
|
167
|
-
before do
|
168
|
-
@rollout.activate_globally(:chat)
|
169
|
-
@rollout.deactivate_globally(:chat)
|
170
|
-
end
|
171
|
-
|
172
|
-
it "becomes inactivate" do
|
173
|
-
@rollout.should_not be_active(:chat)
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
describe "#info" do
|
178
|
-
context "global features" do
|
179
|
-
let(:features) { [:signup, :chat, :table] }
|
180
|
-
|
181
|
-
before do
|
182
|
-
features.each do |f|
|
183
|
-
@rollout.activate_globally(f)
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
it "returns all global features" do
|
188
|
-
@rollout.info[:global].should include(*features)
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
describe "with a percentage set" do
|
193
|
-
before do
|
194
|
-
@rollout.activate_percentage(:chat, 10)
|
195
|
-
@rollout.activate_group(:chat, :caretakers)
|
196
|
-
@rollout.activate_group(:chat, :greeters)
|
197
|
-
@rollout.activate_globally(:signup)
|
198
|
-
@rollout.activate_user(:chat, stub(:id => 42))
|
199
|
-
end
|
200
|
-
|
201
|
-
it "returns info about all the activations" do
|
202
|
-
info = @rollout.info(:chat)
|
203
|
-
info[:percentage].should == 10
|
204
|
-
info[:groups].should include(:caretakers, :greeters)
|
205
|
-
info[:users].should include(42)
|
206
|
-
info[:global].should include(:signup)
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
describe "without a percentage set" do
|
211
|
-
it "defaults to 0" do
|
212
|
-
@rollout.info(:chat).should == {
|
213
|
-
:percentage => 0,
|
214
|
-
:groups => [],
|
215
|
-
:users => [],
|
216
|
-
:global => []
|
217
|
-
}
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
/data/{spec/spec.opts → .rspec}
RENAMED
File without changes
|