flapjack 0.7.34 → 0.7.35

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.
@@ -112,6 +112,12 @@ module Flapjack
112
112
  (LEVELS + [:configure, :close, :add]).include?(sym)
113
113
  end
114
114
 
115
+ ['debug', 'info', 'warn', 'error', 'fatal'].each { |level|
116
+ define_method("#{level}?") {
117
+ @logger.send("#{level}?")
118
+ }
119
+ }
120
+
115
121
  end
116
122
 
117
123
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  module Flapjack
4
- VERSION = "0.7.34"
4
+ VERSION = "0.7.35"
5
5
  end
@@ -57,9 +57,6 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
57
57
  Flapjack::Gateways::API.class_eval {
58
58
  set :raise_errors, true
59
59
  }
60
- Flapjack::Gateways::API.instance_variable_get('@middleware').delete_if {|m|
61
- m[0] == Rack::FiberPool
62
- }
63
60
  end
64
61
 
65
62
  before(:each) do
@@ -88,14 +85,14 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
88
85
  Flapjack::Data::Contact.should_receive(:all).with(:redis => redis).and_return([])
89
86
  Flapjack::Data::Contact.should_receive(:add).twice
90
87
 
91
- post "/contacts", contacts.to_json, {'CONTENT_TYPE' => 'application/json'}
88
+ apost "/contacts", contacts.to_json, {'CONTENT_TYPE' => 'application/json'}
92
89
  last_response.status.should == 204
93
90
  end
94
91
 
95
92
  it "does not create contacts if the data is improperly formatted" do
96
93
  Flapjack::Data::Contact.should_not_receive(:add)
97
94
 
98
- post "/contacts", {'contacts' => ["Hello", "again"]}.to_json,
95
+ apost "/contacts", {'contacts' => ["Hello", "again"]}.to_json,
99
96
  {'CONTENT_TYPE' => 'application/json'}
100
97
  last_response.status.should == 403
101
98
  end
@@ -118,7 +115,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
118
115
  Flapjack::Data::Contact.should_receive(:all).with(:redis => redis).and_return([])
119
116
  Flapjack::Data::Contact.should_receive(:add)
120
117
 
121
- post "/contacts", contacts.to_json, {'CONTENT_TYPE' => 'application/json'}
118
+ apost "/contacts", contacts.to_json, {'CONTENT_TYPE' => 'application/json'}
122
119
  last_response.status.should == 204
123
120
  end
124
121
 
@@ -145,7 +142,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
145
142
  Flapjack::Data::Contact.should_receive(:all).with(:redis => redis).and_return([existing])
146
143
  Flapjack::Data::Contact.should_receive(:add).with(contacts['contacts'][0], :redis => redis)
147
144
 
148
- post "/contacts", contacts.to_json, {'CONTENT_TYPE' => 'application/json'}
145
+ apost "/contacts", contacts.to_json, {'CONTENT_TYPE' => 'application/json'}
149
146
  last_response.status.should == 204
150
147
  end
151
148
 
@@ -166,7 +163,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
166
163
  Flapjack::Data::Contact.should_receive(:all).with(:redis => redis).and_return([existing])
167
164
  Flapjack::Data::Contact.should_receive(:add).with(contacts['contacts'][0], :redis => redis)
168
165
 
169
- post "/contacts", contacts.to_json, {'CONTENT_TYPE' => 'application/json'}
166
+ apost "/contacts", contacts.to_json, {'CONTENT_TYPE' => 'application/json'}
170
167
  last_response.status.should == 204
171
168
  end
172
169
 
@@ -175,7 +172,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
175
172
  Flapjack::Data::Contact.should_receive(:all).with(:redis => redis).
176
173
  and_return([contact])
177
174
 
178
- get '/contacts'
175
+ aget '/contacts'
179
176
  last_response.should be_ok
180
177
  last_response.body.should be_json_eql([contact_core].to_json)
181
178
  end
@@ -185,7 +182,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
185
182
  Flapjack::Data::Contact.should_receive(:find_by_id).
186
183
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
187
184
 
188
- get "/contacts/#{contact.id}"
185
+ aget "/contacts/#{contact.id}"
189
186
  last_response.should be_ok
190
187
  last_response.body.should be_json_eql(contact_core.to_json)
191
188
  end
@@ -194,7 +191,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
194
191
  Flapjack::Data::Contact.should_receive(:find_by_id).
195
192
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
196
193
 
197
- get "/contacts/#{contact.id}"
194
+ aget "/contacts/#{contact.id}"
198
195
  last_response.should be_forbidden
199
196
  end
200
197
 
@@ -208,7 +205,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
208
205
  Flapjack::Data::Contact.should_receive(:find_by_id).
209
206
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
210
207
 
211
- get "/contacts/#{contact.id}/notification_rules"
208
+ aget "/contacts/#{contact.id}/notification_rules"
212
209
  last_response.should be_ok
213
210
  last_response.body.should be_json_eql( '["rule_1", "rule_2"]' )
214
211
  end
@@ -217,7 +214,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
217
214
  Flapjack::Data::Contact.should_receive(:find_by_id).
218
215
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
219
216
 
220
- get "/contacts/#{contact.id}/notification_rules"
217
+ aget "/contacts/#{contact.id}/notification_rules"
221
218
  last_response.should be_forbidden
222
219
  end
223
220
 
@@ -226,7 +223,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
226
223
  Flapjack::Data::NotificationRule.should_receive(:find_by_id).
227
224
  with(notification_rule.id, {:redis => redis, :logger => @logger}).and_return(notification_rule)
228
225
 
229
- get "/notification_rules/#{notification_rule.id}"
226
+ aget "/notification_rules/#{notification_rule.id}"
230
227
  last_response.should be_ok
231
228
  last_response.body.should be_json_eql('"rule_1"')
232
229
  end
@@ -235,7 +232,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
235
232
  Flapjack::Data::NotificationRule.should_receive(:find_by_id).
236
233
  with(notification_rule.id, {:redis => redis, :logger => @logger}).and_return(nil)
237
234
 
238
- get "/notification_rules/#{notification_rule.id}"
235
+ aget "/notification_rules/#{notification_rule.id}"
239
236
  last_response.should be_forbidden
240
237
  end
241
238
 
@@ -255,7 +252,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
255
252
  contact.should_receive(:add_notification_rule).
256
253
  with(notification_rule_data_sym, :logger => @logger).and_return(notification_rule)
257
254
 
258
- post "/notification_rules", notification_rule_data.to_json,
255
+ apost "/notification_rules", notification_rule_data.to_json,
259
256
  {'CONTENT_TYPE' => 'application/json'}
260
257
  last_response.should be_ok
261
258
  last_response.body.should be_json_eql('"rule_1"')
@@ -265,7 +262,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
265
262
  Flapjack::Data::Contact.should_receive(:find_by_id).
266
263
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
267
264
 
268
- post "/notification_rules", notification_rule_data.to_json,
265
+ apost "/notification_rules", notification_rule_data.to_json,
269
266
  {'CONTENT_TYPE' => 'application/json'}
270
267
  last_response.should be_forbidden
271
268
  end
@@ -273,7 +270,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
273
270
  it "does not create a notification_rule if a rule id is provided" do
274
271
  contact.should_not_receive(:add_notification_rule)
275
272
 
276
- post "/notification_rules", notification_rule_data.merge(:id => 1).to_json,
273
+ apost "/notification_rules", notification_rule_data.merge(:id => 1).to_json,
277
274
  {'CONTENT_TYPE' => 'application/json'}
278
275
  last_response.status.should == 403
279
276
  end
@@ -294,7 +291,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
294
291
 
295
292
  notification_rule.should_receive(:update).with(notification_rule_data_sym, :logger => @logger).and_return(nil)
296
293
 
297
- put "/notification_rules/#{notification_rule.id}", notification_rule_data.to_json,
294
+ aput "/notification_rules/#{notification_rule.id}", notification_rule_data.to_json,
298
295
  {'CONTENT_TYPE' => 'application/json'}
299
296
  last_response.should be_ok
300
297
  last_response.body.should be_json_eql('"rule_1"')
@@ -304,7 +301,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
304
301
  Flapjack::Data::NotificationRule.should_receive(:find_by_id).
305
302
  with(notification_rule.id, {:redis => redis, :logger => @logger}).and_return(nil)
306
303
 
307
- put "/notification_rules/#{notification_rule.id}", notification_rule_data
304
+ aput "/notification_rules/#{notification_rule.id}", notification_rule_data
308
305
  last_response.should be_forbidden
309
306
  end
310
307
 
@@ -314,7 +311,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
314
311
  Flapjack::Data::Contact.should_receive(:find_by_id).
315
312
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
316
313
 
317
- put "/notification_rules/#{notification_rule.id}", notification_rule_data.to_json,
314
+ aput "/notification_rules/#{notification_rule.id}", notification_rule_data.to_json,
318
315
  {'CONTENT_TYPE' => 'application/json'}
319
316
  last_response.should be_forbidden
320
317
  end
@@ -328,7 +325,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
328
325
  Flapjack::Data::Contact.should_receive(:find_by_id).
329
326
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
330
327
 
331
- delete "/notification_rules/#{notification_rule.id}"
328
+ adelete "/notification_rules/#{notification_rule.id}"
332
329
  last_response.status.should == 204
333
330
  end
334
331
 
@@ -336,7 +333,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
336
333
  Flapjack::Data::NotificationRule.should_receive(:find_by_id).
337
334
  with(notification_rule.id, {:redis => redis, :logger => @logger}).and_return(nil)
338
335
 
339
- delete "/notification_rules/#{notification_rule.id}"
336
+ adelete "/notification_rules/#{notification_rule.id}"
340
337
  last_response.should be_forbidden
341
338
  end
342
339
 
@@ -347,7 +344,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
347
344
  Flapjack::Data::Contact.should_receive(:find_by_id).
348
345
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
349
346
 
350
- delete "/notification_rules/#{notification_rule.id}"
347
+ adelete "/notification_rules/#{notification_rule.id}"
351
348
  last_response.should be_forbidden
352
349
  end
353
350
 
@@ -364,7 +361,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
364
361
  'rollup_threshold' => media_rollup_thresholds[m] }]
365
362
  }).flatten(1)].to_json
366
363
 
367
- get "/contacts/#{contact.id}/media"
364
+ aget "/contacts/#{contact.id}/media"
368
365
  last_response.should be_ok
369
366
  last_response.body.should be_json_eql(result)
370
367
  end
@@ -373,7 +370,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
373
370
  Flapjack::Data::Contact.should_receive(:find_by_id).
374
371
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
375
372
 
376
- get "/contacts/#{contact.id}/media"
373
+ aget "/contacts/#{contact.id}/media"
377
374
  last_response.should be_forbidden
378
375
  end
379
376
 
@@ -391,7 +388,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
391
388
  'rollup_threshold' => media_rollup_thresholds['sms'],
392
389
  }
393
390
 
394
- get "/contacts/#{contact.id}/media/sms"
391
+ aget "/contacts/#{contact.id}/media/sms"
395
392
  last_response.should be_ok
396
393
  last_response.body.should be_json_eql(result.to_json)
397
394
  end
@@ -400,7 +397,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
400
397
  Flapjack::Data::Contact.should_receive(:find_by_id).
401
398
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
402
399
 
403
- get "/contacts/#{contact.id}/media/sms"
400
+ aget "/contacts/#{contact.id}/media/sms"
404
401
  last_response.should be_forbidden
405
402
  end
406
403
 
@@ -409,7 +406,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
409
406
  Flapjack::Data::Contact.should_receive(:find_by_id).
410
407
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
411
408
 
412
- get "/contacts/#{contact.id}/media/telepathy"
409
+ aget "/contacts/#{contact.id}/media/telepathy"
413
410
  last_response.should be_forbidden
414
411
  end
415
412
 
@@ -434,7 +431,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
434
431
  'interval' => alt_media_intervals['sms'],
435
432
  'rollup_threshold' => alt_media_rollup_thresholds['sms']}
436
433
 
437
- put "/contacts/#{contact.id}/media/sms", :address => '04987654321',
434
+ aput "/contacts/#{contact.id}/media/sms", :address => '04987654321',
438
435
  :interval => '200', :rollup_threshold => '5'
439
436
  last_response.should be_ok
440
437
  last_response.body.should be_json_eql(result.to_json)
@@ -451,7 +448,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
451
448
  Flapjack::Data::Contact.should_receive(:find_by_id).
452
449
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
453
450
 
454
- put "/contacts/#{contact.id}/media/pagerduty", :service_key => result['service_key'],
451
+ aput "/contacts/#{contact.id}/media/pagerduty", :service_key => result['service_key'],
455
452
  :subdomain => result['subdomain'], :username => result['username'],
456
453
  :password => result['password']
457
454
 
@@ -463,7 +460,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
463
460
  Flapjack::Data::Contact.should_receive(:find_by_id).
464
461
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
465
462
 
466
- put "/contacts/#{contact.id}/media/sms", :address => '04987654321', :interval => '200'
463
+ aput "/contacts/#{contact.id}/media/sms", :address => '04987654321', :interval => '200'
467
464
  last_response.should be_forbidden
468
465
  end
469
466
 
@@ -471,7 +468,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
471
468
  Flapjack::Data::Contact.should_receive(:find_by_id).
472
469
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
473
470
 
474
- put "/contacts/#{contact.id}/media/sms", :interval => '200'
471
+ aput "/contacts/#{contact.id}/media/sms", :interval => '200'
475
472
  last_response.should be_forbidden
476
473
  end
477
474
 
@@ -489,7 +486,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
489
486
  Flapjack::Data::Contact.should_receive(:find_by_id).
490
487
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
491
488
 
492
- put "/contacts/#{contact.id}/media/sms", :address => '04987654321'
489
+ aput "/contacts/#{contact.id}/media/sms", :address => '04987654321'
493
490
  last_response.should be_ok
494
491
  end
495
492
 
@@ -498,7 +495,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
498
495
  Flapjack::Data::Contact.should_receive(:find_by_id).
499
496
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
500
497
 
501
- delete "/contacts/#{contact.id}/media/sms"
498
+ adelete "/contacts/#{contact.id}/media/sms"
502
499
  last_response.status.should == 204
503
500
  end
504
501
 
@@ -506,7 +503,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
506
503
  Flapjack::Data::Contact.should_receive(:find_by_id).
507
504
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
508
505
 
509
- delete "/contacts/#{contact.id}/media/sms"
506
+ adelete "/contacts/#{contact.id}/media/sms"
510
507
  last_response.should be_forbidden
511
508
  end
512
509
 
@@ -516,7 +513,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
516
513
  Flapjack::Data::Contact.should_receive(:find_by_id).
517
514
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
518
515
 
519
- get "/contacts/#{contact.id}/timezone"
516
+ aget "/contacts/#{contact.id}/timezone"
520
517
  last_response.should be_ok
521
518
  last_response.body.should be_json_eql('"Australia/Sydney"')
522
519
  end
@@ -525,7 +522,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
525
522
  Flapjack::Data::Contact.should_receive(:find_by_id).
526
523
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
527
524
 
528
- get "/contacts/#{contact.id}/timezone"
525
+ aget "/contacts/#{contact.id}/timezone"
529
526
  last_response.should be_forbidden
530
527
  end
531
528
 
@@ -536,7 +533,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
536
533
  Flapjack::Data::Contact.should_receive(:find_by_id).
537
534
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
538
535
 
539
- put "/contacts/#{contact.id}/timezone", {:timezone => 'Australia/Perth'}
536
+ aput "/contacts/#{contact.id}/timezone", {:timezone => 'Australia/Perth'}
540
537
  last_response.should be_ok
541
538
  end
542
539
 
@@ -544,7 +541,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
544
541
  Flapjack::Data::Contact.should_receive(:find_by_id).
545
542
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
546
543
 
547
- put "/contacts/#{contact.id}/timezone", {:timezone => 'Australia/Perth'}
544
+ aput "/contacts/#{contact.id}/timezone", {:timezone => 'Australia/Perth'}
548
545
  last_response.should be_forbidden
549
546
  end
550
547
 
@@ -554,7 +551,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
554
551
  Flapjack::Data::Contact.should_receive(:find_by_id).
555
552
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
556
553
 
557
- delete "/contacts/#{contact.id}/timezone"
554
+ adelete "/contacts/#{contact.id}/timezone"
558
555
  last_response.status.should == 204
559
556
  end
560
557
 
@@ -562,7 +559,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
562
559
  Flapjack::Data::Contact.should_receive(:find_by_id).
563
560
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
564
561
 
565
- delete "/contacts/#{contact.id}/timezone"
562
+ adelete "/contacts/#{contact.id}/timezone"
566
563
  last_response.should be_forbidden
567
564
  end
568
565
 
@@ -572,7 +569,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
572
569
  Flapjack::Data::Contact.should_receive(:find_by_id).
573
570
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
574
571
 
575
- post "contacts/#{contact.id}/tags", :tag => 'web'
572
+ apost "contacts/#{contact.id}/tags", :tag => 'web'
576
573
  last_response.should be_ok
577
574
  last_response.body.should be_json_eql( ['web'].to_json )
578
575
  end
@@ -581,7 +578,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
581
578
  Flapjack::Data::Contact.should_receive(:find_by_id).
582
579
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
583
580
 
584
- post "contacts/#{contact.id}/tags", :tag => 'web'
581
+ apost "contacts/#{contact.id}/tags", :tag => 'web'
585
582
  last_response.should be_forbidden
586
583
  end
587
584
 
@@ -591,7 +588,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
591
588
  Flapjack::Data::Contact.should_receive(:find_by_id).
592
589
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
593
590
 
594
- post "contacts/#{contact.id}/tags", :tag => ['web', 'app']
591
+ apost "contacts/#{contact.id}/tags", :tag => ['web', 'app']
595
592
  last_response.should be_ok
596
593
  last_response.body.should be_json_eql( ['web', 'app'].to_json )
597
594
  end
@@ -600,7 +597,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
600
597
  Flapjack::Data::Contact.should_receive(:find_by_id).
601
598
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
602
599
 
603
- post "contacts/#{contact.id}/tags", :tag => ['web', 'app']
600
+ apost "contacts/#{contact.id}/tags", :tag => ['web', 'app']
604
601
  last_response.should be_forbidden
605
602
  end
606
603
 
@@ -609,7 +606,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
609
606
  Flapjack::Data::Contact.should_receive(:find_by_id).
610
607
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
611
608
 
612
- delete "contacts/#{contact.id}/tags", :tag => 'web'
609
+ adelete "contacts/#{contact.id}/tags", :tag => 'web'
613
610
  last_response.status.should == 204
614
611
  end
615
612
 
@@ -617,7 +614,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
617
614
  Flapjack::Data::Contact.should_receive(:find_by_id).
618
615
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
619
616
 
620
- delete "contacts/#{contact.id}/tags", :tag => 'web'
617
+ adelete "contacts/#{contact.id}/tags", :tag => 'web'
621
618
  last_response.should be_forbidden
622
619
  end
623
620
 
@@ -626,7 +623,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
626
623
  Flapjack::Data::Contact.should_receive(:find_by_id).
627
624
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
628
625
 
629
- delete "contacts/#{contact.id}/tags", :tag => ['web', 'app']
626
+ adelete "contacts/#{contact.id}/tags", :tag => ['web', 'app']
630
627
  last_response.status.should == 204
631
628
  end
632
629
 
@@ -634,7 +631,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
634
631
  Flapjack::Data::Contact.should_receive(:find_by_id).
635
632
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
636
633
 
637
- delete "contacts/#{contact.id}/tags", :tag => ['web', 'app']
634
+ adelete "contacts/#{contact.id}/tags", :tag => ['web', 'app']
638
635
  last_response.should be_forbidden
639
636
  end
640
637
 
@@ -643,7 +640,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
643
640
  Flapjack::Data::Contact.should_receive(:find_by_id).
644
641
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
645
642
 
646
- get "contacts/#{contact.id}/tags"
643
+ aget "contacts/#{contact.id}/tags"
647
644
  last_response.should be_ok
648
645
  last_response.body.should be_json_eql( ['web', 'app'].to_json )
649
646
  end
@@ -652,7 +649,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
652
649
  Flapjack::Data::Contact.should_receive(:find_by_id).
653
650
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
654
651
 
655
- get "contacts/#{contact.id}/tags"
652
+ aget "contacts/#{contact.id}/tags"
656
653
  last_response.should be_forbidden
657
654
  end
658
655
 
@@ -669,7 +666,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
669
666
  Flapjack::Data::Contact.should_receive(:find_by_id).
670
667
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
671
668
 
672
- get "contacts/#{contact.id}/entity_tags"
669
+ aget "contacts/#{contact.id}/entity_tags"
673
670
  last_response.should be_ok
674
671
  tag_response = {'entity_1' => ['web'],
675
672
  'entity_2' => ['app']}
@@ -680,7 +677,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
680
677
  Flapjack::Data::Contact.should_receive(:find_by_id).
681
678
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
682
679
 
683
- get "contacts/#{contact.id}/entity_tags"
680
+ aget "contacts/#{contact.id}/entity_tags"
684
681
  last_response.should be_forbidden
685
682
  end
686
683
 
@@ -701,7 +698,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
701
698
  Flapjack::Data::Contact.should_receive(:find_by_id).
702
699
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
703
700
 
704
- post "contacts/#{contact.id}/entity_tags",
701
+ apost "contacts/#{contact.id}/entity_tags",
705
702
  :entity => {'entity_1' => ['web'], 'entity_2' => ['app']}
706
703
  last_response.should be_ok
707
704
  tag_response = {'entity_1' => ['web'],
@@ -713,7 +710,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
713
710
  Flapjack::Data::Contact.should_receive(:find_by_id).
714
711
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
715
712
 
716
- post "contacts/#{contact.id}/entity_tags",
713
+ apost "contacts/#{contact.id}/entity_tags",
717
714
  :entity => {'entity_1' => ['web'], 'entity_2' => ['app']}
718
715
  last_response.should be_forbidden
719
716
  end
@@ -732,7 +729,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
732
729
  Flapjack::Data::Contact.should_receive(:find_by_id).
733
730
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(contact)
734
731
 
735
- delete "contacts/#{contact.id}/entity_tags",
732
+ adelete "contacts/#{contact.id}/entity_tags",
736
733
  :entity => {'entity_1' => ['web'], 'entity_2' => ['app']}
737
734
  last_response.status.should == 204
738
735
  end
@@ -741,7 +738,7 @@ describe 'Flapjack::Gateways::API::ContactMethods', :sinatra => true, :logger =>
741
738
  Flapjack::Data::Contact.should_receive(:find_by_id).
742
739
  with(contact.id, {:redis => redis, :logger => @logger}).and_return(nil)
743
740
 
744
- delete "contacts/#{contact.id}/entity_tags",
741
+ adelete "contacts/#{contact.id}/entity_tags",
745
742
  :entity => {'entity_1' => ['web'], 'entity_2' => ['app']}
746
743
  last_response.should be_forbidden
747
744
  end