fluidfeatures 0.4.1 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,441 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.fluidfeatures.com/service/app/1vu33ki6emqe3/features?verbose=true&etag_wait=30
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ accept:
11
+ - application/json
12
+ user-agent:
13
+ - Ruby
14
+ accept-encoding:
15
+ - gzip
16
+ if-none-match:
17
+ - ! '"36679fb05ecafe685b0dc553390ccb1df563da75"'
18
+ connection:
19
+ - keep-alive
20
+ keep-alive:
21
+ - 30
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: !binary |-
26
+ T0s=
27
+ headers:
28
+ !binary "Y2FjaGUtY29udHJvbA==":
29
+ - !binary |-
30
+ bm8tY2FjaGU=
31
+ !binary "Y29udGVudC1lbmNvZGluZw==":
32
+ - !binary |-
33
+ Z3ppcA==
34
+ !binary "Y29udGVudC10eXBl":
35
+ - !binary |-
36
+ dGV4dC9odG1sOyBjaGFyc2V0PVVURi04
37
+ !binary "ZGF0ZQ==":
38
+ - !binary |-
39
+ TW9uLCAwMyBEZWMgMjAxMiAwODoyMjo0MiBHTVQ=
40
+ !binary "ZXRhZw==":
41
+ - !binary |-
42
+ IjY2MTNmMjJjNWJkNDdlYWQ2MjY2Mzg2MTA3MmM0MzI4OWJlNWU0ZmIi
43
+ !binary "ZXhwaXJlcw==":
44
+ - !binary |-
45
+ TW9uLCAwMyBEZWMgMjAxMiAwODoyMjo0MSBHTVQ=
46
+ !binary "c2VydmVy":
47
+ - !binary |-
48
+ VG9ybmFkb1NlcnZlci8yLjM=
49
+ !binary "Y29udGVudC1sZW5ndGg=":
50
+ - !binary |-
51
+ NTE3
52
+ !binary "Y29ubmVjdGlvbg==":
53
+ - !binary |-
54
+ a2VlcC1hbGl2ZQ==
55
+ body:
56
+ encoding: ASCII-8BIT
57
+ string: !binary |-
58
+ H4sIAAAAAAAAA62TTW7CQAyFrxJlnQUzmd8eoJeoUBVoqJBKiiCwiXL3fjYw
59
+ lVAXSHQxJX7z7LFfn6f6te/G06GvX6qpHrqdfBSsqerhtHvfd4fxCG4WC5Bz
60
+ fzhuvwcBprrTv8exU8JUn47d56XWvj+s+2Hk3vp5Ju9W5c00VWiq1FS5oSTH
61
+ cwgNseXSthwwC8uCtXBa8Ba8dZzIAXfgDtwRO/K95cDx5HmJ4QSwQK1AHOFH
62
+ +JEaESySF+Ek8AQvkZvgJbAMluFm8AyeycnkZHJyXjJOP3Srr/5D5/+dFYlm
63
+ udxs+vW4Pd9L4RcqxeoB1a7UohqN0AdtSOeIRXMGzAAaUMPQBtzSuAW3YFZi
64
+ Bmoll7QWTkvsiJ0Ug+PAHbhjaE+up66XV8A9+QEsgAX4ATzADYLDj9SJ4BEs
65
+ UjfBS3ASuQkswcv8Zu4QZvmMaqrb1atG5bszq6kp/w9uvfyHiuwiE0owMDMy
66
+ kkzCYVJVHUjtCqdYFo7aFo5albjYVZSnmCoOrqrDK9aVt3hJlC8W5j1RXZXm
67
+ Xq0rMfnFvqI8mCrOt1qWd3J4SnQUfcSqfyw4c2Yk4kcNSitqUFrWLWck3XTu
68
+ xaS64XyXDYcvZtXtvhlVJCFPjKmGhF9MKRj3suVqTHi66XBky8t2I5+aE17Z
69
+ cji63fDEqFn6ftqs8w8QikWdWQUAAA==
70
+ http_version: !binary |-
71
+ MS4x
72
+ recorded_at: Mon, 03 Dec 2012 08:22:42 GMT
73
+ - request:
74
+ method: get
75
+ uri: https://www.fluidfeatures.com/service/app/1vu33ki6emqe3/features?verbose=true&etag_wait=30
76
+ body:
77
+ encoding: US-ASCII
78
+ string: ''
79
+ headers:
80
+ accept:
81
+ - application/json
82
+ user-agent:
83
+ - Ruby
84
+ accept-encoding:
85
+ - gzip
86
+ connection:
87
+ - keep-alive
88
+ keep-alive:
89
+ - 30
90
+ response:
91
+ status:
92
+ code: 200
93
+ message: !binary |-
94
+ T0s=
95
+ headers:
96
+ !binary "Y2FjaGUtY29udHJvbA==":
97
+ - !binary |-
98
+ bm8tY2FjaGU=
99
+ !binary "Y29udGVudC1lbmNvZGluZw==":
100
+ - !binary |-
101
+ Z3ppcA==
102
+ !binary "Y29udGVudC10eXBl":
103
+ - !binary |-
104
+ dGV4dC9odG1sOyBjaGFyc2V0PVVURi04
105
+ !binary "ZGF0ZQ==":
106
+ - !binary |-
107
+ TW9uLCAwMyBEZWMgMjAxMiAwODoyMjo0MyBHTVQ=
108
+ !binary "ZXRhZw==":
109
+ - !binary |-
110
+ IjY2MTNmMjJjNWJkNDdlYWQ2MjY2Mzg2MTA3MmM0MzI4OWJlNWU0ZmIi
111
+ !binary "ZXhwaXJlcw==":
112
+ - !binary |-
113
+ TW9uLCAwMyBEZWMgMjAxMiAwODoyMjo0MiBHTVQ=
114
+ !binary "c2VydmVy":
115
+ - !binary |-
116
+ VG9ybmFkb1NlcnZlci8yLjM=
117
+ !binary "Y29udGVudC1sZW5ndGg=":
118
+ - !binary |-
119
+ NTE3
120
+ !binary "Y29ubmVjdGlvbg==":
121
+ - !binary |-
122
+ a2VlcC1hbGl2ZQ==
123
+ body:
124
+ encoding: ASCII-8BIT
125
+ string: !binary |-
126
+ H4sIAAAAAAAAA62TTW7CQAyFrxJlnQUzmd8eoJeoUBVoqJBKiiCwiXL3fjYw
127
+ lVAXSHQxJX7z7LFfn6f6te/G06GvX6qpHrqdfBSsqerhtHvfd4fxCG4WC5Bz
128
+ fzhuvwcBprrTv8exU8JUn47d56XWvj+s+2Hk3vp5Ju9W5c00VWiq1FS5oSTH
129
+ cwgNseXSthwwC8uCtXBa8Ba8dZzIAXfgDtwRO/K95cDx5HmJ4QSwQK1AHOFH
130
+ +JEaESySF+Ek8AQvkZvgJbAMluFm8AyeycnkZHJyXjJOP3Srr/5D5/+dFYlm
131
+ udxs+vW4Pd9L4RcqxeoB1a7UohqN0AdtSOeIRXMGzAAaUMPQBtzSuAW3YFZi
132
+ Bmoll7QWTkvsiJ0Ug+PAHbhjaE+up66XV8A9+QEsgAX4ATzADYLDj9SJ4BEs
133
+ UjfBS3ASuQkswcv8Zu4QZvmMaqrb1atG5bszq6kp/w9uvfyHiuwiE0owMDMy
134
+ kkzCYVJVHUjtCqdYFo7aFo5albjYVZSnmCoOrqrDK9aVt3hJlC8W5j1RXZXm
135
+ Xq0rMfnFvqI8mCrOt1qWd3J4SnQUfcSqfyw4c2Yk4kcNSitqUFrWLWck3XTu
136
+ xaS64XyXDYcvZtXtvhlVJCFPjKmGhF9MKRj3suVqTHi66XBky8t2I5+aE17Z
137
+ cji63fDEqFn6ftqs8w8QikWdWQUAAA==
138
+ http_version: !binary |-
139
+ MS4x
140
+ recorded_at: Mon, 03 Dec 2012 08:22:42 GMT
141
+ - request:
142
+ method: post
143
+ uri: https://www.fluidfeatures.com/service/app/1vu33ki6emqe3/report/transactions
144
+ body:
145
+ encoding: UTF-8
146
+ string: ! '{"client_uuid":"8801b4e0-1f50-0130-eb8a-704da2623409","transactions":[{"url":"http://example.com","user":{"id":"anon-7468504183-177986","anonymous":true,"unique":[],"cohorts":[]},"hits":{"feature":{"Feature1":{"a":{}}},"goal":{"Goal":{"a":{}}}},"stats":{"duration":5.0021e-05}}],"stats":{"waiting_buckets":[0]},"unknown_features":{"Feature1":{"a":true}},"api_request_log":[]}'
147
+ headers:
148
+ accept:
149
+ - application/json
150
+ user-agent:
151
+ - Ruby
152
+ accept-encoding:
153
+ - gzip
154
+ content-type:
155
+ - application/json
156
+ connection:
157
+ - keep-alive
158
+ keep-alive:
159
+ - 30
160
+ response:
161
+ status:
162
+ code: 200
163
+ message: OK
164
+ headers:
165
+ cache-control:
166
+ - no-cache
167
+ content-type:
168
+ - text/html; charset=UTF-8
169
+ date:
170
+ - Mon, 03 Dec 2012 08:22:43 GMT
171
+ expires:
172
+ - Mon, 03 Dec 2012 08:22:42 GMT
173
+ server:
174
+ - TornadoServer/2.3
175
+ content-length:
176
+ - '0'
177
+ connection:
178
+ - keep-alive
179
+ body:
180
+ encoding: US-ASCII
181
+ string: ''
182
+ http_version: '1.1'
183
+ recorded_at: Mon, 03 Dec 2012 08:22:43 GMT
184
+ - request:
185
+ method: get
186
+ uri: https://www.fluidfeatures.com/service/app/1vu33ki6emqe3/features?verbose=true&etag_wait=30
187
+ body:
188
+ encoding: US-ASCII
189
+ string: ''
190
+ headers:
191
+ accept:
192
+ - application/json
193
+ user-agent:
194
+ - Ruby
195
+ authorization:
196
+ - lnUG0NAuKXwRxzlO0Ogwh3JLRBr3Fq8SBxcNHUJo
197
+ accept-encoding:
198
+ - gzip
199
+ if-none-match:
200
+ - !binary |-
201
+ IjY2MTNmMjJjNWJkNDdlYWQ2MjY2Mzg2MTA3MmM0MzI4OWJlNWU0ZmIi
202
+ connection:
203
+ - keep-alive
204
+ keep-alive:
205
+ - 30
206
+ response:
207
+ status:
208
+ code: 200
209
+ message: !binary |-
210
+ T0s=
211
+ headers:
212
+ !binary "Y2FjaGUtY29udHJvbA==":
213
+ - !binary |-
214
+ bm8tY2FjaGU=
215
+ !binary "Y29udGVudC1lbmNvZGluZw==":
216
+ - !binary |-
217
+ Z3ppcA==
218
+ !binary "Y29udGVudC10eXBl":
219
+ - !binary |-
220
+ dGV4dC9odG1sOyBjaGFyc2V0PVVURi04
221
+ !binary "ZGF0ZQ==":
222
+ - !binary |-
223
+ TW9uLCAwMyBEZWMgMjAxMiAwODoyMjo0MyBHTVQ=
224
+ !binary "ZXRhZw==":
225
+ - !binary |-
226
+ ImM3MmNjZDI2YzEzNDc2ZDMyNGQ4ZjAwMWJmNjRlYWI2NDA1MDM3OTgi
227
+ !binary "ZXhwaXJlcw==":
228
+ - !binary |-
229
+ TW9uLCAwMyBEZWMgMjAxMiAwODoyMjo0MiBHTVQ=
230
+ !binary "c2VydmVy":
231
+ - !binary |-
232
+ VG9ybmFkb1NlcnZlci8yLjM=
233
+ !binary "Y29udGVudC1sZW5ndGg=":
234
+ - !binary |-
235
+ NTEy
236
+ !binary "Y29ubmVjdGlvbg==":
237
+ - !binary |-
238
+ a2VlcC1hbGl2ZQ==
239
+ body:
240
+ encoding: ASCII-8BIT
241
+ string: !binary |-
242
+ H4sIAAAAAAAAA7WTTW7CQAyFrxJlnQUzmd8eoJeoUBVoqJBKWiWBTcTd+9mU
243
+ qYS6QEJdDMRvnj320/NSP/fdfBz7+qla6qE7yEfBmqoejofXr26cJ3CzWoGc
244
+ +nHafw4CLHWnv9PcKWGpj1P3fqn11Y/bfpi5t6vzmbxrlRfTVKGpUlPlhpIc
245
+ zyE0xJZL23LALCwL1sJpwVvw1nEiB9yBO3BH7Mj3lgPHk+clhhPAArUCcYQf
246
+ 4UdqRLBIXoSTwBO8RG6Cl8AyWIabwTN4JieTk8nJec04/dBtPvo3nf93ViQ6
247
+ y+Vu12/n/elWCn+RYnOHau5GNRqhD9qQzhGL5gyYATSghqENuKVxC27BrMQM
248
+ 1EouaS2cltgROykGx4E7cMfQnlxPXS+vgHvyA1gAC/ADeIAbBIcfqRPBI1ik
249
+ boKX4CRyE1iCl/nP3CHM+hHV1EI/XjUq341ZTU35f3Cr6IQUTMyQzCSjcBhV
250
+ ZQdSv8IpnoWjvoWjXiUufhXpKaaSg6vs8Ip35S1eEumLh3lPZFepuVfvSkx+
251
+ 8a9ID6aS862e5Z0cHlIdSe/x6h8bzpwZifhTh9KKOpSWdc0ZSVede3Gprjjf
252
+ ZcXhi1t1va9OFUnIE2eqI+EXVwrGvay5OhOerjocWfOy3sin7oRX1hyOrjc8
253
+ cWqWvh926/kbJ9GBE1oFAAA=
254
+ http_version: !binary |-
255
+ MS4x
256
+ recorded_at: Mon, 03 Dec 2012 08:22:43 GMT
257
+ - request:
258
+ method: get
259
+ uri: https://www.fluidfeatures.com/service/app/1vu33ki6emqe3/user/anon-5268552066-776457/features?anonymous=true
260
+ body:
261
+ encoding: US-ASCII
262
+ string: ''
263
+ headers:
264
+ accept:
265
+ - application/json
266
+ user-agent:
267
+ - Ruby
268
+ authorization:
269
+ - lnUG0NAuKXwRxzlO0Ogwh3JLRBr3Fq8SBxcNHUJo
270
+ accept-encoding:
271
+ - gzip
272
+ connection:
273
+ - keep-alive
274
+ keep-alive:
275
+ - 30
276
+ response:
277
+ status:
278
+ code: 200
279
+ message: OK
280
+ headers:
281
+ cache-control:
282
+ - no-cache
283
+ content-type:
284
+ - text/html; charset=UTF-8
285
+ date:
286
+ - Wed, 05 Dec 2012 14:39:11 GMT
287
+ etag:
288
+ - ! '"e80009a3efad2781f2596adda05db2c0556fca4f"'
289
+ expires:
290
+ - Wed, 05 Dec 2012 14:39:10 GMT
291
+ server:
292
+ - TornadoServer/2.3
293
+ content-length:
294
+ - '73'
295
+ connection:
296
+ - keep-alive
297
+ body:
298
+ encoding: US-ASCII
299
+ string: ! '{"Feature": {"a": false, "b": true}, "Feature1": {"a": true, "b":
300
+ false}}'
301
+ http_version: '1.1'
302
+ recorded_at: Wed, 05 Dec 2012 14:39:10 GMT
303
+ - request:
304
+ method: get
305
+ uri: https://www.fluidfeatures.com/service/app/1vu33ki6emqe3/user/anon-6457886880-798839/features?anonymous=true
306
+ body:
307
+ encoding: US-ASCII
308
+ string: ''
309
+ headers:
310
+ accept:
311
+ - application/json
312
+ user-agent:
313
+ - Ruby
314
+ authorization:
315
+ - lnUG0NAuKXwRxzlO0Ogwh3JLRBr3Fq8SBxcNHUJo
316
+ accept-encoding:
317
+ - gzip
318
+ connection:
319
+ - keep-alive
320
+ keep-alive:
321
+ - 30
322
+ response:
323
+ status:
324
+ code: 200
325
+ message: OK
326
+ headers:
327
+ cache-control:
328
+ - no-cache
329
+ content-type:
330
+ - text/html; charset=UTF-8
331
+ date:
332
+ - Wed, 05 Dec 2012 14:43:22 GMT
333
+ etag:
334
+ - ! '"e7a75db4fe4f42aebb7d788303e8e7265e601196"'
335
+ expires:
336
+ - Wed, 05 Dec 2012 14:43:21 GMT
337
+ server:
338
+ - TornadoServer/2.3
339
+ content-length:
340
+ - '73'
341
+ connection:
342
+ - keep-alive
343
+ body:
344
+ encoding: US-ASCII
345
+ string: ! '{"Feature": {"a": false, "b": true}, "Feature1": {"a": false, "b":
346
+ true}}'
347
+ http_version: '1.1'
348
+ recorded_at: Wed, 05 Dec 2012 14:43:21 GMT
349
+ - request:
350
+ method: get
351
+ uri: https://www.fluidfeatures.com/service/app/1vu33ki6emqe3/user/anon-908374837-796428/features?anonymous=true
352
+ body:
353
+ encoding: US-ASCII
354
+ string: ''
355
+ headers:
356
+ accept:
357
+ - application/json
358
+ user-agent:
359
+ - Ruby
360
+ authorization:
361
+ - lnUG0NAuKXwRxzlO0Ogwh3JLRBr3Fq8SBxcNHUJo
362
+ accept-encoding:
363
+ - gzip
364
+ connection:
365
+ - keep-alive
366
+ keep-alive:
367
+ - 30
368
+ response:
369
+ status:
370
+ code: 200
371
+ message: OK
372
+ headers:
373
+ cache-control:
374
+ - no-cache
375
+ content-type:
376
+ - text/html; charset=UTF-8
377
+ date:
378
+ - Wed, 05 Dec 2012 14:43:32 GMT
379
+ etag:
380
+ - ! '"e80009a3efad2781f2596adda05db2c0556fca4f"'
381
+ expires:
382
+ - Wed, 05 Dec 2012 14:43:31 GMT
383
+ server:
384
+ - TornadoServer/2.3
385
+ content-length:
386
+ - '73'
387
+ connection:
388
+ - keep-alive
389
+ body:
390
+ encoding: US-ASCII
391
+ string: ! '{"Feature": {"a": false, "b": true}, "Feature1": {"a": true, "b":
392
+ false}}'
393
+ http_version: '1.1'
394
+ recorded_at: Wed, 05 Dec 2012 14:43:31 GMT
395
+ - request:
396
+ method: get
397
+ uri: https://www.fluidfeatures.com/service/app/1vu33ki6emqe3/user/anon-8963566770-407532/features?anonymous=true
398
+ body:
399
+ encoding: US-ASCII
400
+ string: ''
401
+ headers:
402
+ accept:
403
+ - application/json
404
+ user-agent:
405
+ - Ruby
406
+ authorization:
407
+ - lnUG0NAuKXwRxzlO0Ogwh3JLRBr3Fq8SBxcNHUJo
408
+ accept-encoding:
409
+ - gzip
410
+ connection:
411
+ - keep-alive
412
+ keep-alive:
413
+ - 30
414
+ response:
415
+ status:
416
+ code: 200
417
+ message: OK
418
+ headers:
419
+ cache-control:
420
+ - no-cache
421
+ content-type:
422
+ - text/html; charset=UTF-8
423
+ date:
424
+ - Wed, 05 Dec 2012 14:44:20 GMT
425
+ etag:
426
+ - ! '"e7a75db4fe4f42aebb7d788303e8e7265e601196"'
427
+ expires:
428
+ - Wed, 05 Dec 2012 14:44:19 GMT
429
+ server:
430
+ - TornadoServer/2.3
431
+ content-length:
432
+ - '73'
433
+ connection:
434
+ - keep-alive
435
+ body:
436
+ encoding: US-ASCII
437
+ string: ! '{"Feature": {"a": false, "b": true}, "Feature1": {"a": false, "b":
438
+ true}}'
439
+ http_version: '1.1'
440
+ recorded_at: Wed, 05 Dec 2012 14:44:19 GMT
441
+ recorded_with: VCR 2.3.0
@@ -0,0 +1,53 @@
1
+ require "spec_helper"
2
+
3
+ describe "FluidFeatures" do
4
+
5
+ describe "App initialization" do
6
+
7
+ it "should raise 'host not set' without valid base uri" do
8
+ expect { FluidFeatures.app(nil, api_credentials[1], api_credentials[2]) }.
9
+ to raise_error(StandardError, /host not set/)
10
+ end
11
+
12
+ it "should raise 'app_id invalid' without valid app id" do
13
+ expect { FluidFeatures.app(api_credentials[0], nil, api_credentials[2]) }.
14
+ to raise_error(StandardError, /app_id invalid/)
15
+ end
16
+
17
+ it "should raise 'secret invalid' without valid secret" do
18
+ expect { FluidFeatures.app(api_credentials[0], api_credentials[1], nil) }.
19
+ to raise_error(StandardError, /secret invalid/)
20
+ end
21
+
22
+ end
23
+
24
+ describe "API methods" do
25
+
26
+ #let(:feature_name) { "Feature-#{UUID.new.generate}" }
27
+ let(:feature_name) { "Feature1" }
28
+
29
+ let(:feature) { app.features.pop[feature_name] }
30
+
31
+ specify "#feature_enabled? should create feature" do
32
+ VCR.use_cassette('feature') do
33
+ transaction.feature_enabled?(feature_name, "a", true)
34
+ transaction.feature_enabled?(feature_name, "b", true)
35
+ commit transaction
36
+ sleep abit
37
+ feature["name"].should == feature_name
38
+ feature["versions"].size.should == 2
39
+ end
40
+ end
41
+
42
+ specify "#goal_hit should create goal" do
43
+ VCR.use_cassette('goal') do
44
+ transaction.feature_enabled?(feature_name, "a", true)
45
+ transaction.goal_hit("Goal", "a")
46
+ commit transaction
47
+ sleep abit
48
+ end
49
+ end
50
+
51
+ end
52
+
53
+ end