flapjack 0.7.34 → 0.7.35

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,9 +23,6 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
23
23
  Flapjack::Gateways::API.class_eval {
24
24
  set :raise_errors, true
25
25
  }
26
- Flapjack::Gateways::API.instance_variable_get('@middleware').delete_if {|m|
27
- m[0] == Rack::FiberPool
28
- }
29
26
  end
30
27
 
31
28
  before(:each) do
@@ -40,7 +37,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
40
37
  Flapjack::Data::Entity.should_receive(:find_by_name).
41
38
  with(entity_name, :redis => redis).and_return(entity)
42
39
 
43
- get "/checks/#{entity_name_esc}"
40
+ aget "/checks/#{entity_name_esc}"
44
41
  last_response.should be_ok
45
42
  last_response.body.should == [check].to_json
46
43
  end
@@ -58,7 +55,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
58
55
  Flapjack::Data::Entity.should_receive(:find_by_name).
59
56
  with(entity_name, :redis => redis).and_return(entity)
60
57
 
61
- get "/status/#{entity_name_esc}"
58
+ aget "/status/#{entity_name_esc}"
62
59
  last_response.should be_ok
63
60
  last_response.body.should == ['status!'].to_json
64
61
  end
@@ -67,7 +64,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
67
64
  Flapjack::Data::Entity.should_receive(:find_by_name).
68
65
  with(entity_name, :redis => redis).and_return(nil)
69
66
 
70
- get "/status/#{entity_name_esc}"
67
+ aget "/status/#{entity_name_esc}"
71
68
  last_response.should be_forbidden
72
69
  end
73
70
 
@@ -84,7 +81,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
84
81
  Flapjack::Data::Entity.should_receive(:find_by_name).
85
82
  with(entity_name, :redis => redis).and_return(entity)
86
83
 
87
- get "/status/#{entity_name_esc}/#{check}"
84
+ aget "/status/#{entity_name_esc}/#{check}"
88
85
  last_response.should be_ok
89
86
  last_response.body.should == 'status!'.to_json
90
87
  end
@@ -93,7 +90,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
93
90
  Flapjack::Data::Entity.should_receive(:find_by_name).
94
91
  with(entity_name, :redis => redis).and_return(nil)
95
92
 
96
- get "/status/#{entity_name_esc}/#{check}"
93
+ aget "/status/#{entity_name_esc}/#{check}"
97
94
  last_response.should be_forbidden
98
95
  end
99
96
 
@@ -104,7 +101,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
104
101
  Flapjack::Data::EntityCheck.should_receive(:for_entity).
105
102
  with(entity, check, :redis => redis).and_return(nil)
106
103
 
107
- get "/status/#{entity_name_esc}/#{check}"
104
+ aget "/status/#{entity_name_esc}/#{check}"
108
105
  last_response.should be_forbidden
109
106
  end
110
107
 
@@ -117,7 +114,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
117
114
  Flapjack::Data::Entity.should_receive(:find_by_name).
118
115
  with(entity_name, :redis => redis).and_return(entity)
119
116
 
120
- get "/scheduled_maintenances/#{entity_name_esc}"
117
+ aget "/scheduled_maintenances/#{entity_name_esc}"
121
118
  last_response.should be_ok
122
119
  last_response.body.should == [{:check => check, :scheduled_maintenance => sched}].to_json
123
120
  end
@@ -134,7 +131,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
134
131
  Flapjack::Data::Entity.should_receive(:find_by_name).
135
132
  with(entity_name, :redis => redis).and_return(entity)
136
133
 
137
- get "/scheduled_maintenances/#{entity_name_esc}?" +
134
+ aget "/scheduled_maintenances/#{entity_name_esc}?" +
138
135
  "start_time=#{CGI.escape(start.iso8601)}&end_time=#{CGI.escape(finish.iso8601)}"
139
136
  last_response.should be_ok
140
137
  last_response.body.should == [{:check => check, :scheduled_maintenance => sched}].to_json
@@ -150,7 +147,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
150
147
  Flapjack::Data::EntityCheck.should_receive(:for_entity).
151
148
  with(entity, check, :redis => redis).and_return(entity_check)
152
149
 
153
- get "/scheduled_maintenances/#{entity_name_esc}/#{check}"
150
+ aget "/scheduled_maintenances/#{entity_name_esc}/#{check}"
154
151
  last_response.should be_ok
155
152
  last_response.body.should == 'sched!'.to_json
156
153
  end
@@ -166,7 +163,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
166
163
  Flapjack::Data::Event.should_receive(:create_acknowledgement).
167
164
  with(entity_name, check, :summary => nil, :duration => (4 * 60 * 60), :redis => redis)
168
165
 
169
- post "/acknowledgements/#{entity_name_esc}/#{check}"
166
+ apost "/acknowledgements/#{entity_name_esc}/#{check}"
170
167
  last_response.status.should == 204
171
168
  end
172
169
 
@@ -179,7 +176,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
179
176
  Flapjack::Data::Entity.should_receive(:find_by_name).
180
177
  with(entity_name, :redis => redis).and_return(entity)
181
178
 
182
- get "/unscheduled_maintenances/#{entity_name_esc}"
179
+ aget "/unscheduled_maintenances/#{entity_name_esc}"
183
180
  last_response.should be_ok
184
181
  last_response.body.should == [{:check => check, :unscheduled_maintenance => unsched}].to_json
185
182
  end
@@ -194,7 +191,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
194
191
  Flapjack::Data::EntityCheck.should_receive(:for_entity).
195
192
  with(entity, check, :redis => redis).and_return(entity_check)
196
193
 
197
- get "/unscheduled_maintenances/#{entity_name_esc}/#{check}"
194
+ aget "/unscheduled_maintenances/#{entity_name_esc}/#{check}"
198
195
  last_response.should be_ok
199
196
  last_response.body.should == 'unsched!'.to_json
200
197
  end
@@ -212,7 +209,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
212
209
  Flapjack::Data::EntityCheck.should_receive(:for_entity).
213
210
  with(entity, check, :redis => redis).and_return(entity_check)
214
211
 
215
- get "/unscheduled_maintenances/#{entity_name_esc}/#{check}" +
212
+ aget "/unscheduled_maintenances/#{entity_name_esc}/#{check}" +
216
213
  "?start_time=#{CGI.escape(start.iso8601)}&end_time=#{CGI.escape(finish.iso8601)}"
217
214
  last_response.should be_ok
218
215
  last_response.body.should == 'unsched!'.to_json
@@ -227,7 +224,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
227
224
  Flapjack::Data::Entity.should_receive(:find_by_name).
228
225
  with(entity_name, :redis => redis).and_return(entity)
229
226
 
230
- get "/outages/#{entity_name_esc}"
227
+ aget "/outages/#{entity_name_esc}"
231
228
  last_response.should be_ok
232
229
  last_response.body.should == [{:check => check, :outages => out}].to_json
233
230
  end
@@ -242,7 +239,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
242
239
  Flapjack::Data::EntityCheck.should_receive(:for_entity).
243
240
  with(entity, check, :redis => redis).and_return(entity_check)
244
241
 
245
- get "/outages/#{entity_name_esc}/#{check}"
242
+ aget "/outages/#{entity_name_esc}/#{check}"
246
243
  last_response.should be_ok
247
244
  last_response.body.should == 'out!'.to_json
248
245
  end
@@ -256,7 +253,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
256
253
  Flapjack::Data::Entity.should_receive(:find_by_name).
257
254
  with(entity_name, :redis => redis).and_return(entity)
258
255
 
259
- get "/downtime/#{entity_name_esc}"
256
+ aget "/downtime/#{entity_name_esc}"
260
257
  last_response.should be_ok
261
258
  last_response.body.should == [{:check => check, :downtime => down}].to_json
262
259
  end
@@ -271,7 +268,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
271
268
  Flapjack::Data::EntityCheck.should_receive(:for_entity).
272
269
  with(entity, check, :redis => redis).and_return(entity_check)
273
270
 
274
- get "/downtime/#{entity_name_esc}/#{check}"
271
+ aget "/downtime/#{entity_name_esc}/#{check}"
275
272
  last_response.should be_ok
276
273
  last_response.body.should == 'down!'.to_json
277
274
  end
@@ -289,7 +286,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
289
286
  Flapjack::Data::Event.should_receive(:test_notifications).
290
287
  with(entity_name, 'foo', hash_including(:redis => redis))
291
288
 
292
- post "/test_notifications/#{entity_name_esc}/foo"
289
+ apost "/test_notifications/#{entity_name_esc}/foo"
293
290
  last_response.status.should == 204
294
291
  end
295
292
 
@@ -308,7 +305,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
308
305
  Flapjack::Data::Entity.should_receive(:find_by_name).
309
306
  with(entity_name, :redis => redis).and_return(entity)
310
307
 
311
- get "/status", :entity => entity_name
308
+ aget "/status", :entity => entity_name
312
309
  last_response.body.should == result.to_json
313
310
  end
314
311
 
@@ -316,7 +313,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
316
313
  Flapjack::Data::Entity.should_receive(:find_by_name).
317
314
  with(entity_name, :redis => redis).and_return(nil)
318
315
 
319
- get "/status", :entity => entity_name
316
+ aget "/status", :entity => entity_name
320
317
  last_response.should be_forbidden
321
318
  end
322
319
 
@@ -334,7 +331,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
334
331
  Flapjack::Data::Entity.should_receive(:find_by_name).
335
332
  with(entity_name, :redis => redis).and_return(entity)
336
333
 
337
- get "/status", :check => {entity_name => check}
334
+ aget "/status", :check => {entity_name => check}
338
335
  last_response.should be_ok
339
336
  last_response.body.should == result.to_json
340
337
  end
@@ -343,7 +340,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
343
340
  Flapjack::Data::Entity.should_receive(:find_by_name).
344
341
  with(entity_name, :redis => redis).and_return(nil)
345
342
 
346
- get "/status", :check => {entity_name => check}
343
+ aget "/status", :check => {entity_name => check}
347
344
  last_response.should be_forbidden
348
345
  end
349
346
 
@@ -354,7 +351,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
354
351
  Flapjack::Data::EntityCheck.should_receive(:for_entity).
355
352
  with(entity, check, :redis => redis).and_return(nil)
356
353
 
357
- get "/status", :check => {entity_name => check}
354
+ aget "/status", :check => {entity_name => check}
358
355
  last_response.should be_forbidden
359
356
  end
360
357
 
@@ -370,7 +367,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
370
367
  Flapjack::Data::Event.should_receive(:create_acknowledgement).
371
368
  with(entity_name, check, :summary => nil, :duration => (4 * 60 * 60), :redis => redis)
372
369
 
373
- post '/acknowledgements',:check => {entity_name => check}
370
+ apost '/acknowledgements',:check => {entity_name => check}
374
371
  last_response.status.should == 204
375
372
  end
376
373
 
@@ -384,7 +381,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
384
381
  Flapjack::Data::Entity.should_receive(:find_by_name).
385
382
  with(entity_name, :redis => redis).and_return(entity)
386
383
 
387
- delete "/unscheduled_maintenances", :check => {entity_name => check}, :end_time => end_time.iso8601
384
+ adelete "/unscheduled_maintenances", :check => {entity_name => check}, :end_time => end_time.iso8601
388
385
  last_response.status.should == 204
389
386
  end
390
387
 
@@ -398,7 +395,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
398
395
  entity_check.should_receive(:create_scheduled_maintenance).
399
396
  with(start.getutc.to_i, duration, :summary => 'test')
400
397
 
401
- post "/scheduled_maintenances/#{entity_name_esc}/#{check}?" +
398
+ apost "/scheduled_maintenances/#{entity_name_esc}/#{check}?" +
402
399
  "start_time=#{CGI.escape(start.iso8601)}&summary=test&duration=#{duration}"
403
400
  last_response.status.should == 204
404
401
  end
@@ -406,7 +403,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
406
403
  it "doesn't create a scheduled maintenance period if the start time isn't passed" do
407
404
  duration = (2 * 60 * 60) # two hours
408
405
 
409
- post "/scheduled_maintenances/#{entity_name_esc}/#{check}?" +
406
+ apost "/scheduled_maintenances/#{entity_name_esc}/#{check}?" +
410
407
  "summary=test&duration=#{duration}"
411
408
  last_response.status.should == 403
412
409
  end
@@ -421,14 +418,14 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
421
418
  Flapjack::Data::Entity.should_receive(:find_by_name).
422
419
  with(entity_name, :redis => redis).and_return(entity)
423
420
 
424
- delete "/scheduled_maintenances", :check => {entity_name => check}, :start_time => start_time.iso8601
421
+ adelete "/scheduled_maintenances", :check => {entity_name => check}, :start_time => start_time.iso8601
425
422
  last_response.status.should == 204
426
423
  end
427
424
 
428
425
  it "doesn't delete a scheduled maintenance period if the start time isn't passed" do
429
426
  entity_check.should_not_receive(:end_scheduled_maintenance)
430
427
 
431
- delete "/scheduled_maintenances", :check => {entity_name => check}
428
+ adelete "/scheduled_maintenances", :check => {entity_name => check}
432
429
  last_response.status.should == 403
433
430
  end
434
431
 
@@ -448,7 +445,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
448
445
  Flapjack::Data::Entity.should_receive(:find_by_name).
449
446
  with(entity_name, :redis => redis).and_return(entity)
450
447
 
451
- delete "/scheduled_maintenances", :check => {entity_name => [check, 'foo']}, :start_time => start_time.iso8601
448
+ adelete "/scheduled_maintenances", :check => {entity_name => [check, 'foo']}, :start_time => start_time.iso8601
452
449
  last_response.status.should == 204
453
450
  end
454
451
 
@@ -464,7 +461,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
464
461
  Flapjack::Data::Entity.should_receive(:find_by_name).
465
462
  with(entity_name, :redis => redis).and_return(entity)
466
463
 
467
- get "/scheduled_maintenances", :entity => entity_name
464
+ aget "/scheduled_maintenances", :entity => entity_name
468
465
  last_response.should be_ok
469
466
  last_response.body.should == result.to_json
470
467
  end
@@ -484,7 +481,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
484
481
  Flapjack::Data::Entity.should_receive(:find_by_name).
485
482
  with(entity_name, :redis => redis).and_return(entity)
486
483
 
487
- get "/scheduled_maintenances", :entity => entity_name,
484
+ aget "/scheduled_maintenances", :entity => entity_name,
488
485
  :start_time => start.iso8601, :end_time => finish.iso8601
489
486
  last_response.should be_ok
490
487
  last_response.body.should == result.to_json
@@ -505,7 +502,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
505
502
  Flapjack::Data::Entity.should_receive(:find_by_name).
506
503
  with(entity_name, :redis => redis).and_return(entity)
507
504
 
508
- get "/scheduled_maintenances", :check => {entity_name => check}
505
+ aget "/scheduled_maintenances", :check => {entity_name => check}
509
506
  last_response.should be_ok
510
507
  last_response.body.should == result.to_json
511
508
  end
@@ -522,7 +519,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
522
519
  Flapjack::Data::Entity.should_receive(:find_by_name).
523
520
  with(entity_name, :redis => redis).and_return(entity)
524
521
 
525
- get "/unscheduled_maintenances", :entity => entity_name
522
+ aget "/unscheduled_maintenances", :entity => entity_name
526
523
  last_response.should be_ok
527
524
  last_response.body.should == result.to_json
528
525
  end
@@ -542,7 +539,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
542
539
  Flapjack::Data::Entity.should_receive(:find_by_name).
543
540
  with(entity_name, :redis => redis).and_return(entity)
544
541
 
545
- get "/unscheduled_maintenances", :check => {entity_name => check}
542
+ aget "/unscheduled_maintenances", :check => {entity_name => check}
546
543
  last_response.should be_ok
547
544
  last_response.body.should == result.to_json
548
545
  end
@@ -565,7 +562,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
565
562
  Flapjack::Data::Entity.should_receive(:find_by_name).
566
563
  with(entity_name, :redis => redis).and_return(entity)
567
564
 
568
- get "/unscheduled_maintenances", :check => {entity_name => check},
565
+ aget "/unscheduled_maintenances", :check => {entity_name => check},
569
566
  :start_time => start.iso8601, :end_time => finish.iso8601
570
567
  last_response.should be_ok
571
568
  last_response.body.should == result.to_json
@@ -611,7 +608,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
611
608
  Flapjack::Data::EntityCheck.should_receive(:for_entity).
612
609
  with(entity_2, 'bar', :redis => redis).and_return(bar_check)
613
610
 
614
- get "/outages", :entity => entity_name, :check => {entity_2_name => ['foo', 'bar']}
611
+ aget "/outages", :entity => entity_name, :check => {entity_2_name => ['foo', 'bar']}
615
612
  last_response.should be_ok
616
613
  last_response.body.should == result.to_json
617
614
  end
@@ -631,7 +628,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
631
628
  Flapjack::Data::Entity.should_receive(:find_by_name).
632
629
  with(entity_name, :redis => redis).and_return(entity)
633
630
 
634
- get "/outages", :check => {entity_name => check}
631
+ aget "/outages", :check => {entity_name => check}
635
632
  last_response.should be_ok
636
633
  last_response.body.should == result.to_json
637
634
  end
@@ -648,7 +645,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
648
645
  Flapjack::Data::Entity.should_receive(:find_by_name).
649
646
  with(entity_name, :redis => redis).and_return(entity)
650
647
 
651
- get "/downtime", :entity => entity_name
648
+ aget "/downtime", :entity => entity_name
652
649
  last_response.should be_ok
653
650
  last_response.body.should == result.to_json
654
651
  end
@@ -668,7 +665,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
668
665
  Flapjack::Data::Entity.should_receive(:find_by_name).
669
666
  with(entity_name, :redis => redis).and_return(entity)
670
667
 
671
- get "/downtime", :check => {entity_name => check}
668
+ aget "/downtime", :check => {entity_name => check}
672
669
  last_response.should be_ok
673
670
  last_response.body.should == result.to_json
674
671
  end
@@ -700,8 +697,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
700
697
  Flapjack::Data::Event.should_receive(:test_notifications).
701
698
  with(entity_name, 'foo', hash_including(:redis => redis))
702
699
 
703
-
704
- post '/test_notifications', :entity => entity_name
700
+ apost '/test_notifications', :entity => entity_name
705
701
  last_response.status.should == 204
706
702
  end
707
703
 
@@ -716,10 +712,9 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
716
712
  with(entity, check, :redis => redis).and_return(entity_check)
717
713
 
718
714
  Flapjack::Data::Event.should_receive(:test_notifications).
719
- with(entity_name, check, hash_including(:redis => redis))
720
-
715
+ with(entity_name, check, hash_including(:redis => redis))
721
716
 
722
- post '/test_notifications', :check => {entity_name => check}
717
+ apost '/test_notifications', :check => {entity_name => check}
723
718
  last_response.status.should == 204
724
719
  end
725
720
 
@@ -738,14 +733,14 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
738
733
  }
739
734
  Flapjack::Data::Entity.should_receive(:add).twice
740
735
 
741
- post "/entities", entities.to_json, {'CONTENT_TYPE' => 'application/json'}
736
+ apost "/entities", entities.to_json, {'CONTENT_TYPE' => 'application/json'}
742
737
  last_response.status.should == 204
743
738
  end
744
739
 
745
740
  it "does not create entities if the data is improperly formatted" do
746
741
  Flapjack::Data::Entity.should_not_receive(:add)
747
742
 
748
- post "/entities", {'entities' => ["Hello", "there"]}.to_json,
743
+ apost "/entities", {'entities' => ["Hello", "there"]}.to_json,
749
744
  {'CONTENT_TYPE' => 'application/json'}
750
745
  last_response.status.should == 403
751
746
  end
@@ -764,7 +759,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
764
759
  }
765
760
  Flapjack::Data::Entity.should_receive(:add)
766
761
 
767
- post "/entities", entities.to_json, {'CONTENT_TYPE' => 'application/json'}
762
+ apost "/entities", entities.to_json, {'CONTENT_TYPE' => 'application/json'}
768
763
  last_response.status.should == 403
769
764
  end
770
765
 
@@ -778,7 +773,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
778
773
  Flapjack::Data::Entity.should_receive(:find_by_name).
779
774
  with(entity_name, :redis => redis).and_return(entity)
780
775
 
781
- post "entities/#{entity_name}/tags", :tag => 'web'
776
+ apost "entities/#{entity_name}/tags", :tag => 'web'
782
777
  last_response.should be_ok
783
778
  last_response.body.should be_json_eql( ['web'].to_json )
784
779
  end
@@ -787,7 +782,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
787
782
  Flapjack::Data::Entity.should_receive(:find_by_name).
788
783
  with(entity_name, :redis => redis).and_return(nil)
789
784
 
790
- post "entities/#{entity_name}/tags", :tag => 'web'
785
+ apost "entities/#{entity_name}/tags", :tag => 'web'
791
786
  last_response.should be_forbidden
792
787
  end
793
788
 
@@ -798,7 +793,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
798
793
  with(entity_name, :redis => redis).and_return(entity)
799
794
 
800
795
  # NB submitted at a lower level as tag[]=web&tag[]=app
801
- post "entities/#{entity_name}/tags", :tag => ['web', 'app']
796
+ apost "entities/#{entity_name}/tags", :tag => ['web', 'app']
802
797
  last_response.should be_ok
803
798
  last_response.body.should be_json_eql( ['web', 'app'].to_json )
804
799
  end
@@ -807,7 +802,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
807
802
  Flapjack::Data::Entity.should_receive(:find_by_name).
808
803
  with(entity_name, :redis => redis).and_return(nil)
809
804
 
810
- post "entities/#{entity_name}/tags", :tag => ['web', 'app']
805
+ apost "entities/#{entity_name}/tags", :tag => ['web', 'app']
811
806
  last_response.should be_forbidden
812
807
  end
813
808
 
@@ -816,7 +811,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
816
811
  Flapjack::Data::Entity.should_receive(:find_by_name).
817
812
  with(entity_name, :redis => redis).and_return(entity)
818
813
 
819
- delete "entities/#{entity_name}/tags", :tag => 'web'
814
+ adelete "entities/#{entity_name}/tags", :tag => 'web'
820
815
  last_response.status.should == 204
821
816
  end
822
817
 
@@ -824,7 +819,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
824
819
  Flapjack::Data::Entity.should_receive(:find_by_name).
825
820
  with(entity_name, :redis => redis).and_return(nil)
826
821
 
827
- delete "entities/#{entity_name}/tags", :tag => 'web'
822
+ adelete "entities/#{entity_name}/tags", :tag => 'web'
828
823
  last_response.should be_forbidden
829
824
  end
830
825
 
@@ -833,7 +828,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
833
828
  Flapjack::Data::Entity.should_receive(:find_by_name).
834
829
  with(entity_name, :redis => redis).and_return(entity)
835
830
 
836
- delete "entities/#{entity_name}/tags", :tag => ['web', 'app']
831
+ adelete "entities/#{entity_name}/tags", :tag => ['web', 'app']
837
832
  last_response.status.should == 204
838
833
  end
839
834
 
@@ -841,7 +836,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
841
836
  Flapjack::Data::Entity.should_receive(:find_by_name).
842
837
  with(entity_name, :redis => redis).and_return(nil)
843
838
 
844
- delete "entities/#{entity_name}/tags", :tag => ['web', 'app']
839
+ adelete "entities/#{entity_name}/tags", :tag => ['web', 'app']
845
840
  last_response.should be_forbidden
846
841
  end
847
842
 
@@ -850,7 +845,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
850
845
  Flapjack::Data::Entity.should_receive(:find_by_name).
851
846
  with(entity_name, :redis => redis).and_return(entity)
852
847
 
853
- get "entities/#{entity_name}/tags"
848
+ aget "entities/#{entity_name}/tags"
854
849
  last_response.should be_ok
855
850
  last_response.body.should be_json_eql( ['web', 'app'].to_json )
856
851
  end
@@ -859,7 +854,7 @@ describe 'Flapjack::Gateways::API::EntityMethods', :sinatra => true, :logger =>
859
854
  Flapjack::Data::Entity.should_receive(:find_by_name).
860
855
  with(entity_name, :redis => redis).and_return(nil)
861
856
 
862
- get "entities/#{entity_name}/tags"
857
+ aget "entities/#{entity_name}/tags"
863
858
  last_response.should be_forbidden
864
859
  end
865
860