motion-kit 0.11.2 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -12
  3. data/lib/motion-kit-cocoa/constraints/{constraints_layout.rb → constraints_helpers.rb} +2 -2
  4. data/lib/motion-kit-cocoa/layouts/{cagradientlayer_layout.rb → cagradientlayer_helpers.rb} +3 -3
  5. data/lib/motion-kit-cocoa/layouts/{calayer_layout.rb → calayer_helpers.rb} +2 -2
  6. data/lib/motion-kit-cocoa/layouts/sugarcube_compat.rb +1 -1
  7. data/lib/motion-kit-ios/deprecated.rb +31 -0
  8. data/lib/motion-kit-ios/layouts/{constraints_layout.rb → constraints_helpers.rb} +2 -2
  9. data/lib/motion-kit-ios/layouts/{uibutton_layout.rb → uibutton_helpers.rb} +3 -3
  10. data/lib/motion-kit-ios/layouts/{uiview_layout.rb → uiview_helpers.rb} +2 -2
  11. data/lib/motion-kit-ios/layouts/uiview_layout_autoresizing.rb +2 -2
  12. data/lib/motion-kit-ios/layouts/uiview_layout_constraints.rb +2 -2
  13. data/lib/motion-kit-ios/layouts/uiview_layout_frame.rb +2 -2
  14. data/lib/motion-kit-ios/layouts/uiview_layout_gradient.rb +2 -2
  15. data/lib/motion-kit-osx/deprecated.rb +52 -0
  16. data/lib/motion-kit-osx/layouts/{constraints_layout.rb → constraints_helpers.rb} +2 -2
  17. data/lib/motion-kit-osx/layouts/nsmenu_extensions.rb +2 -2
  18. data/lib/motion-kit-osx/layouts/{nsmenu_layout.rb → nsmenu_helpers.rb} +2 -2
  19. data/lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb +2 -2
  20. data/lib/motion-kit-osx/layouts/{nstablecolumn_layout.rb → nstablecolumn_helpers.rb} +2 -2
  21. data/lib/motion-kit-osx/layouts/{nstableview_layout.rb → nstableview_helpers.rb} +3 -3
  22. data/lib/motion-kit-osx/layouts/{nsview_layout.rb → nsview_helpers.rb} +2 -2
  23. data/lib/motion-kit-osx/layouts/nsview_layout_autoresizing.rb +2 -2
  24. data/lib/motion-kit-osx/layouts/nsview_layout_constraints.rb +2 -2
  25. data/lib/motion-kit-osx/layouts/nsview_layout_frame.rb +2 -2
  26. data/lib/motion-kit-osx/layouts/nswindow_frame.rb +2 -2
  27. data/lib/motion-kit-osx/layouts/{nswindow_layout.rb → nswindow_helpers.rb} +2 -2
  28. data/lib/motion-kit/layouts/base_layout.rb +1 -1
  29. data/lib/motion-kit/version.rb +1 -1
  30. data/spec/ios/layer_layout_spec.rb +3 -3
  31. data/spec/ios/layout_extensions_spec.rb +1 -1
  32. data/spec/osx/constraints_helpers/simple_constraints_spec.rb +166 -159
  33. data/spec/osx/menu_extensions_spec.rb +2 -2
  34. data/spec/osx/{constraints_helpers/table_view_spec.rb → table_view_spec.rb} +1 -1
  35. metadata +17 -17
  36. data/spec/osx/constraints_helper_spec.rb +0 -0
@@ -1,3 +1,3 @@
1
1
  module MotionKit
2
- VERSION = '0.11.2'
2
+ VERSION = '0.12.0'
3
3
  end
@@ -1,6 +1,6 @@
1
- describe TestLayerLayout do
1
+ describe TestLayerHelpers do
2
2
  before do
3
- @subject = TestLayerLayout.new
3
+ @subject = TestLayerHelpers.new
4
4
  end
5
5
 
6
6
  it 'should create a CALayer root' do
@@ -13,7 +13,7 @@ describe TestLayerLayout do
13
13
 
14
14
  describe 'should have styled sublayers' do
15
15
  before do
16
- @subject = TestLayerLayout.new
16
+ @subject = TestLayerHelpers.new
17
17
  end
18
18
 
19
19
  it 'should have a CALayer' do
@@ -1,7 +1,7 @@
1
1
  describe "Layout extensions - iOS" do
2
2
 
3
3
  before do
4
- @subject = MK::UIViewLayout.new
4
+ @subject = MK::UIViewHelpers.new
5
5
  @subject.instance_variable_set(:@context, "don't matter what i be, as long as i be.")
6
6
  end
7
7
 
@@ -1,13 +1,20 @@
1
1
  describe 'Constraints helpers' do
2
2
 
3
3
  before do
4
- @layout = MK::Layout.new
4
+ @parent_view = NSView.new
5
+ @layout = MK::Layout.new(root: @parent_view)
6
+ @view = NSView.new
7
+ @parent_view.addSubview(@view)
8
+ @another_view = NSView.new
9
+ @layout.context(@parent_view) do
10
+ @layout.add(@another_view, :another_view)
11
+ end
5
12
  @constraint = nil
6
13
  end
7
14
 
8
15
  describe '`x/left` support' do
9
16
  it 'should support `x 10`' do
10
- @layout.context(NSView.new) do
17
+ @layout.context(@view) do
11
18
  @layout.constraints do
12
19
  @constraint = @layout.x(10)
13
20
  end
@@ -20,7 +27,7 @@ describe 'Constraints helpers' do
20
27
  @constraint.attribute2.should == :left
21
28
  end
22
29
  it 'should support `min_x 10`' do
23
- @layout.context(NSView.new) do
30
+ @layout.context(@view) do
24
31
  @layout.constraints do
25
32
  @constraint = @layout.min_x(10)
26
33
  end
@@ -33,7 +40,7 @@ describe 'Constraints helpers' do
33
40
  @constraint.attribute2.should == :left
34
41
  end
35
42
  it 'should support `max_x 10`' do
36
- @layout.context(NSView.new) do
43
+ @layout.context(@view) do
37
44
  @layout.constraints do
38
45
  @constraint = @layout.max_x(10)
39
46
  end
@@ -46,7 +53,7 @@ describe 'Constraints helpers' do
46
53
  @constraint.attribute2.should == :left
47
54
  end
48
55
  it 'should support `x.equals(:another_view[, :left])`' do
49
- @layout.context(NSView.new) do
56
+ @layout.context(@view) do
50
57
  @layout.constraints do
51
58
  @constraint = @layout.x.equals(:another_view)
52
59
  end
@@ -59,7 +66,7 @@ describe 'Constraints helpers' do
59
66
  @constraint.attribute2.should == :left
60
67
  end
61
68
  it 'should support `x.equals(:another_view).plus(10)`' do
62
- @layout.context(NSView.new) do
69
+ @layout.context(@view) do
63
70
  @layout.constraints do
64
71
  @constraint = @layout.x.equals(:another_view).plus(10)
65
72
  end
@@ -72,7 +79,7 @@ describe 'Constraints helpers' do
72
79
  @constraint.attribute2.should == :left
73
80
  end
74
81
  it 'should support `x.equals(:another_view).plus(10).plus(20)`' do
75
- @layout.context(NSView.new) do
82
+ @layout.context(@view) do
76
83
  @layout.constraints do
77
84
  @constraint = @layout.x.equals(:another_view).plus(10).plus(20)
78
85
  end
@@ -85,7 +92,7 @@ describe 'Constraints helpers' do
85
92
  @constraint.attribute2.should == :left
86
93
  end
87
94
  it 'should support `min_x.equals(:another_view[, :left])`' do
88
- @layout.context(NSView.new) do
95
+ @layout.context(@view) do
89
96
  @layout.constraints do
90
97
  @constraint = @layout.min_x.equals(:another_view)
91
98
  end
@@ -98,7 +105,7 @@ describe 'Constraints helpers' do
98
105
  @constraint.attribute2.should == :left
99
106
  end
100
107
  it 'should support `max_x.equals(:another_view[, :left])`' do
101
- @layout.context(NSView.new) do
108
+ @layout.context(@view) do
102
109
  @layout.constraints do
103
110
  @constraint = @layout.max_x.equals(:another_view)
104
111
  end
@@ -111,7 +118,7 @@ describe 'Constraints helpers' do
111
118
  @constraint.attribute2.should == :left
112
119
  end
113
120
  it 'should support `x.equals(:another_view, :right)`' do
114
- @layout.context(NSView.new) do
121
+ @layout.context(@view) do
115
122
  @layout.constraints do
116
123
  @constraint = @layout.x.equals(:another_view, :right)
117
124
  end
@@ -124,7 +131,7 @@ describe 'Constraints helpers' do
124
131
  @constraint.attribute2.should == :right
125
132
  end
126
133
  it 'should support `min_x.equals(:another_view, :right)`' do
127
- @layout.context(NSView.new) do
134
+ @layout.context(@view) do
128
135
  @layout.constraints do
129
136
  @constraint = @layout.min_x.equals(:another_view, :right)
130
137
  end
@@ -137,7 +144,7 @@ describe 'Constraints helpers' do
137
144
  @constraint.attribute2.should == :right
138
145
  end
139
146
  it 'should support `max_x.equals(:another_view, :right)`' do
140
- @layout.context(NSView.new) do
147
+ @layout.context(@view) do
141
148
  @layout.constraints do
142
149
  @constraint = @layout.max_x.equals(:another_view, :right)
143
150
  end
@@ -150,7 +157,7 @@ describe 'Constraints helpers' do
150
157
  @constraint.attribute2.should == :right
151
158
  end
152
159
  it 'should support `x.equals(:another_view, :right).minus(10)`' do
153
- @layout.context(NSView.new) do
160
+ @layout.context(@view) do
154
161
  @layout.constraints do
155
162
  @constraint = @layout.x.equals(:another_view, :right).minus(10)
156
163
  end
@@ -163,7 +170,7 @@ describe 'Constraints helpers' do
163
170
  @constraint.attribute2.should == :right
164
171
  end
165
172
  it 'should support `min_x.equals(:another_view, :right).plus(10)`' do
166
- @layout.context(NSView.new) do
173
+ @layout.context(@view) do
167
174
  @layout.constraints do
168
175
  @constraint = @layout.min_x.equals(:another_view, :right).plus(10)
169
176
  end
@@ -176,7 +183,7 @@ describe 'Constraints helpers' do
176
183
  @constraint.attribute2.should == :right
177
184
  end
178
185
  it 'should support `max_x.equals(:another_view, :right).plus(10)`' do
179
- @layout.context(NSView.new) do
186
+ @layout.context(@view) do
180
187
  @layout.constraints do
181
188
  @constraint = @layout.max_x.equals(:another_view, :right).plus(10)
182
189
  end
@@ -189,7 +196,7 @@ describe 'Constraints helpers' do
189
196
  @constraint.attribute2.should == :right
190
197
  end
191
198
  it 'should support `x.equals(:another_view).times(2).plus(10)`' do
192
- @layout.context(NSView.new) do
199
+ @layout.context(@view) do
193
200
  @layout.constraints do
194
201
  @constraint = @layout.x.equals(:another_view).times(2).plus(10)
195
202
  end
@@ -202,7 +209,7 @@ describe 'Constraints helpers' do
202
209
  @constraint.attribute2.should == :left
203
210
  end
204
211
  it 'should support `min_x.equals(:another_view).times(2).plus(10)`' do
205
- @layout.context(NSView.new) do
212
+ @layout.context(@view) do
206
213
  @layout.constraints do
207
214
  @constraint = @layout.min_x.equals(:another_view).times(2).plus(10)
208
215
  end
@@ -215,7 +222,7 @@ describe 'Constraints helpers' do
215
222
  @constraint.attribute2.should == :left
216
223
  end
217
224
  it 'should support `max_x.equals(:another_view).times(2).plus(10)`' do
218
- @layout.context(NSView.new) do
225
+ @layout.context(@view) do
219
226
  @layout.constraints do
220
227
  @constraint = @layout.max_x.equals(:another_view).times(2).plus(10)
221
228
  end
@@ -228,7 +235,7 @@ describe 'Constraints helpers' do
228
235
  @constraint.attribute2.should == :left
229
236
  end
230
237
  it 'should support `left.equals(:another_view).times(2).plus(10)`' do
231
- @layout.context(NSView.new) do
238
+ @layout.context(@view) do
232
239
  @layout.constraints do
233
240
  @constraint = @layout.left.equals(:another_view).times(2).plus(10)
234
241
  end
@@ -241,7 +248,7 @@ describe 'Constraints helpers' do
241
248
  @constraint.attribute2.should == :left
242
249
  end
243
250
  it 'should support `min_left.equals(:another_view).times(2).plus(10)`' do
244
- @layout.context(NSView.new) do
251
+ @layout.context(@view) do
245
252
  @layout.constraints do
246
253
  @constraint = @layout.min_left.equals(:another_view).times(2).plus(10)
247
254
  end
@@ -254,7 +261,7 @@ describe 'Constraints helpers' do
254
261
  @constraint.attribute2.should == :left
255
262
  end
256
263
  it 'should support `max_left.equals(:another_view).times(2).plus(10)`' do
257
- @layout.context(NSView.new) do
264
+ @layout.context(@view) do
258
265
  @layout.constraints do
259
266
  @constraint = @layout.max_left.equals(:another_view).times(2).plus(10)
260
267
  end
@@ -270,7 +277,7 @@ describe 'Constraints helpers' do
270
277
 
271
278
  describe '`center_x` support' do
272
279
  it 'should support `center_x 10`' do
273
- @layout.context(NSView.new) do
280
+ @layout.context(@view) do
274
281
  @layout.constraints do
275
282
  @constraint = @layout.center_x(10)
276
283
  end
@@ -283,7 +290,7 @@ describe 'Constraints helpers' do
283
290
  @constraint.attribute2.should == :center_x
284
291
  end
285
292
  it 'should support `min_center_x 10`' do
286
- @layout.context(NSView.new) do
293
+ @layout.context(@view) do
287
294
  @layout.constraints do
288
295
  @constraint = @layout.min_center_x(10)
289
296
  end
@@ -296,7 +303,7 @@ describe 'Constraints helpers' do
296
303
  @constraint.attribute2.should == :center_x
297
304
  end
298
305
  it 'should support `max_center_x 10`' do
299
- @layout.context(NSView.new) do
306
+ @layout.context(@view) do
300
307
  @layout.constraints do
301
308
  @constraint = @layout.max_center_x(10)
302
309
  end
@@ -309,7 +316,7 @@ describe 'Constraints helpers' do
309
316
  @constraint.attribute2.should == :center_x
310
317
  end
311
318
  it 'should support `center_x.equals(:another_view[, :center_x])`' do
312
- @layout.context(NSView.new) do
319
+ @layout.context(@view) do
313
320
  @layout.constraints do
314
321
  @constraint = @layout.center_x.equals(:another_view)
315
322
  end
@@ -322,7 +329,7 @@ describe 'Constraints helpers' do
322
329
  @constraint.attribute2.should == :center_x
323
330
  end
324
331
  it 'should support `min_center_x.equals(:another_view[, :center_x])`' do
325
- @layout.context(NSView.new) do
332
+ @layout.context(@view) do
326
333
  @layout.constraints do
327
334
  @constraint = @layout.min_center_x.equals(:another_view)
328
335
  end
@@ -335,7 +342,7 @@ describe 'Constraints helpers' do
335
342
  @constraint.attribute2.should == :center_x
336
343
  end
337
344
  it 'should support `max_center_x.equals(:another_view[, :center_x])`' do
338
- @layout.context(NSView.new) do
345
+ @layout.context(@view) do
339
346
  @layout.constraints do
340
347
  @constraint = @layout.max_center_x.equals(:another_view)
341
348
  end
@@ -348,7 +355,7 @@ describe 'Constraints helpers' do
348
355
  @constraint.attribute2.should == :center_x
349
356
  end
350
357
  it 'should support `center_x.equals(:another_view, :right)`' do
351
- @layout.context(NSView.new) do
358
+ @layout.context(@view) do
352
359
  @layout.constraints do
353
360
  @constraint = @layout.center_x.equals(:another_view, :right)
354
361
  end
@@ -361,7 +368,7 @@ describe 'Constraints helpers' do
361
368
  @constraint.attribute2.should == :right
362
369
  end
363
370
  it 'should support `min_center_x.equals(:another_view, :right)`' do
364
- @layout.context(NSView.new) do
371
+ @layout.context(@view) do
365
372
  @layout.constraints do
366
373
  @constraint = @layout.min_center_x.equals(:another_view, :right)
367
374
  end
@@ -374,7 +381,7 @@ describe 'Constraints helpers' do
374
381
  @constraint.attribute2.should == :right
375
382
  end
376
383
  it 'should support `max_center_x.equals(:another_view, :right)`' do
377
- @layout.context(NSView.new) do
384
+ @layout.context(@view) do
378
385
  @layout.constraints do
379
386
  @constraint = @layout.max_center_x.equals(:another_view, :right)
380
387
  end
@@ -387,7 +394,7 @@ describe 'Constraints helpers' do
387
394
  @constraint.attribute2.should == :right
388
395
  end
389
396
  it 'should support `center_x.equals(:another_view, :right).plus(10)`' do
390
- @layout.context(NSView.new) do
397
+ @layout.context(@view) do
391
398
  @layout.constraints do
392
399
  @constraint = @layout.center_x.equals(:another_view, :right).plus(10)
393
400
  end
@@ -400,7 +407,7 @@ describe 'Constraints helpers' do
400
407
  @constraint.attribute2.should == :right
401
408
  end
402
409
  it 'should support `min_center_x.equals(:another_view, :right).plus(10)`' do
403
- @layout.context(NSView.new) do
410
+ @layout.context(@view) do
404
411
  @layout.constraints do
405
412
  @constraint = @layout.min_center_x.equals(:another_view, :right).plus(10)
406
413
  end
@@ -413,7 +420,7 @@ describe 'Constraints helpers' do
413
420
  @constraint.attribute2.should == :right
414
421
  end
415
422
  it 'should support `max_center_x.equals(:another_view, :right).plus(10)`' do
416
- @layout.context(NSView.new) do
423
+ @layout.context(@view) do
417
424
  @layout.constraints do
418
425
  @constraint = @layout.max_center_x.equals(:another_view, :right).plus(10)
419
426
  end
@@ -426,7 +433,7 @@ describe 'Constraints helpers' do
426
433
  @constraint.attribute2.should == :right
427
434
  end
428
435
  it 'should support `center_x.equals(:another_view).times(2).plus(10)`' do
429
- @layout.context(NSView.new) do
436
+ @layout.context(@view) do
430
437
  @layout.constraints do
431
438
  @constraint = @layout.center_x.equals(:another_view).times(2).plus(10)
432
439
  end
@@ -439,7 +446,7 @@ describe 'Constraints helpers' do
439
446
  @constraint.attribute2.should == :center_x
440
447
  end
441
448
  it 'should support `min_center_x.equals(:another_view).times(2).plus(10)`' do
442
- @layout.context(NSView.new) do
449
+ @layout.context(@view) do
443
450
  @layout.constraints do
444
451
  @constraint = @layout.min_center_x.equals(:another_view).times(2).plus(10)
445
452
  end
@@ -452,7 +459,7 @@ describe 'Constraints helpers' do
452
459
  @constraint.attribute2.should == :center_x
453
460
  end
454
461
  it 'should support `max_center_x.equals(:another_view).times(2).plus(10)`' do
455
- @layout.context(NSView.new) do
462
+ @layout.context(@view) do
456
463
  @layout.constraints do
457
464
  @constraint = @layout.max_center_x.equals(:another_view).times(2).plus(10)
458
465
  end
@@ -468,7 +475,7 @@ describe 'Constraints helpers' do
468
475
 
469
476
  describe '`right` support' do
470
477
  it 'should support `right 10`' do
471
- @layout.context(NSView.new) do
478
+ @layout.context(@view) do
472
479
  @layout.constraints do
473
480
  @constraint = @layout.right(10)
474
481
  end
@@ -481,7 +488,7 @@ describe 'Constraints helpers' do
481
488
  @constraint.attribute2.should == :right
482
489
  end
483
490
  it 'should support `min_right 10`' do
484
- @layout.context(NSView.new) do
491
+ @layout.context(@view) do
485
492
  @layout.constraints do
486
493
  @constraint = @layout.min_right(10)
487
494
  end
@@ -494,7 +501,7 @@ describe 'Constraints helpers' do
494
501
  @constraint.attribute2.should == :right
495
502
  end
496
503
  it 'should support `max_right 10`' do
497
- @layout.context(NSView.new) do
504
+ @layout.context(@view) do
498
505
  @layout.constraints do
499
506
  @constraint = @layout.max_right(10)
500
507
  end
@@ -507,7 +514,7 @@ describe 'Constraints helpers' do
507
514
  @constraint.attribute2.should == :right
508
515
  end
509
516
  it 'should support `right.equals(:another_view[, :right])`' do
510
- @layout.context(NSView.new) do
517
+ @layout.context(@view) do
511
518
  @layout.constraints do
512
519
  @constraint = @layout.right.equals(:another_view)
513
520
  end
@@ -520,7 +527,7 @@ describe 'Constraints helpers' do
520
527
  @constraint.attribute2.should == :right
521
528
  end
522
529
  it 'should support `min_right.equals(:another_view[, :right])`' do
523
- @layout.context(NSView.new) do
530
+ @layout.context(@view) do
524
531
  @layout.constraints do
525
532
  @constraint = @layout.min_right.equals(:another_view)
526
533
  end
@@ -533,7 +540,7 @@ describe 'Constraints helpers' do
533
540
  @constraint.attribute2.should == :right
534
541
  end
535
542
  it 'should support `max_right.equals(:another_view[, :right])`' do
536
- @layout.context(NSView.new) do
543
+ @layout.context(@view) do
537
544
  @layout.constraints do
538
545
  @constraint = @layout.max_right.equals(:another_view)
539
546
  end
@@ -546,7 +553,7 @@ describe 'Constraints helpers' do
546
553
  @constraint.attribute2.should == :right
547
554
  end
548
555
  it 'should support `right.equals(:another_view, :left)`' do
549
- @layout.context(NSView.new) do
556
+ @layout.context(@view) do
550
557
  @layout.constraints do
551
558
  @constraint = @layout.right.equals(:another_view, :left)
552
559
  end
@@ -559,7 +566,7 @@ describe 'Constraints helpers' do
559
566
  @constraint.attribute2.should == :left
560
567
  end
561
568
  it 'should support `min_right.equals(:another_view, :left)`' do
562
- @layout.context(NSView.new) do
569
+ @layout.context(@view) do
563
570
  @layout.constraints do
564
571
  @constraint = @layout.min_right.equals(:another_view, :left)
565
572
  end
@@ -572,7 +579,7 @@ describe 'Constraints helpers' do
572
579
  @constraint.attribute2.should == :left
573
580
  end
574
581
  it 'should support `max_right.equals(:another_view, :left)`' do
575
- @layout.context(NSView.new) do
582
+ @layout.context(@view) do
576
583
  @layout.constraints do
577
584
  @constraint = @layout.max_right.equals(:another_view, :left)
578
585
  end
@@ -585,7 +592,7 @@ describe 'Constraints helpers' do
585
592
  @constraint.attribute2.should == :left
586
593
  end
587
594
  it 'should support `right.equals(:another_view, :left).plus(10)`' do
588
- @layout.context(NSView.new) do
595
+ @layout.context(@view) do
589
596
  @layout.constraints do
590
597
  @constraint = @layout.right.equals(:another_view, :left).plus(10)
591
598
  end
@@ -598,7 +605,7 @@ describe 'Constraints helpers' do
598
605
  @constraint.attribute2.should == :left
599
606
  end
600
607
  it 'should support `min_right.equals(:another_view, :left).plus(10)`' do
601
- @layout.context(NSView.new) do
608
+ @layout.context(@view) do
602
609
  @layout.constraints do
603
610
  @constraint = @layout.min_right.equals(:another_view, :left).plus(10)
604
611
  end
@@ -611,7 +618,7 @@ describe 'Constraints helpers' do
611
618
  @constraint.attribute2.should == :left
612
619
  end
613
620
  it 'should support `max_right.equals(:another_view, :left).plus(10)`' do
614
- @layout.context(NSView.new) do
621
+ @layout.context(@view) do
615
622
  @layout.constraints do
616
623
  @constraint = @layout.max_right.equals(:another_view, :left).plus(10)
617
624
  end
@@ -624,7 +631,7 @@ describe 'Constraints helpers' do
624
631
  @constraint.attribute2.should == :left
625
632
  end
626
633
  it 'should support `right.equals(:another_view).times(2).plus(10)`' do
627
- @layout.context(NSView.new) do
634
+ @layout.context(@view) do
628
635
  @layout.constraints do
629
636
  @constraint = @layout.right.equals(:another_view).times(2).plus(10)
630
637
  end
@@ -637,7 +644,7 @@ describe 'Constraints helpers' do
637
644
  @constraint.attribute2.should == :right
638
645
  end
639
646
  it 'should support `min_right.equals(:another_view).times(2).plus(10)`' do
640
- @layout.context(NSView.new) do
647
+ @layout.context(@view) do
641
648
  @layout.constraints do
642
649
  @constraint = @layout.min_right.equals(:another_view).times(2).plus(10)
643
650
  end
@@ -650,7 +657,7 @@ describe 'Constraints helpers' do
650
657
  @constraint.attribute2.should == :right
651
658
  end
652
659
  it 'should support `max_right.equals(:another_view).times(2).plus(10)`' do
653
- @layout.context(NSView.new) do
660
+ @layout.context(@view) do
654
661
  @layout.constraints do
655
662
  @constraint = @layout.max_right.equals(:another_view).times(2).plus(10)
656
663
  end
@@ -666,7 +673,7 @@ describe 'Constraints helpers' do
666
673
 
667
674
  describe '`y/top` support' do
668
675
  it 'should support `y 10`' do
669
- @layout.context(NSView.new) do
676
+ @layout.context(@view) do
670
677
  @layout.constraints do
671
678
  @constraint = @layout.y(10)
672
679
  end
@@ -679,7 +686,7 @@ describe 'Constraints helpers' do
679
686
  @constraint.attribute2.should == :top
680
687
  end
681
688
  it 'should support `min_y 10`' do
682
- @layout.context(NSView.new) do
689
+ @layout.context(@view) do
683
690
  @layout.constraints do
684
691
  @constraint = @layout.min_y(10)
685
692
  end
@@ -692,7 +699,7 @@ describe 'Constraints helpers' do
692
699
  @constraint.attribute2.should == :top
693
700
  end
694
701
  it 'should support `max_y 10`' do
695
- @layout.context(NSView.new) do
702
+ @layout.context(@view) do
696
703
  @layout.constraints do
697
704
  @constraint = @layout.max_y(10)
698
705
  end
@@ -705,7 +712,7 @@ describe 'Constraints helpers' do
705
712
  @constraint.attribute2.should == :top
706
713
  end
707
714
  it 'should support `y.equals(:another_view[, :top])`' do
708
- @layout.context(NSView.new) do
715
+ @layout.context(@view) do
709
716
  @layout.constraints do
710
717
  @constraint = @layout.y.equals(:another_view)
711
718
  end
@@ -718,7 +725,7 @@ describe 'Constraints helpers' do
718
725
  @constraint.attribute2.should == :top
719
726
  end
720
727
  it 'should support `min_y.equals(:another_view[, :top])`' do
721
- @layout.context(NSView.new) do
728
+ @layout.context(@view) do
722
729
  @layout.constraints do
723
730
  @constraint = @layout.min_y.equals(:another_view)
724
731
  end
@@ -731,7 +738,7 @@ describe 'Constraints helpers' do
731
738
  @constraint.attribute2.should == :top
732
739
  end
733
740
  it 'should support `max_y.equals(:another_view[, :top])`' do
734
- @layout.context(NSView.new) do
741
+ @layout.context(@view) do
735
742
  @layout.constraints do
736
743
  @constraint = @layout.max_y.equals(:another_view)
737
744
  end
@@ -744,7 +751,7 @@ describe 'Constraints helpers' do
744
751
  @constraint.attribute2.should == :top
745
752
  end
746
753
  it 'should support `y.equals(:another_view, :bottom)`' do
747
- @layout.context(NSView.new) do
754
+ @layout.context(@view) do
748
755
  @layout.constraints do
749
756
  @constraint = @layout.y.equals(:another_view, :bottom)
750
757
  end
@@ -757,7 +764,7 @@ describe 'Constraints helpers' do
757
764
  @constraint.attribute2.should == :bottom
758
765
  end
759
766
  it 'should support `min_y.equals(:another_view, :bottom)`' do
760
- @layout.context(NSView.new) do
767
+ @layout.context(@view) do
761
768
  @layout.constraints do
762
769
  @constraint = @layout.min_y.equals(:another_view, :bottom)
763
770
  end
@@ -770,7 +777,7 @@ describe 'Constraints helpers' do
770
777
  @constraint.attribute2.should == :bottom
771
778
  end
772
779
  it 'should support `max_y.equals(:another_view, :bottom)`' do
773
- @layout.context(NSView.new) do
780
+ @layout.context(@view) do
774
781
  @layout.constraints do
775
782
  @constraint = @layout.max_y.equals(:another_view, :bottom)
776
783
  end
@@ -783,7 +790,7 @@ describe 'Constraints helpers' do
783
790
  @constraint.attribute2.should == :bottom
784
791
  end
785
792
  it 'should support `y.equals(:another_view, :bottom).plus(10)`' do
786
- @layout.context(NSView.new) do
793
+ @layout.context(@view) do
787
794
  @layout.constraints do
788
795
  @constraint = @layout.y.equals(:another_view, :bottom).plus(10)
789
796
  end
@@ -796,7 +803,7 @@ describe 'Constraints helpers' do
796
803
  @constraint.attribute2.should == :bottom
797
804
  end
798
805
  it 'should support `min_y.equals(:another_view, :bottom).plus(10)`' do
799
- @layout.context(NSView.new) do
806
+ @layout.context(@view) do
800
807
  @layout.constraints do
801
808
  @constraint = @layout.min_y.equals(:another_view, :bottom).plus(10)
802
809
  end
@@ -809,7 +816,7 @@ describe 'Constraints helpers' do
809
816
  @constraint.attribute2.should == :bottom
810
817
  end
811
818
  it 'should support `max_y.equals(:another_view, :bottom).plus(10)`' do
812
- @layout.context(NSView.new) do
819
+ @layout.context(@view) do
813
820
  @layout.constraints do
814
821
  @constraint = @layout.max_y.equals(:another_view, :bottom).plus(10)
815
822
  end
@@ -822,7 +829,7 @@ describe 'Constraints helpers' do
822
829
  @constraint.attribute2.should == :bottom
823
830
  end
824
831
  it 'should support `y.equals(:another_view).times(2).plus(10)`' do
825
- @layout.context(NSView.new) do
832
+ @layout.context(@view) do
826
833
  @layout.constraints do
827
834
  @constraint = @layout.y.equals(:another_view).times(2).plus(10)
828
835
  end
@@ -835,7 +842,7 @@ describe 'Constraints helpers' do
835
842
  @constraint.attribute2.should == :top
836
843
  end
837
844
  it 'should support `min_y.equals(:another_view).times(2).plus(10)`' do
838
- @layout.context(NSView.new) do
845
+ @layout.context(@view) do
839
846
  @layout.constraints do
840
847
  @constraint = @layout.min_y.equals(:another_view).times(2).plus(10)
841
848
  end
@@ -848,7 +855,7 @@ describe 'Constraints helpers' do
848
855
  @constraint.attribute2.should == :top
849
856
  end
850
857
  it 'should support `max_y.equals(:another_view).times(2).plus(10)`' do
851
- @layout.context(NSView.new) do
858
+ @layout.context(@view) do
852
859
  @layout.constraints do
853
860
  @constraint = @layout.max_y.equals(:another_view).times(2).plus(10)
854
861
  end
@@ -861,7 +868,7 @@ describe 'Constraints helpers' do
861
868
  @constraint.attribute2.should == :top
862
869
  end
863
870
  it 'should support `top.equals(:another_view).times(2).plus(10)`' do
864
- @layout.context(NSView.new) do
871
+ @layout.context(@view) do
865
872
  @layout.constraints do
866
873
  @constraint = @layout.top.equals(:another_view).times(2).plus(10)
867
874
  end
@@ -874,7 +881,7 @@ describe 'Constraints helpers' do
874
881
  @constraint.attribute2.should == :top
875
882
  end
876
883
  it 'should support `min_top.equals(:another_view).times(2).plus(10)`' do
877
- @layout.context(NSView.new) do
884
+ @layout.context(@view) do
878
885
  @layout.constraints do
879
886
  @constraint = @layout.min_top.equals(:another_view).times(2).plus(10)
880
887
  end
@@ -887,7 +894,7 @@ describe 'Constraints helpers' do
887
894
  @constraint.attribute2.should == :top
888
895
  end
889
896
  it 'should support `max_top.equals(:another_view).times(2).plus(10)`' do
890
- @layout.context(NSView.new) do
897
+ @layout.context(@view) do
891
898
  @layout.constraints do
892
899
  @constraint = @layout.max_top.equals(:another_view).times(2).plus(10)
893
900
  end
@@ -903,7 +910,7 @@ describe 'Constraints helpers' do
903
910
 
904
911
  describe '`center_y` support' do
905
912
  it 'should support `center_y 10`' do
906
- @layout.context(NSView.new) do
913
+ @layout.context(@view) do
907
914
  @layout.constraints do
908
915
  @constraint = @layout.center_y(10)
909
916
  end
@@ -916,7 +923,7 @@ describe 'Constraints helpers' do
916
923
  @constraint.attribute2.should == :center_y
917
924
  end
918
925
  it 'should support `min_center_y 10`' do
919
- @layout.context(NSView.new) do
926
+ @layout.context(@view) do
920
927
  @layout.constraints do
921
928
  @constraint = @layout.min_center_y(10)
922
929
  end
@@ -929,7 +936,7 @@ describe 'Constraints helpers' do
929
936
  @constraint.attribute2.should == :center_y
930
937
  end
931
938
  it 'should support `max_center_y 10`' do
932
- @layout.context(NSView.new) do
939
+ @layout.context(@view) do
933
940
  @layout.constraints do
934
941
  @constraint = @layout.max_center_y(10)
935
942
  end
@@ -942,7 +949,7 @@ describe 'Constraints helpers' do
942
949
  @constraint.attribute2.should == :center_y
943
950
  end
944
951
  it 'should support `center_y.equals(:another_view[, :center_y])`' do
945
- @layout.context(NSView.new) do
952
+ @layout.context(@view) do
946
953
  @layout.constraints do
947
954
  @constraint = @layout.center_y.equals(:another_view)
948
955
  end
@@ -955,7 +962,7 @@ describe 'Constraints helpers' do
955
962
  @constraint.attribute2.should == :center_y
956
963
  end
957
964
  it 'should support `min_center_y.equals(:another_view[, :center_y])`' do
958
- @layout.context(NSView.new) do
965
+ @layout.context(@view) do
959
966
  @layout.constraints do
960
967
  @constraint = @layout.min_center_y.equals(:another_view)
961
968
  end
@@ -968,7 +975,7 @@ describe 'Constraints helpers' do
968
975
  @constraint.attribute2.should == :center_y
969
976
  end
970
977
  it 'should support `max_center_y.equals(:another_view[, :center_y])`' do
971
- @layout.context(NSView.new) do
978
+ @layout.context(@view) do
972
979
  @layout.constraints do
973
980
  @constraint = @layout.max_center_y.equals(:another_view)
974
981
  end
@@ -981,7 +988,7 @@ describe 'Constraints helpers' do
981
988
  @constraint.attribute2.should == :center_y
982
989
  end
983
990
  it 'should support `center_y.equals(:another_view, :top)`' do
984
- @layout.context(NSView.new) do
991
+ @layout.context(@view) do
985
992
  @layout.constraints do
986
993
  @constraint = @layout.center_y.equals(:another_view, :top)
987
994
  end
@@ -994,7 +1001,7 @@ describe 'Constraints helpers' do
994
1001
  @constraint.attribute2.should == :top
995
1002
  end
996
1003
  it 'should support `min_center_y.equals(:another_view, :top)`' do
997
- @layout.context(NSView.new) do
1004
+ @layout.context(@view) do
998
1005
  @layout.constraints do
999
1006
  @constraint = @layout.min_center_y.equals(:another_view, :top)
1000
1007
  end
@@ -1007,7 +1014,7 @@ describe 'Constraints helpers' do
1007
1014
  @constraint.attribute2.should == :top
1008
1015
  end
1009
1016
  it 'should support `max_center_y.equals(:another_view, :top)`' do
1010
- @layout.context(NSView.new) do
1017
+ @layout.context(@view) do
1011
1018
  @layout.constraints do
1012
1019
  @constraint = @layout.max_center_y.equals(:another_view, :top)
1013
1020
  end
@@ -1020,7 +1027,7 @@ describe 'Constraints helpers' do
1020
1027
  @constraint.attribute2.should == :top
1021
1028
  end
1022
1029
  it 'should support `center_y.equals(:another_view, :top).plus(10)`' do
1023
- @layout.context(NSView.new) do
1030
+ @layout.context(@view) do
1024
1031
  @layout.constraints do
1025
1032
  @constraint = @layout.center_y.equals(:another_view, :top).plus(10)
1026
1033
  end
@@ -1033,7 +1040,7 @@ describe 'Constraints helpers' do
1033
1040
  @constraint.attribute2.should == :top
1034
1041
  end
1035
1042
  it 'should support `min_center_y.equals(:another_view, :top).plus(10)`' do
1036
- @layout.context(NSView.new) do
1043
+ @layout.context(@view) do
1037
1044
  @layout.constraints do
1038
1045
  @constraint = @layout.min_center_y.equals(:another_view, :top).plus(10)
1039
1046
  end
@@ -1046,7 +1053,7 @@ describe 'Constraints helpers' do
1046
1053
  @constraint.attribute2.should == :top
1047
1054
  end
1048
1055
  it 'should support `max_center_y.equals(:another_view, :top).plus(10)`' do
1049
- @layout.context(NSView.new) do
1056
+ @layout.context(@view) do
1050
1057
  @layout.constraints do
1051
1058
  @constraint = @layout.max_center_y.equals(:another_view, :top).plus(10)
1052
1059
  end
@@ -1059,7 +1066,7 @@ describe 'Constraints helpers' do
1059
1066
  @constraint.attribute2.should == :top
1060
1067
  end
1061
1068
  it 'should support `center_y.equals(:another_view).times(2).plus(10)`' do
1062
- @layout.context(NSView.new) do
1069
+ @layout.context(@view) do
1063
1070
  @layout.constraints do
1064
1071
  @constraint = @layout.center_y.equals(:another_view).times(2).plus(10)
1065
1072
  end
@@ -1072,7 +1079,7 @@ describe 'Constraints helpers' do
1072
1079
  @constraint.attribute2.should == :center_y
1073
1080
  end
1074
1081
  it 'should support `min_center_y.equals(:another_view).times(2).plus(10)`' do
1075
- @layout.context(NSView.new) do
1082
+ @layout.context(@view) do
1076
1083
  @layout.constraints do
1077
1084
  @constraint = @layout.min_center_y.equals(:another_view).times(2).plus(10)
1078
1085
  end
@@ -1085,7 +1092,7 @@ describe 'Constraints helpers' do
1085
1092
  @constraint.attribute2.should == :center_y
1086
1093
  end
1087
1094
  it 'should support `max_center_y.equals(:another_view).times(2).plus(10)`' do
1088
- @layout.context(NSView.new) do
1095
+ @layout.context(@view) do
1089
1096
  @layout.constraints do
1090
1097
  @constraint = @layout.max_center_y.equals(:another_view).times(2).plus(10)
1091
1098
  end
@@ -1101,7 +1108,7 @@ describe 'Constraints helpers' do
1101
1108
 
1102
1109
  describe '`bottom` support' do
1103
1110
  it 'should support `bottom 10`' do
1104
- @layout.context(NSView.new) do
1111
+ @layout.context(@view) do
1105
1112
  @layout.constraints do
1106
1113
  @constraint = @layout.bottom(10)
1107
1114
  end
@@ -1114,7 +1121,7 @@ describe 'Constraints helpers' do
1114
1121
  @constraint.attribute2.should == :bottom
1115
1122
  end
1116
1123
  it 'should support `min_bottom 10`' do
1117
- @layout.context(NSView.new) do
1124
+ @layout.context(@view) do
1118
1125
  @layout.constraints do
1119
1126
  @constraint = @layout.min_bottom(10)
1120
1127
  end
@@ -1127,7 +1134,7 @@ describe 'Constraints helpers' do
1127
1134
  @constraint.attribute2.should == :bottom
1128
1135
  end
1129
1136
  it 'should support `max_bottom 10`' do
1130
- @layout.context(NSView.new) do
1137
+ @layout.context(@view) do
1131
1138
  @layout.constraints do
1132
1139
  @constraint = @layout.max_bottom(10)
1133
1140
  end
@@ -1140,7 +1147,7 @@ describe 'Constraints helpers' do
1140
1147
  @constraint.attribute2.should == :bottom
1141
1148
  end
1142
1149
  it 'should support `bottom.equals(:another_view[, :bottom])`' do
1143
- @layout.context(NSView.new) do
1150
+ @layout.context(@view) do
1144
1151
  @layout.constraints do
1145
1152
  @constraint = @layout.bottom.equals(:another_view)
1146
1153
  end
@@ -1153,7 +1160,7 @@ describe 'Constraints helpers' do
1153
1160
  @constraint.attribute2.should == :bottom
1154
1161
  end
1155
1162
  it 'should support `min_bottom.equals(:another_view[, :bottom])`' do
1156
- @layout.context(NSView.new) do
1163
+ @layout.context(@view) do
1157
1164
  @layout.constraints do
1158
1165
  @constraint = @layout.min_bottom.equals(:another_view)
1159
1166
  end
@@ -1166,7 +1173,7 @@ describe 'Constraints helpers' do
1166
1173
  @constraint.attribute2.should == :bottom
1167
1174
  end
1168
1175
  it 'should support `max_bottom.equals(:another_view[, :bottom])`' do
1169
- @layout.context(NSView.new) do
1176
+ @layout.context(@view) do
1170
1177
  @layout.constraints do
1171
1178
  @constraint = @layout.max_bottom.equals(:another_view)
1172
1179
  end
@@ -1179,7 +1186,7 @@ describe 'Constraints helpers' do
1179
1186
  @constraint.attribute2.should == :bottom
1180
1187
  end
1181
1188
  it 'should support `bottom.equals(:another_view, :top)`' do
1182
- @layout.context(NSView.new) do
1189
+ @layout.context(@view) do
1183
1190
  @layout.constraints do
1184
1191
  @constraint = @layout.bottom.equals(:another_view, :top)
1185
1192
  end
@@ -1192,7 +1199,7 @@ describe 'Constraints helpers' do
1192
1199
  @constraint.attribute2.should == :top
1193
1200
  end
1194
1201
  it 'should support `min_bottom.equals(:another_view, :top)`' do
1195
- @layout.context(NSView.new) do
1202
+ @layout.context(@view) do
1196
1203
  @layout.constraints do
1197
1204
  @constraint = @layout.min_bottom.equals(:another_view, :top)
1198
1205
  end
@@ -1205,7 +1212,7 @@ describe 'Constraints helpers' do
1205
1212
  @constraint.attribute2.should == :top
1206
1213
  end
1207
1214
  it 'should support `max_bottom.equals(:another_view, :top)`' do
1208
- @layout.context(NSView.new) do
1215
+ @layout.context(@view) do
1209
1216
  @layout.constraints do
1210
1217
  @constraint = @layout.max_bottom.equals(:another_view, :top)
1211
1218
  end
@@ -1218,7 +1225,7 @@ describe 'Constraints helpers' do
1218
1225
  @constraint.attribute2.should == :top
1219
1226
  end
1220
1227
  it 'should support `bottom.equals(:another_view, :top).plus(10)`' do
1221
- @layout.context(NSView.new) do
1228
+ @layout.context(@view) do
1222
1229
  @layout.constraints do
1223
1230
  @constraint = @layout.bottom.equals(:another_view, :top).plus(10)
1224
1231
  end
@@ -1231,7 +1238,7 @@ describe 'Constraints helpers' do
1231
1238
  @constraint.attribute2.should == :top
1232
1239
  end
1233
1240
  it 'should support `min_bottom.equals(:another_view, :top).plus(10)`' do
1234
- @layout.context(NSView.new) do
1241
+ @layout.context(@view) do
1235
1242
  @layout.constraints do
1236
1243
  @constraint = @layout.min_bottom.equals(:another_view, :top).plus(10)
1237
1244
  end
@@ -1244,7 +1251,7 @@ describe 'Constraints helpers' do
1244
1251
  @constraint.attribute2.should == :top
1245
1252
  end
1246
1253
  it 'should support `max_bottom.equals(:another_view, :top).plus(10)`' do
1247
- @layout.context(NSView.new) do
1254
+ @layout.context(@view) do
1248
1255
  @layout.constraints do
1249
1256
  @constraint = @layout.max_bottom.equals(:another_view, :top).plus(10)
1250
1257
  end
@@ -1257,7 +1264,7 @@ describe 'Constraints helpers' do
1257
1264
  @constraint.attribute2.should == :top
1258
1265
  end
1259
1266
  it 'should support `bottom.equals(:another_view).times(2).plus(10)`' do
1260
- @layout.context(NSView.new) do
1267
+ @layout.context(@view) do
1261
1268
  @layout.constraints do
1262
1269
  @constraint = @layout.bottom.equals(:another_view).times(2).plus(10)
1263
1270
  end
@@ -1270,7 +1277,7 @@ describe 'Constraints helpers' do
1270
1277
  @constraint.attribute2.should == :bottom
1271
1278
  end
1272
1279
  it 'should support `min_bottom.equals(:another_view).times(2).plus(10)`' do
1273
- @layout.context(NSView.new) do
1280
+ @layout.context(@view) do
1274
1281
  @layout.constraints do
1275
1282
  @constraint = @layout.min_bottom.equals(:another_view).times(2).plus(10)
1276
1283
  end
@@ -1283,7 +1290,7 @@ describe 'Constraints helpers' do
1283
1290
  @constraint.attribute2.should == :bottom
1284
1291
  end
1285
1292
  it 'should support `max_bottom.equals(:another_view).times(2).plus(10)`' do
1286
- @layout.context(NSView.new) do
1293
+ @layout.context(@view) do
1287
1294
  @layout.constraints do
1288
1295
  @constraint = @layout.max_bottom.equals(:another_view).times(2).plus(10)
1289
1296
  end
@@ -1299,7 +1306,7 @@ describe 'Constraints helpers' do
1299
1306
 
1300
1307
  describe '`width` support' do
1301
1308
  it 'should support `width 10`' do
1302
- @layout.context(NSView.new) do
1309
+ @layout.context(@view) do
1303
1310
  @layout.constraints do
1304
1311
  @constraint = @layout.width(10)
1305
1312
  end
@@ -1312,7 +1319,7 @@ describe 'Constraints helpers' do
1312
1319
  @constraint.attribute2.should == :width
1313
1320
  end
1314
1321
  it 'should support `min_width 10`' do
1315
- @layout.context(NSView.new) do
1322
+ @layout.context(@view) do
1316
1323
  @layout.constraints do
1317
1324
  @constraint = @layout.min_width(10)
1318
1325
  end
@@ -1325,7 +1332,7 @@ describe 'Constraints helpers' do
1325
1332
  @constraint.attribute2.should == :width
1326
1333
  end
1327
1334
  it 'should support `max_width 10`' do
1328
- @layout.context(NSView.new) do
1335
+ @layout.context(@view) do
1329
1336
  @layout.constraints do
1330
1337
  @constraint = @layout.max_width(10)
1331
1338
  end
@@ -1338,7 +1345,7 @@ describe 'Constraints helpers' do
1338
1345
  @constraint.attribute2.should == :width
1339
1346
  end
1340
1347
  it 'should support `width.equals(:another_view[, :width])`' do
1341
- @layout.context(NSView.new) do
1348
+ @layout.context(@view) do
1342
1349
  @layout.constraints do
1343
1350
  @constraint = @layout.width.equals(:another_view)
1344
1351
  end
@@ -1351,7 +1358,7 @@ describe 'Constraints helpers' do
1351
1358
  @constraint.attribute2.should == :width
1352
1359
  end
1353
1360
  it 'should support `min_width.equals(:another_view[, :width])`' do
1354
- @layout.context(NSView.new) do
1361
+ @layout.context(@view) do
1355
1362
  @layout.constraints do
1356
1363
  @constraint = @layout.min_width.equals(:another_view)
1357
1364
  end
@@ -1364,7 +1371,7 @@ describe 'Constraints helpers' do
1364
1371
  @constraint.attribute2.should == :width
1365
1372
  end
1366
1373
  it 'should support `max_width.equals(:another_view[, :width])`' do
1367
- @layout.context(NSView.new) do
1374
+ @layout.context(@view) do
1368
1375
  @layout.constraints do
1369
1376
  @constraint = @layout.max_width.equals(:another_view)
1370
1377
  end
@@ -1377,7 +1384,7 @@ describe 'Constraints helpers' do
1377
1384
  @constraint.attribute2.should == :width
1378
1385
  end
1379
1386
  it 'should support `width.equals(:another_view, :height).plus(10)`' do
1380
- @layout.context(NSView.new) do
1387
+ @layout.context(@view) do
1381
1388
  @layout.constraints do
1382
1389
  @constraint = @layout.width.equals(:another_view, :height).plus(10)
1383
1390
  end
@@ -1390,7 +1397,7 @@ describe 'Constraints helpers' do
1390
1397
  @constraint.attribute2.should == :height
1391
1398
  end
1392
1399
  it 'should support `min_width.equals(:another_view, :height).plus(10)`' do
1393
- @layout.context(NSView.new) do
1400
+ @layout.context(@view) do
1394
1401
  @layout.constraints do
1395
1402
  @constraint = @layout.min_width.equals(:another_view, :height).plus(10)
1396
1403
  end
@@ -1403,7 +1410,7 @@ describe 'Constraints helpers' do
1403
1410
  @constraint.attribute2.should == :height
1404
1411
  end
1405
1412
  it 'should support `max_width.equals(:another_view, :height).plus(10)`' do
1406
- @layout.context(NSView.new) do
1413
+ @layout.context(@view) do
1407
1414
  @layout.constraints do
1408
1415
  @constraint = @layout.max_width.equals(:another_view, :height).plus(10)
1409
1416
  end
@@ -1416,7 +1423,7 @@ describe 'Constraints helpers' do
1416
1423
  @constraint.attribute2.should == :height
1417
1424
  end
1418
1425
  it 'should support `width.equals(:another_view).times(2).plus(10)`' do
1419
- @layout.context(NSView.new) do
1426
+ @layout.context(@view) do
1420
1427
  @layout.constraints do
1421
1428
  @constraint = @layout.width.equals(:another_view).times(2).plus(10)
1422
1429
  end
@@ -1429,7 +1436,7 @@ describe 'Constraints helpers' do
1429
1436
  @constraint.attribute2.should == :width
1430
1437
  end
1431
1438
  it 'should support `min_width.equals(:another_view).times(2).plus(10)`' do
1432
- @layout.context(NSView.new) do
1439
+ @layout.context(@view) do
1433
1440
  @layout.constraints do
1434
1441
  @constraint = @layout.min_width.equals(:another_view).times(2).plus(10)
1435
1442
  end
@@ -1442,7 +1449,7 @@ describe 'Constraints helpers' do
1442
1449
  @constraint.attribute2.should == :width
1443
1450
  end
1444
1451
  it 'should support `max_width.equals(:another_view).times(2).plus(10)`' do
1445
- @layout.context(NSView.new) do
1452
+ @layout.context(@view) do
1446
1453
  @layout.constraints do
1447
1454
  @constraint = @layout.max_width.equals(:another_view).times(2).plus(10)
1448
1455
  end
@@ -1458,7 +1465,7 @@ describe 'Constraints helpers' do
1458
1465
 
1459
1466
  describe '`height` support' do
1460
1467
  it 'should support `height 10`' do
1461
- @layout.context(NSView.new) do
1468
+ @layout.context(@view) do
1462
1469
  @layout.constraints do
1463
1470
  @constraint = @layout.height(10)
1464
1471
  end
@@ -1471,7 +1478,7 @@ describe 'Constraints helpers' do
1471
1478
  @constraint.attribute2.should == :height
1472
1479
  end
1473
1480
  it 'should support `min_height 10`' do
1474
- @layout.context(NSView.new) do
1481
+ @layout.context(@view) do
1475
1482
  @layout.constraints do
1476
1483
  @constraint = @layout.min_height(10)
1477
1484
  end
@@ -1484,7 +1491,7 @@ describe 'Constraints helpers' do
1484
1491
  @constraint.attribute2.should == :height
1485
1492
  end
1486
1493
  it 'should support `max_height 10`' do
1487
- @layout.context(NSView.new) do
1494
+ @layout.context(@view) do
1488
1495
  @layout.constraints do
1489
1496
  @constraint = @layout.max_height(10)
1490
1497
  end
@@ -1497,7 +1504,7 @@ describe 'Constraints helpers' do
1497
1504
  @constraint.attribute2.should == :height
1498
1505
  end
1499
1506
  it 'should support `height.equals(:another_view[, :height])`' do
1500
- @layout.context(NSView.new) do
1507
+ @layout.context(@view) do
1501
1508
  @layout.constraints do
1502
1509
  @constraint = @layout.height.equals(:another_view)
1503
1510
  end
@@ -1510,7 +1517,7 @@ describe 'Constraints helpers' do
1510
1517
  @constraint.attribute2.should == :height
1511
1518
  end
1512
1519
  it 'should support `min_height.equals(:another_view[, :height])`' do
1513
- @layout.context(NSView.new) do
1520
+ @layout.context(@view) do
1514
1521
  @layout.constraints do
1515
1522
  @constraint = @layout.min_height.equals(:another_view)
1516
1523
  end
@@ -1523,7 +1530,7 @@ describe 'Constraints helpers' do
1523
1530
  @constraint.attribute2.should == :height
1524
1531
  end
1525
1532
  it 'should support `max_height.equals(:another_view[, :height])`' do
1526
- @layout.context(NSView.new) do
1533
+ @layout.context(@view) do
1527
1534
  @layout.constraints do
1528
1535
  @constraint = @layout.max_height.equals(:another_view)
1529
1536
  end
@@ -1536,7 +1543,7 @@ describe 'Constraints helpers' do
1536
1543
  @constraint.attribute2.should == :height
1537
1544
  end
1538
1545
  it 'should support `height.equals(:another_view).plus(10)`' do
1539
- @layout.context(NSView.new) do
1546
+ @layout.context(@view) do
1540
1547
  @layout.constraints do
1541
1548
  @constraint = @layout.height.equals(:another_view).plus(10)
1542
1549
  end
@@ -1549,7 +1556,7 @@ describe 'Constraints helpers' do
1549
1556
  @constraint.attribute2.should == :height
1550
1557
  end
1551
1558
  it 'should support `min_height.equals(:another_view).plus(10)`' do
1552
- @layout.context(NSView.new) do
1559
+ @layout.context(@view) do
1553
1560
  @layout.constraints do
1554
1561
  @constraint = @layout.min_height.equals(:another_view).plus(10)
1555
1562
  end
@@ -1562,7 +1569,7 @@ describe 'Constraints helpers' do
1562
1569
  @constraint.attribute2.should == :height
1563
1570
  end
1564
1571
  it 'should support `max_height.equals(:another_view).plus(10)`' do
1565
- @layout.context(NSView.new) do
1572
+ @layout.context(@view) do
1566
1573
  @layout.constraints do
1567
1574
  @constraint = @layout.max_height.equals(:another_view).plus(10)
1568
1575
  end
@@ -1575,7 +1582,7 @@ describe 'Constraints helpers' do
1575
1582
  @constraint.attribute2.should == :height
1576
1583
  end
1577
1584
  it 'should support `height.equals(:another_view).times(2).plus(10)`' do
1578
- @layout.context(NSView.new) do
1585
+ @layout.context(@view) do
1579
1586
  @layout.constraints do
1580
1587
  @constraint = @layout.height.equals(:another_view).times(2).plus(10)
1581
1588
  end
@@ -1588,7 +1595,7 @@ describe 'Constraints helpers' do
1588
1595
  @constraint.attribute2.should == :height
1589
1596
  end
1590
1597
  it 'should support `min_height.equals(:another_view).times(2).plus(10)`' do
1591
- @layout.context(NSView.new) do
1598
+ @layout.context(@view) do
1592
1599
  @layout.constraints do
1593
1600
  @constraint = @layout.min_height.equals(:another_view).times(2).plus(10)
1594
1601
  end
@@ -1601,7 +1608,7 @@ describe 'Constraints helpers' do
1601
1608
  @constraint.attribute2.should == :height
1602
1609
  end
1603
1610
  it 'should support `max_height.equals(:another_view).times(2).plus(10)`' do
1604
- @layout.context(NSView.new) do
1611
+ @layout.context(@view) do
1605
1612
  @layout.constraints do
1606
1613
  @constraint = @layout.max_height.equals(:another_view).times(2).plus(10)
1607
1614
  end
@@ -1617,7 +1624,7 @@ describe 'Constraints helpers' do
1617
1624
 
1618
1625
  describe '`leading` support' do
1619
1626
  it 'should support `leading 10`' do
1620
- @layout.context(NSView.new) do
1627
+ @layout.context(@view) do
1621
1628
  @layout.constraints do
1622
1629
  @constraint = @layout.leading(10)
1623
1630
  end
@@ -1630,7 +1637,7 @@ describe 'Constraints helpers' do
1630
1637
  @constraint.attribute2.should == :leading
1631
1638
  end
1632
1639
  it 'should support `min_leading 10`' do
1633
- @layout.context(NSView.new) do
1640
+ @layout.context(@view) do
1634
1641
  @layout.constraints do
1635
1642
  @constraint = @layout.min_leading(10)
1636
1643
  end
@@ -1643,7 +1650,7 @@ describe 'Constraints helpers' do
1643
1650
  @constraint.attribute2.should == :leading
1644
1651
  end
1645
1652
  it 'should support `max_leading 10`' do
1646
- @layout.context(NSView.new) do
1653
+ @layout.context(@view) do
1647
1654
  @layout.constraints do
1648
1655
  @constraint = @layout.max_leading(10)
1649
1656
  end
@@ -1656,7 +1663,7 @@ describe 'Constraints helpers' do
1656
1663
  @constraint.attribute2.should == :leading
1657
1664
  end
1658
1665
  it 'should support `leading.equals(:another_view[, :leading])`' do
1659
- @layout.context(NSView.new) do
1666
+ @layout.context(@view) do
1660
1667
  @layout.constraints do
1661
1668
  @constraint = @layout.leading.equals(:another_view)
1662
1669
  end
@@ -1669,7 +1676,7 @@ describe 'Constraints helpers' do
1669
1676
  @constraint.attribute2.should == :leading
1670
1677
  end
1671
1678
  it 'should support `min_leading.equals(:another_view[, :leading])`' do
1672
- @layout.context(NSView.new) do
1679
+ @layout.context(@view) do
1673
1680
  @layout.constraints do
1674
1681
  @constraint = @layout.min_leading.equals(:another_view)
1675
1682
  end
@@ -1682,7 +1689,7 @@ describe 'Constraints helpers' do
1682
1689
  @constraint.attribute2.should == :leading
1683
1690
  end
1684
1691
  it 'should support `max_leading.equals(:another_view[, :leading])`' do
1685
- @layout.context(NSView.new) do
1692
+ @layout.context(@view) do
1686
1693
  @layout.constraints do
1687
1694
  @constraint = @layout.max_leading.equals(:another_view)
1688
1695
  end
@@ -1695,7 +1702,7 @@ describe 'Constraints helpers' do
1695
1702
  @constraint.attribute2.should == :leading
1696
1703
  end
1697
1704
  it 'should support `leading.equals(:another_view).plus(10)`' do
1698
- @layout.context(NSView.new) do
1705
+ @layout.context(@view) do
1699
1706
  @layout.constraints do
1700
1707
  @constraint = @layout.leading.equals(:another_view).plus(10)
1701
1708
  end
@@ -1708,7 +1715,7 @@ describe 'Constraints helpers' do
1708
1715
  @constraint.attribute2.should == :leading
1709
1716
  end
1710
1717
  it 'should support `min_leading.equals(:another_view).plus(10)`' do
1711
- @layout.context(NSView.new) do
1718
+ @layout.context(@view) do
1712
1719
  @layout.constraints do
1713
1720
  @constraint = @layout.min_leading.equals(:another_view).plus(10)
1714
1721
  end
@@ -1721,7 +1728,7 @@ describe 'Constraints helpers' do
1721
1728
  @constraint.attribute2.should == :leading
1722
1729
  end
1723
1730
  it 'should support `max_leading.equals(:another_view).plus(10)`' do
1724
- @layout.context(NSView.new) do
1731
+ @layout.context(@view) do
1725
1732
  @layout.constraints do
1726
1733
  @constraint = @layout.max_leading.equals(:another_view).plus(10)
1727
1734
  end
@@ -1734,7 +1741,7 @@ describe 'Constraints helpers' do
1734
1741
  @constraint.attribute2.should == :leading
1735
1742
  end
1736
1743
  it 'should support `leading.equals(:another_view).times(2).plus(10)`' do
1737
- @layout.context(NSView.new) do
1744
+ @layout.context(@view) do
1738
1745
  @layout.constraints do
1739
1746
  @constraint = @layout.leading.equals(:another_view).times(2).plus(10)
1740
1747
  end
@@ -1747,7 +1754,7 @@ describe 'Constraints helpers' do
1747
1754
  @constraint.attribute2.should == :leading
1748
1755
  end
1749
1756
  it 'should support `min_leading.equals(:another_view).times(2).plus(10)`' do
1750
- @layout.context(NSView.new) do
1757
+ @layout.context(@view) do
1751
1758
  @layout.constraints do
1752
1759
  @constraint = @layout.min_leading.equals(:another_view).times(2).plus(10)
1753
1760
  end
@@ -1760,7 +1767,7 @@ describe 'Constraints helpers' do
1760
1767
  @constraint.attribute2.should == :leading
1761
1768
  end
1762
1769
  it 'should support `max_leading.equals(:another_view).times(2).plus(10)`' do
1763
- @layout.context(NSView.new) do
1770
+ @layout.context(@view) do
1764
1771
  @layout.constraints do
1765
1772
  @constraint = @layout.max_leading.equals(:another_view).times(2).plus(10)
1766
1773
  end
@@ -1776,7 +1783,7 @@ describe 'Constraints helpers' do
1776
1783
 
1777
1784
  describe '`trailing` support' do
1778
1785
  it 'should support `trailing 10`' do
1779
- @layout.context(NSView.new) do
1786
+ @layout.context(@view) do
1780
1787
  @layout.constraints do
1781
1788
  @constraint = @layout.trailing(10)
1782
1789
  end
@@ -1789,7 +1796,7 @@ describe 'Constraints helpers' do
1789
1796
  @constraint.attribute2.should == :trailing
1790
1797
  end
1791
1798
  it 'should support `min_trailing 10`' do
1792
- @layout.context(NSView.new) do
1799
+ @layout.context(@view) do
1793
1800
  @layout.constraints do
1794
1801
  @constraint = @layout.min_trailing(10)
1795
1802
  end
@@ -1802,7 +1809,7 @@ describe 'Constraints helpers' do
1802
1809
  @constraint.attribute2.should == :trailing
1803
1810
  end
1804
1811
  it 'should support `max_trailing 10`' do
1805
- @layout.context(NSView.new) do
1812
+ @layout.context(@view) do
1806
1813
  @layout.constraints do
1807
1814
  @constraint = @layout.max_trailing(10)
1808
1815
  end
@@ -1815,7 +1822,7 @@ describe 'Constraints helpers' do
1815
1822
  @constraint.attribute2.should == :trailing
1816
1823
  end
1817
1824
  it 'should support `trailing.equals(:another_view[, :trailing])`' do
1818
- @layout.context(NSView.new) do
1825
+ @layout.context(@view) do
1819
1826
  @layout.constraints do
1820
1827
  @constraint = @layout.trailing.equals(:another_view)
1821
1828
  end
@@ -1828,7 +1835,7 @@ describe 'Constraints helpers' do
1828
1835
  @constraint.attribute2.should == :trailing
1829
1836
  end
1830
1837
  it 'should support `min_trailing.equals(:another_view[, :trailing])`' do
1831
- @layout.context(NSView.new) do
1838
+ @layout.context(@view) do
1832
1839
  @layout.constraints do
1833
1840
  @constraint = @layout.min_trailing.equals(:another_view)
1834
1841
  end
@@ -1841,7 +1848,7 @@ describe 'Constraints helpers' do
1841
1848
  @constraint.attribute2.should == :trailing
1842
1849
  end
1843
1850
  it 'should support `max_trailing.equals(:another_view[, :trailing])`' do
1844
- @layout.context(NSView.new) do
1851
+ @layout.context(@view) do
1845
1852
  @layout.constraints do
1846
1853
  @constraint = @layout.max_trailing.equals(:another_view)
1847
1854
  end
@@ -1854,7 +1861,7 @@ describe 'Constraints helpers' do
1854
1861
  @constraint.attribute2.should == :trailing
1855
1862
  end
1856
1863
  it 'should support `trailing.equals(:another_view).plus(10)`' do
1857
- @layout.context(NSView.new) do
1864
+ @layout.context(@view) do
1858
1865
  @layout.constraints do
1859
1866
  @constraint = @layout.trailing.equals(:another_view).plus(10)
1860
1867
  end
@@ -1867,7 +1874,7 @@ describe 'Constraints helpers' do
1867
1874
  @constraint.attribute2.should == :trailing
1868
1875
  end
1869
1876
  it 'should support `min_trailing.equals(:another_view).plus(10)`' do
1870
- @layout.context(NSView.new) do
1877
+ @layout.context(@view) do
1871
1878
  @layout.constraints do
1872
1879
  @constraint = @layout.min_trailing.equals(:another_view).plus(10)
1873
1880
  end
@@ -1880,7 +1887,7 @@ describe 'Constraints helpers' do
1880
1887
  @constraint.attribute2.should == :trailing
1881
1888
  end
1882
1889
  it 'should support `max_trailing.equals(:another_view).plus(10)`' do
1883
- @layout.context(NSView.new) do
1890
+ @layout.context(@view) do
1884
1891
  @layout.constraints do
1885
1892
  @constraint = @layout.max_trailing.equals(:another_view).plus(10)
1886
1893
  end
@@ -1893,7 +1900,7 @@ describe 'Constraints helpers' do
1893
1900
  @constraint.attribute2.should == :trailing
1894
1901
  end
1895
1902
  it 'should support `trailing.equals(:another_view).times(2).plus(10)`' do
1896
- @layout.context(NSView.new) do
1903
+ @layout.context(@view) do
1897
1904
  @layout.constraints do
1898
1905
  @constraint = @layout.trailing.equals(:another_view).times(2).plus(10)
1899
1906
  end
@@ -1906,7 +1913,7 @@ describe 'Constraints helpers' do
1906
1913
  @constraint.attribute2.should == :trailing
1907
1914
  end
1908
1915
  it 'should support `min_trailing.equals(:another_view).times(2).plus(10)`' do
1909
- @layout.context(NSView.new) do
1916
+ @layout.context(@view) do
1910
1917
  @layout.constraints do
1911
1918
  @constraint = @layout.min_trailing.equals(:another_view).times(2).plus(10)
1912
1919
  end
@@ -1919,7 +1926,7 @@ describe 'Constraints helpers' do
1919
1926
  @constraint.attribute2.should == :trailing
1920
1927
  end
1921
1928
  it 'should support `max_trailing.equals(:another_view).times(2).plus(10)`' do
1922
- @layout.context(NSView.new) do
1929
+ @layout.context(@view) do
1923
1930
  @layout.constraints do
1924
1931
  @constraint = @layout.max_trailing.equals(:another_view).times(2).plus(10)
1925
1932
  end
@@ -1935,7 +1942,7 @@ describe 'Constraints helpers' do
1935
1942
 
1936
1943
  describe '`baseline` support' do
1937
1944
  it 'should support `baseline 10`' do
1938
- @layout.context(NSView.new) do
1945
+ @layout.context(@view) do
1939
1946
  @layout.constraints do
1940
1947
  @constraint = @layout.baseline(10)
1941
1948
  end
@@ -1948,7 +1955,7 @@ describe 'Constraints helpers' do
1948
1955
  @constraint.attribute2.should == :baseline
1949
1956
  end
1950
1957
  it 'should support `min_baseline 10`' do
1951
- @layout.context(NSView.new) do
1958
+ @layout.context(@view) do
1952
1959
  @layout.constraints do
1953
1960
  @constraint = @layout.min_baseline(10)
1954
1961
  end
@@ -1961,7 +1968,7 @@ describe 'Constraints helpers' do
1961
1968
  @constraint.attribute2.should == :baseline
1962
1969
  end
1963
1970
  it 'should support `max_baseline 10`' do
1964
- @layout.context(NSView.new) do
1971
+ @layout.context(@view) do
1965
1972
  @layout.constraints do
1966
1973
  @constraint = @layout.max_baseline(10)
1967
1974
  end
@@ -1974,7 +1981,7 @@ describe 'Constraints helpers' do
1974
1981
  @constraint.attribute2.should == :baseline
1975
1982
  end
1976
1983
  it 'should support `baseline.equals(:another_view[, :baseline])`' do
1977
- @layout.context(NSView.new) do
1984
+ @layout.context(@view) do
1978
1985
  @layout.constraints do
1979
1986
  @constraint = @layout.baseline.equals(:another_view)
1980
1987
  end
@@ -1987,7 +1994,7 @@ describe 'Constraints helpers' do
1987
1994
  @constraint.attribute2.should == :baseline
1988
1995
  end
1989
1996
  it 'should support `min_baseline.equals(:another_view[, :baseline])`' do
1990
- @layout.context(NSView.new) do
1997
+ @layout.context(@view) do
1991
1998
  @layout.constraints do
1992
1999
  @constraint = @layout.min_baseline.equals(:another_view)
1993
2000
  end
@@ -2000,7 +2007,7 @@ describe 'Constraints helpers' do
2000
2007
  @constraint.attribute2.should == :baseline
2001
2008
  end
2002
2009
  it 'should support `max_baseline.equals(:another_view[, :baseline])`' do
2003
- @layout.context(NSView.new) do
2010
+ @layout.context(@view) do
2004
2011
  @layout.constraints do
2005
2012
  @constraint = @layout.max_baseline.equals(:another_view)
2006
2013
  end
@@ -2013,7 +2020,7 @@ describe 'Constraints helpers' do
2013
2020
  @constraint.attribute2.should == :baseline
2014
2021
  end
2015
2022
  it 'should support `baseline.equals(:another_view).plus(10)`' do
2016
- @layout.context(NSView.new) do
2023
+ @layout.context(@view) do
2017
2024
  @layout.constraints do
2018
2025
  @constraint = @layout.baseline.equals(:another_view).plus(10)
2019
2026
  end
@@ -2026,7 +2033,7 @@ describe 'Constraints helpers' do
2026
2033
  @constraint.attribute2.should == :baseline
2027
2034
  end
2028
2035
  it 'should support `min_baseline.equals(:another_view).plus(10)`' do
2029
- @layout.context(NSView.new) do
2036
+ @layout.context(@view) do
2030
2037
  @layout.constraints do
2031
2038
  @constraint = @layout.min_baseline.equals(:another_view).plus(10)
2032
2039
  end
@@ -2039,7 +2046,7 @@ describe 'Constraints helpers' do
2039
2046
  @constraint.attribute2.should == :baseline
2040
2047
  end
2041
2048
  it 'should support `max_baseline.equals(:another_view).plus(10)`' do
2042
- @layout.context(NSView.new) do
2049
+ @layout.context(@view) do
2043
2050
  @layout.constraints do
2044
2051
  @constraint = @layout.max_baseline.equals(:another_view).plus(10)
2045
2052
  end
@@ -2052,7 +2059,7 @@ describe 'Constraints helpers' do
2052
2059
  @constraint.attribute2.should == :baseline
2053
2060
  end
2054
2061
  it 'should support `baseline.equals(:another_view).times(2).plus(10)`' do
2055
- @layout.context(NSView.new) do
2062
+ @layout.context(@view) do
2056
2063
  @layout.constraints do
2057
2064
  @constraint = @layout.baseline.equals(:another_view).times(2).plus(10)
2058
2065
  end
@@ -2065,7 +2072,7 @@ describe 'Constraints helpers' do
2065
2072
  @constraint.attribute2.should == :baseline
2066
2073
  end
2067
2074
  it 'should support `min_baseline.equals(:another_view).times(2).plus(10)`' do
2068
- @layout.context(NSView.new) do
2075
+ @layout.context(@view) do
2069
2076
  @layout.constraints do
2070
2077
  @constraint = @layout.min_baseline.equals(:another_view).times(2).plus(10)
2071
2078
  end
@@ -2078,7 +2085,7 @@ describe 'Constraints helpers' do
2078
2085
  @constraint.attribute2.should == :baseline
2079
2086
  end
2080
2087
  it 'should support `max_baseline.equals(:another_view).times(2).plus(10)`' do
2081
- @layout.context(NSView.new) do
2088
+ @layout.context(@view) do
2082
2089
  @layout.constraints do
2083
2090
  @constraint = @layout.max_baseline.equals(:another_view).times(2).plus(10)
2084
2091
  end