sugarcube 2.4.1 → 2.4.2

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.
@@ -7,20 +7,20 @@ describe UIActionSheet do
7
7
 
8
8
  it 'should have :show option (show: false)' do
9
9
  alert = UIActionSheet.alert('test', show: false)
10
- proper_wait 0.6
10
+ proper_wait 0.5
11
11
  alert.visible?.should == false
12
12
  end
13
13
 
14
14
  it 'should have :show option (show: true)' do
15
15
  alert = UIActionSheet.alert('test', show: true)
16
- proper_wait 0.6
16
+ proper_wait 0.5
17
17
  alert.visible?.should == true
18
18
  alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
19
19
  end
20
20
 
21
21
  it 'should show by default' do
22
22
  alert = UIActionSheet.alert('test')
23
- proper_wait 0.6
23
+ proper_wait 0.5
24
24
  alert.visible?.should == true
25
25
  alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
26
26
  end
@@ -56,7 +56,7 @@ describe UIActionSheet do
56
56
 
57
57
  it 'should have :from option that accepts CGRect' do
58
58
  alert = UIActionSheet.alert('test', from: CGRect.new([0, 0], [320, 0]))
59
- proper_wait 0.6
59
+ proper_wait 0.5
60
60
  alert.visible?.should == true
61
61
  alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
62
62
  end
@@ -66,7 +66,7 @@ describe UIActionSheet do
66
66
  window = UIApplication.sharedApplication.windows[0]
67
67
  window << view
68
68
  alert = UIActionSheet.alert('test', from: CGRect.new([0, 0], [320, 0]), view: view)
69
- proper_wait 0.6
69
+ proper_wait 0.5
70
70
  alert.visible?.should == true
71
71
  alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
72
72
  end
@@ -78,7 +78,7 @@ describe UIActionSheet do
78
78
  window = UIApplication.sharedApplication.windows[0]
79
79
  window << toolbar
80
80
  alert = UIActionSheet.alert('test', from: button)
81
- proper_wait 0.6
81
+ proper_wait 0.5
82
82
  alert.visible?.should == true
83
83
  alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
84
84
  end
@@ -88,7 +88,7 @@ describe UIActionSheet do
88
88
  window = UIApplication.sharedApplication.windows[0]
89
89
  window << view
90
90
  alert = UIActionSheet.alert('test', from: view)
91
- proper_wait 0.6
91
+ proper_wait 0.5
92
92
  alert.visible?.should == true
93
93
  alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
94
94
  end
@@ -98,7 +98,7 @@ describe UIActionSheet do
98
98
  window = UIApplication.sharedApplication.windows[0]
99
99
  window << view
100
100
  alert = UIActionSheet.alert('test', from: view)
101
- proper_wait 0.6
101
+ proper_wait 0.5
102
102
  alert.visible?.should == true
103
103
  alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
104
104
  end
@@ -108,7 +108,7 @@ describe UIActionSheet do
108
108
  window = UIApplication.sharedApplication.windows[0]
109
109
  window << view
110
110
  alert = UIActionSheet.alert('test', from: view)
111
- proper_wait 0.6
111
+ proper_wait 0.5
112
112
  alert.visible?.should == true
113
113
  alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
114
114
  end
@@ -129,15 +129,17 @@ describe UIActionSheet do
129
129
 
130
130
  it 'should call block when pressed' do
131
131
  alert = UIActionSheet.alert('test') { @touched = true }
132
- proper_wait 0.6
132
+ proper_wait 0.5
133
133
  alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
134
+ proper_wait 0.5
134
135
  @touched.should == true
135
136
  end
136
137
 
137
138
  it 'should call block with "OK" pressed' do
138
139
  alert = UIActionSheet.alert('test') { |button, index| @touched, @touched_index = button, index }
139
- proper_wait 0.6
140
+ proper_wait 0.5
140
141
  alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
142
+ proper_wait 0.5
141
143
  @touched.should == 'OK'
142
144
  end
143
145
 
@@ -147,24 +149,27 @@ describe UIActionSheet do
147
149
  @touched = nil
148
150
  @touched_index = nil
149
151
  @alert = UIActionSheet.alert('test', buttons: ['cancel', 'destructive', 'ok']) { |button, index| @touched, @touched_index = button, index }
150
- proper_wait 0.6
152
+ proper_wait 0.5
151
153
  end
152
154
 
153
155
  it 'should call block with "cancel" when cancel button is pressed' do
154
156
  @alert.cancelButtonIndex.should == 2
155
157
  @alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false)
158
+ proper_wait 0.5
156
159
  @touched.should == 'cancel'
157
160
  end
158
161
 
159
162
  it 'should call block with "destructive" when destructive button is pressed' do
160
163
  @alert.destructiveButtonIndex.should == 0
161
164
  @alert.dismissWithClickedButtonIndex(@alert.destructiveButtonIndex, animated: false)
165
+ proper_wait 0.5
162
166
  @touched.should == 'destructive'
163
167
  end
164
168
 
165
169
  it 'should call block with "ok" when other button is pressed' do
166
170
  @alert.firstOtherButtonIndex.should == 1
167
171
  @alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex, animated: false)
172
+ proper_wait 0.5
168
173
  @touched.should == 'ok'
169
174
  end
170
175
 
@@ -176,7 +181,7 @@ describe UIActionSheet do
176
181
  @touched = nil
177
182
  @touched_index = nil
178
183
  @alert = UIActionSheet.alert('test', buttons: ['cancel', 'destructive']) { |button, index| @touched, @touched_index = button, index }
179
- proper_wait 0.6
184
+ proper_wait 0.5
180
185
  end
181
186
 
182
187
  after do
@@ -186,6 +191,7 @@ describe UIActionSheet do
186
191
  it 'should call block with "cancel" when cancel button is pressed' do
187
192
  @alert.cancelButtonIndex.should == 1
188
193
  @alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false)
194
+ proper_wait 0.5
189
195
  @touched.should == 'cancel'
190
196
  @touched_index.should == @alert.cancelButtonIndex
191
197
  end
@@ -193,6 +199,7 @@ describe UIActionSheet do
193
199
  it 'should call block with "destructive" when destructive button is pressed' do
194
200
  @alert.destructiveButtonIndex.should == 0
195
201
  @alert.dismissWithClickedButtonIndex(@alert.destructiveButtonIndex, animated: false)
202
+ proper_wait 0.5
196
203
  @touched.should == 'destructive'
197
204
  @touched_index.should == @alert.destructiveButtonIndex
198
205
  end
@@ -209,7 +216,7 @@ describe UIActionSheet do
209
216
  @touched = nil
210
217
  @touched_index = nil
211
218
  @alert = UIActionSheet.alert('test', buttons: ['cancel', nil, 'ok']) { |button, index| @touched, @touched_index = button, index }
212
- proper_wait 0.6
219
+ proper_wait 0.5
213
220
  end
214
221
 
215
222
  after do
@@ -219,6 +226,7 @@ describe UIActionSheet do
219
226
  it 'should call block with "cancel" when cancel button is pressed' do
220
227
  @alert.cancelButtonIndex.should == 1
221
228
  @alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false)
229
+ proper_wait 0.5
222
230
  @touched.should == 'cancel'
223
231
  @touched_index.should == @alert.cancelButtonIndex
224
232
  end
@@ -230,6 +238,7 @@ describe UIActionSheet do
230
238
  it 'should call block with "ok" when other button is pressed' do
231
239
  @alert.firstOtherButtonIndex.should == 0
232
240
  @alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex, animated: false)
241
+ proper_wait 0.5
233
242
  @touched.should == 'ok'
234
243
  @touched_index.should == @alert.firstOtherButtonIndex
235
244
  end
@@ -242,7 +251,7 @@ describe UIActionSheet do
242
251
  @touched = nil
243
252
  @touched_index = nil
244
253
  @alert = UIActionSheet.alert('test', buttons: [nil, 'destructive', 'ok']) { |button, index| @touched, @touched_index = button, index }
245
- proper_wait 0.6
254
+ proper_wait 0.5
246
255
  end
247
256
 
248
257
  after do
@@ -256,6 +265,7 @@ describe UIActionSheet do
256
265
  it 'should call block with "destructive" when destructive button is pressed' do
257
266
  @alert.destructiveButtonIndex.should == 0
258
267
  @alert.dismissWithClickedButtonIndex(@alert.destructiveButtonIndex, animated: false)
268
+ proper_wait 0.5
259
269
  @touched.should == 'destructive'
260
270
  @touched_index.should == @alert.destructiveButtonIndex
261
271
  end
@@ -263,6 +273,7 @@ describe UIActionSheet do
263
273
  it 'should call block with "ok" when other button is pressed' do
264
274
  @alert.firstOtherButtonIndex.should == 1
265
275
  @alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex, animated: false)
276
+ proper_wait 0.5
266
277
  @touched.should == 'ok'
267
278
  @touched_index.should == @alert.firstOtherButtonIndex
268
279
  end
@@ -275,7 +286,7 @@ describe UIActionSheet do
275
286
  @touched = nil
276
287
  @touched_index = nil
277
288
  @alert = UIActionSheet.alert('test', buttons: [nil, nil, 'test1', 'test2']) { |button, index| @touched, @touched_index = button, index }
278
- proper_wait 0.6
289
+ proper_wait 0.5
279
290
  end
280
291
 
281
292
  after do
@@ -293,12 +304,14 @@ describe UIActionSheet do
293
304
  it 'should call block with "test1" when first button is pressed' do
294
305
  @alert.firstOtherButtonIndex.should == 0
295
306
  @alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex, animated: false)
307
+ proper_wait 0.5
296
308
  @touched.should == 'test1'
297
309
  @touched_index.should == @alert.firstOtherButtonIndex
298
310
  end
299
311
 
300
312
  it 'should call block with "test2" when second button is pressed' do
301
313
  @alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex + 1, animated: false)
314
+ proper_wait 0.5
302
315
  @touched.should == 'test2'
303
316
  @touched_index.should == @alert.firstOtherButtonIndex + 1
304
317
  end
@@ -317,16 +330,13 @@ describe UIActionSheet do
317
330
  test1: 'Test1',
318
331
  test2: 'Test2',
319
332
  }) { |button, index| @touched, @touched_index = button, index }
320
- proper_wait 0.6
321
- end
322
-
323
- after do
324
- # @alert.dismissWithClickedButtonIndex(-1, animated: false) if @alert.visible?
333
+ proper_wait 0.5
325
334
  end
326
335
 
327
336
  it 'should call block with :destructive when cancel button is pressed' do
328
337
  @alert.destructiveButtonIndex.should == 0
329
338
  @alert.dismissWithClickedButtonIndex(@alert.destructiveButtonIndex, animated: false)
339
+ proper_wait 0.5
330
340
  @touched.should == :destructive
331
341
  @touched_index.should == @alert.destructiveButtonIndex
332
342
  end
@@ -334,6 +344,7 @@ describe UIActionSheet do
334
344
  it 'should call block with :cancel when cancel button is pressed' do
335
345
  @alert.cancelButtonIndex.should == 3
336
346
  @alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false)
347
+ proper_wait 0.5
337
348
  @touched.should == :cancel
338
349
  @touched_index.should == @alert.cancelButtonIndex
339
350
  end
@@ -341,12 +352,14 @@ describe UIActionSheet do
341
352
  it 'should call block with :test1 when first button is pressed' do
342
353
  @alert.firstOtherButtonIndex.should == 1
343
354
  @alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex, animated: false)
355
+ proper_wait 0.5
344
356
  @touched.should == :test1
345
357
  @touched_index.should == @alert.firstOtherButtonIndex
346
358
  end
347
359
 
348
360
  it 'should call block with :test2 when second button is pressed' do
349
361
  @alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex + 1, animated: false)
362
+ proper_wait 0.5
350
363
  @touched.should == :test2
351
364
  @touched_index.should == @alert.firstOtherButtonIndex + 1
352
365
  end
@@ -364,30 +377,34 @@ describe UIActionSheet do
364
377
  destructive: ->{ @touched = :destructive },
365
378
  success: ->(button, index){ @touched, @touched_index = button, index },
366
379
  )
367
- proper_wait 0.6
380
+ proper_wait 0.5
368
381
  end
369
382
 
370
383
  it 'should call block with :cancel when cancel button is pressed' do
371
384
  @alert.cancelButtonIndex.should == 3
372
385
  @alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false)
386
+ proper_wait 0.5
373
387
  @touched.should == :cancel
374
388
  end
375
389
 
376
390
  it 'should call block with :destructive when destructive button is pressed' do
377
391
  @alert.destructiveButtonIndex.should == 0
378
392
  @alert.dismissWithClickedButtonIndex(@alert.destructiveButtonIndex, animated: false)
393
+ proper_wait 0.5
379
394
  @touched.should == :destructive
380
395
  end
381
396
 
382
397
  it 'should call block with "test1" when first button is pressed' do
383
398
  @alert.firstOtherButtonIndex.should == 1
384
399
  @alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex, animated: false)
400
+ proper_wait 0.5
385
401
  @touched.should == 'test1'
386
402
  @touched_index.should == @alert.firstOtherButtonIndex
387
403
  end
388
404
 
389
405
  it 'should call block with "test2" when second button is pressed' do
390
406
  @alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex + 1, animated: false)
407
+ proper_wait 0.5
391
408
  @touched.should == 'test2'
392
409
  @touched_index.should == @alert.firstOtherButtonIndex + 1
393
410
  end
@@ -405,30 +422,34 @@ describe UIActionSheet do
405
422
  destructive: ->{ @touched = :destructive },
406
423
  success: ->(button, index){ @touched, @touched_index = button, index },
407
424
  )
408
- proper_wait 0.6
425
+ proper_wait 0.5
409
426
  end
410
427
 
411
428
  it 'should call block with :cancel when cancel button is pressed' do
412
429
  @alert.cancelButtonIndex.should == 3
413
430
  @alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false)
431
+ proper_wait 0.5
414
432
  @touched.should == :cancel
415
433
  end
416
434
 
417
435
  it 'should call block with :destructive when destructive button is pressed' do
418
436
  @alert.destructiveButtonIndex.should == 0
419
437
  @alert.dismissWithClickedButtonIndex(@alert.destructiveButtonIndex, animated: false)
438
+ proper_wait 0.5
420
439
  @touched.should == :destructive
421
440
  end
422
441
 
423
442
  it 'should call block with "test1" when first button is pressed' do
424
443
  @alert.firstOtherButtonIndex.should == 1
425
444
  @alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex, animated: false)
445
+ proper_wait 0.5
426
446
  @touched.should == :test1
427
447
  @touched_index.should == @alert.firstOtherButtonIndex
428
448
  end
429
449
 
430
450
  it 'should call block with "test2" when second button is pressed' do
431
451
  @alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex + 1, animated: false)
452
+ proper_wait 0.5
432
453
  @touched.should == :test2
433
454
  @touched_index.should == @alert.firstOtherButtonIndex + 1
434
455
  end
@@ -444,30 +465,34 @@ describe UIActionSheet do
444
465
  buttons: ['cancel', 'destructive', 'test1', 'test2'],
445
466
  success: ->(button, index){ @touched, @touched_index = button, index },
446
467
  )
447
- proper_wait 0.6
468
+ proper_wait 0.5
448
469
  end
449
470
 
450
471
  it 'should not call block when cancel button is pressed' do
451
472
  @alert.cancelButtonIndex.should == 3
452
473
  @alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false)
474
+ proper_wait 0.5
453
475
  @touched.should == nil
454
476
  end
455
477
 
456
478
  it 'should not call block when destructive button is pressed' do
457
479
  @alert.destructiveButtonIndex.should == 0
458
480
  @alert.dismissWithClickedButtonIndex(@alert.destructiveButtonIndex, animated: false)
481
+ proper_wait 0.5
459
482
  @touched.should == nil
460
483
  end
461
484
 
462
485
  it 'should call block with "test1" when first button is pressed' do
463
486
  @alert.firstOtherButtonIndex.should == 1
464
487
  @alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex, animated: false)
488
+ proper_wait 0.5
465
489
  @touched.should == 'test1'
466
490
  @touched_index.should == @alert.firstOtherButtonIndex
467
491
  end
468
492
 
469
493
  it 'should call block with "test2" when second button is pressed' do
470
494
  @alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex + 1, animated: false)
495
+ proper_wait 0.5
471
496
  @touched.should == 'test2'
472
497
  @touched_index.should == @alert.firstOtherButtonIndex + 1
473
498
  end
@@ -1,130 +1,132 @@
1
- describe UIAlertController do
2
- tests UIViewController
3
-
4
- it 'should have :show option (show: false)' do
5
- alert = UIAlertController.alert(controller, 'test', show: false)
6
- wait 0.6 do
7
- alert.presentingViewController.should == nil
1
+ if defined?(UIAlertControllerStyleAlert)
2
+ describe UIAlertController do
3
+ tests UIViewController
4
+
5
+ it 'should have :show option (show: false)' do
6
+ alert = UIAlertController.alert(controller, 'test', show: false)
7
+ wait 0.6 do
8
+ alert.presentingViewController.should == nil
9
+ end
8
10
  end
9
- end
10
11
 
11
- it 'should show by default' do
12
- alert = UIAlertController.alert(controller, 'test')
13
- wait 0.6 do
14
- alert.presentingViewController.should == controller
15
- controller.dismissViewControllerAnimated(false, completion: nil)
12
+ it 'should show by default' do
13
+ alert = UIAlertController.alert(controller, 'test')
14
+ wait 0.6 do
15
+ alert.presentingViewController.should == controller
16
+ controller.dismissViewControllerAnimated(false, completion: nil)
17
+ end
16
18
  end
17
- end
18
19
 
19
- it 'should assign the title' do
20
- alert = UIAlertController.alert(controller, 'test title', show: false)
21
- alert.title.should == 'test title'
22
- wait 0.001 do
23
- controller.dismissViewControllerAnimated(false, completion: nil)
20
+ it 'should assign the title' do
21
+ alert = UIAlertController.alert(controller, 'test title', show: false)
22
+ alert.title.should == 'test title'
23
+ wait 0.001 do
24
+ controller.dismissViewControllerAnimated(false, completion: nil)
25
+ end
24
26
  end
25
- end
26
27
 
27
- it 'should assign the title by options' do
28
- alert = UIAlertController.alert(controller, title: 'test title', show: false)
29
- alert.title.should == 'test title'
30
- wait 0.001 do
31
- controller.dismissViewControllerAnimated(false, completion: nil)
28
+ it 'should assign the title by options' do
29
+ alert = UIAlertController.alert(controller, title: 'test title', show: false)
30
+ alert.title.should == 'test title'
31
+ wait 0.001 do
32
+ controller.dismissViewControllerAnimated(false, completion: nil)
33
+ end
32
34
  end
33
- end
34
35
 
35
- it 'should have :style option' do
36
- Symbol.uialertcontrollerstyle.each do |style, value|
37
- # as symbol
38
- alert = UIAlertController.alert(controller, 'test', show: false, style: style)
39
- alert.preferredStyle.should == value
36
+ it 'should have :style option' do
37
+ Symbol.uialertcontrollerstyle.each do |style, value|
38
+ # as symbol
39
+ alert = UIAlertController.alert(controller, 'test', show: false, style: style)
40
+ alert.preferredStyle.should == value
40
41
 
41
- # as constant
42
- alert = UIAlertController.alert(controller, 'test', show: false, style: value)
43
- alert.preferredStyle.should == value
42
+ # as constant
43
+ alert = UIAlertController.alert(controller, 'test', show: false, style: value)
44
+ alert.preferredStyle.should == value
45
+ end
44
46
  end
45
- end
46
47
 
47
- it 'should have :from option that accepts CGRect' do
48
- alert = UIAlertController.alert(controller, 'test', from: CGRect.new([0, 0], [320, 0]))
49
- wait 0.6 do
50
- alert.presentingViewController.should == controller
51
- controller.dismissViewControllerAnimated(false, completion: nil)
48
+ it 'should have :from option that accepts CGRect' do
49
+ alert = UIAlertController.alert(controller, 'test', from: CGRect.new([0, 0], [320, 0]))
50
+ wait 0.6 do
51
+ alert.presentingViewController.should == controller
52
+ controller.dismissViewControllerAnimated(false, completion: nil)
53
+ end
52
54
  end
53
- end
54
55
 
55
56
 
56
- it 'should have :from option that accepts CGRect and a :view that accepts UIView' do
57
- view = UIView.alloc.initWithFrame(UIScreen.mainScreen.bounds)
58
- window = UIApplication.sharedApplication.windows[0]
59
- window << view
60
- alert = UIAlertController.alert(controller, 'test', from: CGRect.new([0, 0], [320, 0]), view: view)
61
- wait 0.6 do
62
- alert.presentingViewController.should == controller
63
- controller.dismissViewControllerAnimated(false, completion: nil)
57
+ it 'should have :from option that accepts CGRect and a :view that accepts UIView' do
58
+ view = UIView.alloc.initWithFrame(UIScreen.mainScreen.bounds)
59
+ window = UIApplication.sharedApplication.windows[0]
60
+ window << view
61
+ alert = UIAlertController.alert(controller, 'test', from: CGRect.new([0, 0], [320, 0]), view: view)
62
+ wait 0.6 do
63
+ alert.presentingViewController.should == controller
64
+ controller.dismissViewControllerAnimated(false, completion: nil)
65
+ end
64
66
  end
65
- end
66
67
 
67
- it 'should have :from option that accepts UIBarButtonItem' do
68
- button = UIBarButtonItem.done
69
- toolbar = UIToolbar.alloc.initWithFrame(UIScreen.mainScreen.bounds)
70
- toolbar.items = [button]
71
- window = UIApplication.sharedApplication.windows[0]
72
- window << toolbar
73
- alert = UIAlertController.alert(controller, 'test', from: button)
74
- wait 0.6 do
75
- alert.presentingViewController.should == controller
76
- controller.dismissViewControllerAnimated(false, completion: nil)
68
+ it 'should have :from option that accepts UIBarButtonItem' do
69
+ button = UIBarButtonItem.done
70
+ toolbar = UIToolbar.alloc.initWithFrame(UIScreen.mainScreen.bounds)
71
+ toolbar.items = [button]
72
+ window = UIApplication.sharedApplication.windows[0]
73
+ window << toolbar
74
+ alert = UIAlertController.alert(controller, 'test', from: button)
75
+ wait 0.6 do
76
+ alert.presentingViewController.should == controller
77
+ controller.dismissViewControllerAnimated(false, completion: nil)
78
+ end
77
79
  end
78
- end
79
80
 
80
- it 'should have :from option that accepts UIView' do
81
- view = UIView.alloc.initWithFrame(UIScreen.mainScreen.bounds)
82
- window = UIApplication.sharedApplication.windows[0]
83
- window << view
84
- alert = UIAlertController.alert(controller, 'test', from: view)
85
- wait 0.6 do
86
- alert.presentingViewController.should == controller
87
- controller.dismissViewControllerAnimated(false, completion: nil)
81
+ it 'should have :from option that accepts UIView' do
82
+ view = UIView.alloc.initWithFrame(UIScreen.mainScreen.bounds)
83
+ window = UIApplication.sharedApplication.windows[0]
84
+ window << view
85
+ alert = UIAlertController.alert(controller, 'test', from: view)
86
+ wait 0.6 do
87
+ alert.presentingViewController.should == controller
88
+ controller.dismissViewControllerAnimated(false, completion: nil)
89
+ end
88
90
  end
89
- end
90
91
 
91
- it 'should add a button with << method' do
92
- alert = UIAlertController.alert(controller, 'test', show: false)
93
- alert << 'title'
94
- alert.actions.lastObject.title.should == 'title'
95
- end
92
+ it 'should add a button with << method' do
93
+ alert = UIAlertController.alert(controller, 'test', show: false)
94
+ alert << 'title'
95
+ alert.actions.lastObject.title.should == 'title'
96
+ end
96
97
 
97
- it 'should show "OK" by default as first button' do
98
- alert = UIAlertController.alert(controller, 'test', show: false)
99
- alert.actions[0].title.should == 'OK'
100
- end
98
+ it 'should show "OK" by default as first button' do
99
+ alert = UIAlertController.alert(controller, 'test', show: false)
100
+ alert.actions[0].title.should == 'OK'
101
+ end
101
102
 
102
- it 'should show "Cancel" by default as second button' do
103
- alert = UIAlertController.alert(controller, 'test', show: false)
104
- alert.actions[1].title.should == 'Cancel'
105
- end
103
+ it 'should show "Cancel" by default as second button' do
104
+ alert = UIAlertController.alert(controller, 'test', show: false)
105
+ alert.actions[1].title.should == 'Cancel'
106
+ end
106
107
 
107
- it 'should have :buttons option' do
108
- alert = UIAlertController.alert(controller, 'test', :buttons => %w(Hello World From Test), show: false)
109
- alert.actions.count.should == 4
110
- end
108
+ it 'should have :buttons option' do
109
+ alert = UIAlertController.alert(controller, 'test', :buttons => %w(Hello World From Test), show: false)
110
+ alert.actions.count.should == 4
111
+ end
111
112
 
112
- it 'should support Hash for :buttons option' do
113
- alert = UIAlertController.alert(controller, 'test', :buttons => {
114
- cancel: 'Nevermind',
115
- ok: 'OK',
116
- destructive: 'Do eet',
117
- other: 'Other',
118
- }, show: false)
119
- alert.actions.count.should == 4
120
- alert.actions[0].title.should == 'Nevermind'
121
- alert.actions[0].style.should == UIAlertActionStyleCancel
122
- alert.actions[1].title.should == 'OK'
123
- alert.actions[1].style.should == UIAlertActionStyleDefault
124
- alert.actions[2].title.should == 'Do eet'
125
- alert.actions[2].style.should == UIAlertActionStyleDestructive
126
- alert.actions[3].title.should == 'Other'
127
- alert.actions[3].style.should == UIAlertActionStyleDefault
128
- end
113
+ it 'should support Hash for :buttons option' do
114
+ alert = UIAlertController.alert(controller, 'test', :buttons => {
115
+ cancel: 'Nevermind',
116
+ ok: 'OK',
117
+ destructive: 'Do eet',
118
+ other: 'Other',
119
+ }, show: false)
120
+ alert.actions.count.should == 4
121
+ alert.actions[0].title.should == 'Nevermind'
122
+ alert.actions[0].style.should == UIAlertActionStyleCancel
123
+ alert.actions[1].title.should == 'OK'
124
+ alert.actions[1].style.should == UIAlertActionStyleDefault
125
+ alert.actions[2].title.should == 'Do eet'
126
+ alert.actions[2].style.should == UIAlertActionStyleDestructive
127
+ alert.actions[3].title.should == 'Other'
128
+ alert.actions[3].style.should == UIAlertActionStyleDefault
129
+ end
129
130
 
131
+ end
130
132
  end