<NME> size_constraints_spec.rb
<BEF> describe 'Size constraints helpers' do

  before do
    @layout = MK::Layout.new
    @constraint = nil
    @view = nil
    @another_view = nil
  end

  it 'should support `size 10`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.size(10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :equal
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == nil
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `min_size 10`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.min_size(10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :gte
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == nil
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `max_size 10`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.max_size(10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :lte
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == nil
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `size [10, 10]`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.size([10, 10])
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :equal
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == nil
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `min_size [10, 10]`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.min_size([10, 10])
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :gte
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == nil
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `max_size [10, 10]`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.max_size([10, 10])
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :lte
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == nil
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `size w: 10, h: 10`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.size(w: 10, h: 10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :equal
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == nil
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `min_size w: 10, h: 10`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.min_size(w: 10, h: 10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :gte
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == nil
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `max_size w: 10, h: 10`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.max_size(w: 10, h: 10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :lte
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == nil
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `size.equals(:another_view[, :size])`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.size.equals(:another_view)
      end
    end
    @constraint.constant.should == [0, 0]
    @constraint.relationship.should == :equal
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `size.equals(:another_view).plus(10).plus([5, 10])`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.size.equals(:another_view).plus(10).plus([5, 10])
      end
    end
    @constraint.constant.should == [15, 20]
    @constraint.relationship.should == :equal
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `min_size.equals(:another_view[, :size])`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.min_size.equals(:another_view)
      end
    end
    @constraint.constant.should == [0, 0]
    @constraint.relationship.should == :gte
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `max_size.equals(:another_view[, :size])`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.max_size.equals(:another_view)
      end
    end
    @constraint.constant.should == [0, 0]
    @constraint.relationship.should == :lte
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `size.equals(:another_view).plus(10)`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.size.equals(:another_view).plus(10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :equal
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `min_size.equals(:another_view).plus(10)`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.min_size.equals(:another_view).plus(10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :gte
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `max_size.equals(:another_view).plus(10)`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.max_size.equals(:another_view).plus(10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :lte
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `size.equals(:another_view).plus([10, 10])`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.size.equals(:another_view).plus([10, 10])
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :equal
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `min_size.equals(:another_view).plus([10, 10])`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.min_size.equals(:another_view).plus([10, 10])
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :gte
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `max_size.equals(:another_view).plus(w: 10, h: 10)`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.max_size.equals(:another_view).plus(w: 10, h: 10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :lte
    @constraint.multiplier.should == [1, 1]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `size.equals(:another_view).times(2).plus(10)`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.size.equals(:another_view).times(2).plus(10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :equal
    @constraint.multiplier.should == [2, 2]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `min_size.equals(:another_view).times(2).plus(10)`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.min_size.equals(:another_view).times(2).plus(10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :gte
    @constraint.multiplier.should == [2, 2]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `max_size.equals(:another_view).times(2).plus(10)`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.max_size.equals(:another_view).times(2).plus(10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :lte
    @constraint.multiplier.should == [2, 2]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `size.equals(:another_view).times([2, 2]).plus(10)`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.size.equals(:another_view).times([2, 2]).plus(10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :equal
    @constraint.multiplier.should == [2, 2]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `min_size.equals(:another_view).times([2, 2]).plus(10)`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.min_size.equals(:another_view).times([2, 2]).plus(10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :gte
    @constraint.multiplier.should == [2, 2]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `max_size.equals(:another_view).times(w: 2, h: 2).plus(10)`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.max_size.equals(:another_view).times(w: 2, h: 2).plus(10)
      end
    end
    @constraint.constant.should == [10, 10]
    @constraint.relationship.should == :lte
    @constraint.multiplier.should == [2, 2]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `size.equals(:another_view).times(2).times([3, 4])`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.size.equals(:another_view).times(2).times([3, 4])
      end
    end
    @constraint.constant.should == [0, 0]
    @constraint.relationship.should == :equal
    @constraint.multiplier.should == [6, 8]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end
  it 'should support `size.equals(:another_view).divided_by(2)`' do
    @layout.context(NSView.new) do
      @layout.constraints do
        @constraint = @layout.size.equals(:another_view).divided_by(2)
      end
    end
    @constraint.constant.should == [0, 0]
    @constraint.relationship.should == :equal
    @constraint.multiplier.should == [0.5, 0.5]
    @constraint.relative_to.should == :another_view
    @constraint.attribute.should == [:width, :height]
    @constraint.attribute2.should == [:width, :height]
  end

end

<MSG> fixes to constraints and specs

<DFF> @@ -1,18 +1,21 @@
-describe 'Size constraints helpers' do
+describe 'Constraints - Size helpers' do
 
   before do
     @layout = MK::Layout.new
     @constraint = nil
-    @view = nil
+    @view = NSView.new
+    @parent_view = NSView.new
+    @parent_view.addSubview(@view)
     @another_view = nil
   end
 
   it 'should support `size 10`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.size(10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :equal
     @constraint.multiplier.should == [1, 1]
@@ -20,12 +23,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `min_size 10`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.min_size(10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :gte
     @constraint.multiplier.should == [1, 1]
@@ -33,12 +38,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `max_size 10`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.max_size(10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :lte
     @constraint.multiplier.should == [1, 1]
@@ -46,12 +53,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `size [10, 10]`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.size([10, 10])
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :equal
     @constraint.multiplier.should == [1, 1]
@@ -59,12 +68,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `min_size [10, 10]`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.min_size([10, 10])
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :gte
     @constraint.multiplier.should == [1, 1]
@@ -72,12 +83,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `max_size [10, 10]`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.max_size([10, 10])
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :lte
     @constraint.multiplier.should == [1, 1]
@@ -85,12 +98,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `size w: 10, h: 10`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.size(w: 10, h: 10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :equal
     @constraint.multiplier.should == [1, 1]
@@ -98,12 +113,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `min_size w: 10, h: 10`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.min_size(w: 10, h: 10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :gte
     @constraint.multiplier.should == [1, 1]
@@ -111,12 +128,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `max_size w: 10, h: 10`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.max_size(w: 10, h: 10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :lte
     @constraint.multiplier.should == [1, 1]
@@ -124,12 +143,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `size.equals(:another_view[, :size])`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.size.equals(:another_view)
       end
     end
+
     @constraint.constant.should == [0, 0]
     @constraint.relationship.should == :equal
     @constraint.multiplier.should == [1, 1]
@@ -137,12 +158,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `size.equals(:another_view).plus(10).plus([5, 10])`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.size.equals(:another_view).plus(10).plus([5, 10])
       end
     end
+
     @constraint.constant.should == [15, 20]
     @constraint.relationship.should == :equal
     @constraint.multiplier.should == [1, 1]
@@ -150,12 +173,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `min_size.equals(:another_view[, :size])`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.min_size.equals(:another_view)
       end
     end
+
     @constraint.constant.should == [0, 0]
     @constraint.relationship.should == :gte
     @constraint.multiplier.should == [1, 1]
@@ -163,12 +188,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `max_size.equals(:another_view[, :size])`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.max_size.equals(:another_view)
       end
     end
+
     @constraint.constant.should == [0, 0]
     @constraint.relationship.should == :lte
     @constraint.multiplier.should == [1, 1]
@@ -176,12 +203,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `size.equals(:another_view).plus(10)`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.size.equals(:another_view).plus(10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :equal
     @constraint.multiplier.should == [1, 1]
@@ -189,12 +218,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `min_size.equals(:another_view).plus(10)`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.min_size.equals(:another_view).plus(10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :gte
     @constraint.multiplier.should == [1, 1]
@@ -202,12 +233,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `max_size.equals(:another_view).plus(10)`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.max_size.equals(:another_view).plus(10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :lte
     @constraint.multiplier.should == [1, 1]
@@ -215,12 +248,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `size.equals(:another_view).plus([10, 10])`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.size.equals(:another_view).plus([10, 10])
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :equal
     @constraint.multiplier.should == [1, 1]
@@ -228,12 +263,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `min_size.equals(:another_view).plus([10, 10])`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.min_size.equals(:another_view).plus([10, 10])
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :gte
     @constraint.multiplier.should == [1, 1]
@@ -241,12 +278,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `max_size.equals(:another_view).plus(w: 10, h: 10)`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.max_size.equals(:another_view).plus(w: 10, h: 10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :lte
     @constraint.multiplier.should == [1, 1]
@@ -254,12 +293,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `size.equals(:another_view).times(2).plus(10)`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.size.equals(:another_view).times(2).plus(10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :equal
     @constraint.multiplier.should == [2, 2]
@@ -267,12 +308,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `min_size.equals(:another_view).times(2).plus(10)`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.min_size.equals(:another_view).times(2).plus(10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :gte
     @constraint.multiplier.should == [2, 2]
@@ -280,12 +323,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `max_size.equals(:another_view).times(2).plus(10)`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.max_size.equals(:another_view).times(2).plus(10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :lte
     @constraint.multiplier.should == [2, 2]
@@ -293,12 +338,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `size.equals(:another_view).times([2, 2]).plus(10)`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.size.equals(:another_view).times([2, 2]).plus(10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :equal
     @constraint.multiplier.should == [2, 2]
@@ -306,12 +353,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `min_size.equals(:another_view).times([2, 2]).plus(10)`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.min_size.equals(:another_view).times([2, 2]).plus(10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :gte
     @constraint.multiplier.should == [2, 2]
@@ -319,12 +368,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `max_size.equals(:another_view).times(w: 2, h: 2).plus(10)`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.max_size.equals(:another_view).times(w: 2, h: 2).plus(10)
       end
     end
+
     @constraint.constant.should == [10, 10]
     @constraint.relationship.should == :lte
     @constraint.multiplier.should == [2, 2]
@@ -332,12 +383,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `size.equals(:another_view).times(2).times([3, 4])`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.size.equals(:another_view).times(2).times([3, 4])
       end
     end
+
     @constraint.constant.should == [0, 0]
     @constraint.relationship.should == :equal
     @constraint.multiplier.should == [6, 8]
@@ -345,12 +398,14 @@ describe 'Size constraints helpers' do
     @constraint.attribute.should == [:width, :height]
     @constraint.attribute2.should == [:width, :height]
   end
+
   it 'should support `size.equals(:another_view).divided_by(2)`' do
-    @layout.context(NSView.new) do
+    @layout.context(@view) do
       @layout.constraints do
         @constraint = @layout.size.equals(:another_view).divided_by(2)
       end
     end
+
     @constraint.constant.should == [0, 0]
     @constraint.relationship.should == :equal
     @constraint.multiplier.should == [0.5, 0.5]

{'commit': 'diff --git a/lib/motion-kit-cocoa/constraints/constraint.rb b/lib/motion-kit-cocoa/constraints/constraint.rb\nindex 02ab5f4..78d1ac0 100644\n--- a/lib/motion-kit-cocoa/constraints/constraint.rb\n+++ b/lib/motion-kit-cocoa/constraints/constraint.rb\n@@ -59,6 +59,8 @@ module MotionKit\n     # <=, and >=\n     #\n     # @example\n+    #     x.is(10)\n+    #     x.is(10).priority(:required)\n     #     x.is == 10\n     #     (x.is == 10).priority :required\n     #     width.is >= 100\n@@ -83,7 +85,7 @@ module MotionKit\n \n     def >=(compare)\n       if @compare_flag\n-        if @relationship && Constraint.relationship_lookup(@relationship) != NSLayoutRelationEqual\n+        if @relationship && Constraint.relationship_lookup(@relationship) != NSLayoutRelationGreaterThanOrEqual\n           raise InvalidRelationshipError.new("You cannot use `.is >=` on a constraint that is already defined as #{@relationship}")\n         end\n \n@@ -97,7 +99,7 @@ module MotionKit\n \n     def <=(compare)\n       if @compare_flag\n-        if @relationship && Constraint.relationship_lookup(@relationship) != NSLayoutRelationEqual\n+        if @relationship && Constraint.relationship_lookup(@relationship) != NSLayoutRelationLessThanOrEqual\n           raise InvalidRelationshipError.new("You cannot use `.is <=` on a constraint that is already defined as #{@relationship}")\n         end\n \n@@ -249,12 +251,15 @@ module MotionKit\n       @resolved ||= begin\n         item = Constraint.view_lookup(layout, view, self.target)\n         rel_item = Constraint.view_lookup(layout, view, self.relative_to)\n+        relationship = Constraint.relationship_lookup(self.relationship)\n+        attribute1 = Constraint.attribute_lookup(self.attribute)\n+        attribute2 = Constraint.attribute_lookup(self.attribute2)\n \n         nsconstraint = NSLayoutConstraint.constraintWithItem(item,\n-          attribute: Constraint.attribute_lookup(self.attribute),\n-          relatedBy: Constraint.relationship_lookup(self.relationship),\n+          attribute: attribute1,\n+          relatedBy: relationship,\n           toItem: rel_item,\n-          attribute: Constraint.attribute_lookup(self.attribute2),\n+          attribute: attribute2,\n           multiplier: self.multiplier,\n           constant: self.constant\n           )\n@@ -552,13 +557,15 @@ module MotionKit\n       @resolved ||= begin\n         item = Constraint.view_lookup(layout, view, self.target)\n         rel_item = Constraint.view_lookup(layout, view, self.relative_to)\n+        relationship = Constraint.relationship_lookup(self.relationship)\n \n-        [[:width, 0], [:height, 1]].map do |attribute, index|\n+        [[:width, 0], [:height, 1]].map do |attr_name, index|\n+          attribute = Constraint.attribute_lookup(attr_name)\n           nsconstraint = NSLayoutConstraint.constraintWithItem(item,\n-            attribute: Constraint.attribute_lookup(attribute),\n-            relatedBy: Constraint.relationship_lookup(self.relationship),\n+            attribute: attribute,\n+            relatedBy: relationship,\n             toItem: rel_item,\n-            attribute: Constraint.attribute_lookup(attribute),\n+            attribute: attribute,\n             multiplier: self.multiplier[index],\n             constant: self.constant[index]\n             )\n@@ -732,17 +739,20 @@ module MotionKit\n       @resolved ||= begin\n         item = Constraint.view_lookup(layout, view, self.target)\n         rel_item = Constraint.view_lookup(layout, view, self.relative_to)\n+        relationship = Constraint.relationship_lookup(self.relationship)\n \n         [0, 1].map do |index|\n           attribute = Constraint.attribute_lookup(self.attribute[index])\n+          mul = self.multiplier[index]\n+          const = self.constant[index]\n \n           nsconstraint = NSLayoutConstraint.constraintWithItem(item,\n             attribute: attribute,\n-            relatedBy: Constraint.relationship_lookup(self.relationship),\n+            relatedBy: relationship,\n             toItem: rel_item,\n             attribute: attribute,\n-            multiplier: self.multiplier[index],\n-            constant: self.constant[index]\n+            multiplier: mul,\n+            constant: const\n             )\n \n           if self.priority\ndiff --git a/lib/motion-kit-cocoa/constraints/constraints_layout.rb b/lib/motion-kit-cocoa/constraints/constraints_layout.rb\nindex 2cb7c47..19475a8 100644\n--- a/lib/motion-kit-cocoa/constraints/constraints_layout.rb\n+++ b/lib/motion-kit-cocoa/constraints/constraints_layout.rb\n@@ -22,7 +22,7 @@ module MotionKit\n       ConstraintPlaceholder.new(:nth, name, value)\n     end\n \n-    def x(value=nil, rel=:equal)\n+    def x(value=nil, rel=nil)\n       target_constraint(:left, rel, value)\n     end\n     alias left x\n@@ -37,7 +37,7 @@ module MotionKit\n     end\n     alias max_left max_x\n \n-    def leading(value=nil, rel=:equal)\n+    def leading(value=nil, rel=nil)\n       target_constraint(:leading, rel, value)\n     end\n \n@@ -49,7 +49,7 @@ module MotionKit\n       leading(value, :lte)\n     end\n \n-    def center_x(value=nil, rel=:equal)\n+    def center_x(value=nil, rel=nil)\n       target_constraint(:center_x, rel, value)\n     end\n \n@@ -61,7 +61,7 @@ module MotionKit\n       center_x(value, :lte)\n     end\n \n-    def right(value=nil, rel=:equal)\n+    def right(value=nil, rel=nil)\n       target_constraint(:right, rel, value)\n     end\n \n@@ -73,7 +73,7 @@ module MotionKit\n       right(value, :lte)\n     end\n \n-    def trailing(value=nil, rel=:equal)\n+    def trailing(value=nil, rel=nil)\n       target_constraint(:trailing, rel, value)\n     end\n \n@@ -85,7 +85,7 @@ module MotionKit\n       trailing(value, :lte)\n     end\n \n-    def y(value=nil, rel=:equal)\n+    def y(value=nil, rel=nil)\n       target_constraint(:top, rel, value)\n     end\n     alias top y\n@@ -100,7 +100,7 @@ module MotionKit\n     end\n     alias max_top max_y\n \n-    def center_y(value=nil, rel=:equal)\n+    def center_y(value=nil, rel=nil)\n       target_constraint(:center_y, rel, value)\n     end\n \n@@ -112,7 +112,7 @@ module MotionKit\n       center_y(value, :lte)\n     end\n \n-    def bottom(value=nil, rel=:equal)\n+    def bottom(value=nil, rel=nil)\n       target_constraint(:bottom, rel, value)\n     end\n \n@@ -124,7 +124,7 @@ module MotionKit\n       bottom(value, :lte)\n     end\n \n-    def baseline(value=nil, rel=:equal)\n+    def baseline(value=nil, rel=nil)\n       target_constraint(:baseline, rel, value)\n     end\n \n@@ -136,7 +136,7 @@ module MotionKit\n       baseline(value, :lte)\n     end\n \n-    def width(value=nil, rel=:equal)\n+    def width(value=nil, rel=nil)\n       target_constraint(:width, rel, value)\n     end\n     alias w width\n@@ -149,7 +149,7 @@ module MotionKit\n       width(value, :lte)\n     end\n \n-    def height(value=nil, rel=:equal)\n+    def height(value=nil, rel=nil)\n       target_constraint(:height, :equal, value)\n     end\n     alias h height\n@@ -162,7 +162,7 @@ module MotionKit\n       target_constraint(:height, :lte, value)\n     end\n \n-    def size(value=nil, rel=:equal)\n+    def size(value=nil, rel=nil)\n       target_constraint(:size, rel, value, SizeConstraint)\n     end\n \n@@ -174,7 +174,7 @@ module MotionKit\n       size(value, :lte)\n     end\n \n-    def center(value=nil, rel=:equal)\n+    def center(value=nil, rel=nil)\n       target_constraint([:center_x, :center_y], rel, value, PointConstraint)\n     end\n \n@@ -186,7 +186,7 @@ module MotionKit\n       center(value, :lte)\n     end\n \n-    def top_left(value=nil, rel=:equal)\n+    def top_left(value=nil, rel=nil)\n       target_constraint([:left, :top], rel, value, PointConstraint)\n     end\n     alias origin top_left\n@@ -201,7 +201,7 @@ module MotionKit\n     end\n     alias max_origin max_top_left\n \n-    def top_right(value=nil, rel=:equal)\n+    def top_right(value=nil, rel=nil)\n       target_constraint([:right, :top], rel, value, PointConstraint)\n     end\n \n@@ -213,7 +213,7 @@ module MotionKit\n       top_right(value, :lte)\n     end\n \n-    def bottom_left(value=nil, rel=:equal)\n+    def bottom_left(value=nil, rel=nil)\n       target_constraint([:left, :bottom], rel, value, PointConstraint)\n     end\n \n@@ -225,7 +225,7 @@ module MotionKit\n       bottom_left(value, :lte)\n     end\n \n-    def bottom_right(value=nil, rel=:equal)\n+    def bottom_right(value=nil, rel=nil)\n       target_constraint([:right, :bottom], rel, value, PointConstraint)\n     end\n \ndiff --git a/spec/ios/constraints_helpers/center_constraints_spec.rb b/spec/ios/constraints_helpers/center_constraints_spec.rb\nindex 1ab7309..dc5f73d 100644\n--- a/spec/ios/constraints_helpers/center_constraints_spec.rb\n+++ b/spec/ios/constraints_helpers/center_constraints_spec.rb\n@@ -3,12 +3,14 @@ describe \'Constraints - Center helpers\' do\n   before do\n     @layout = MK::Layout.new\n     @constraint = nil\n-    @view = nil\n+    @view = UIView.new\n+    @parent_view = UIView.new\n+    @parent_view.addSubview(@view)\n     @another_view = nil\n   end\n \n   it \'should support `center [10, 10]`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.center([10, 10])\n       end\n@@ -26,21 +28,21 @@ describe \'Constraints - Center helpers\' do\n     resolved[0].firstItem.should == @view\n     resolved[0].firstAttribute.should == NSLayoutAttributeCenterX\n     resolved[0].relation.should == NSLayoutRelationEqual\n-    resolved[0].secondItem.should == nil\n-    resolved[0].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+    resolved[0].secondItem.should == @parent_view\n+    resolved[0].secondAttribute.should == NSLayoutAttributeCenterX\n     resolved[0].multiplier.should == 1\n     resolved[0].constant.should == 10\n \n     resolved[1].firstItem.should == @view\n     resolved[1].firstAttribute.should == NSLayoutAttributeCenterY\n     resolved[1].relation.should == NSLayoutRelationEqual\n-    resolved[1].secondItem.should == nil\n-    resolved[1].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+    resolved[1].secondItem.should == @parent_view\n+    resolved[1].secondAttribute.should == NSLayoutAttributeCenterY\n     resolved[1].multiplier.should == 1\n     resolved[1].constant.should == 10\n   end\n   it \'should support `min_center [10, 10]`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_center([10, 10])\n       end\n@@ -54,7 +56,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `max_center [10, 10]`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_center([10, 10])\n       end\n@@ -68,7 +70,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `center x: 10, y: 10`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.center(x: 10, y: 10)\n       end\n@@ -82,7 +84,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `min_center x: 10, y: 10`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_center(x: 10, y: 10)\n       end\n@@ -96,7 +98,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `max_center x: 10, y: 10`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_center(x: 10, y: 10)\n       end\n@@ -110,7 +112,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `center.equals(:another_view[, :center])`\' do\n-    @top = @view = @layout.context(UIView.new) do\n+    @top = @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.center.equals(:another_view)\n@@ -125,7 +127,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `center.equals(:another_view).plus(10).plus([5, 10])`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.center.equals(:another_view).plus(10).plus([5, 10])\n@@ -140,7 +142,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `min_center.equals(:another_view[, :center])`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.min_center.equals(:another_view)\n@@ -173,7 +175,7 @@ describe \'Constraints - Center helpers\' do\n     resolved[1].constant.should == 0\n   end\n   it \'should support `max_center.equals(:another_view[, :center])`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.max_center.equals(:another_view)\n@@ -188,7 +190,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `center.equals(:another_view).plus(10)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.center.equals(:another_view).plus(10)\n@@ -203,7 +205,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `min_center.equals(:another_view).plus(10)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.min_center.equals(:another_view).plus(10)\n@@ -218,7 +220,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `max_center.equals(:another_view).plus(10)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.max_center.equals(:another_view).plus(10)\n@@ -233,7 +235,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `center.equals(:another_view).plus([10, 10])`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.center.equals(:another_view).plus([10, 10])\n@@ -248,7 +250,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `min_center.equals(:another_view).plus([10, 10])`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.min_center.equals(:another_view).plus([10, 10])\n@@ -263,7 +265,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `max_center.equals(:another_view).plus(x: 10, y: 10)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.max_center.equals(:another_view).plus(x: 10, y: 10)\n@@ -278,7 +280,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `center.equals(:another_view).times(2).plus(10)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.center.equals(:another_view).times(2).plus(10)\n@@ -293,7 +295,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `min_center.equals(:another_view).times(2).plus(10)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.min_center.equals(:another_view).times(2).plus(10)\n@@ -308,7 +310,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `max_center.equals(:another_view).times(2).plus(10)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.max_center.equals(:another_view).times(2).plus(10)\n@@ -341,7 +343,7 @@ describe \'Constraints - Center helpers\' do\n     resolved[1].constant.should == 10\n   end\n   it \'should support `center.equals(:another_view).times([2, 2]).plus(10)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.center.equals(:another_view).times([2, 2]).plus(10)\n@@ -356,7 +358,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `min_center.equals(:another_view).times([2, 2]).plus(10)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.min_center.equals(:another_view).times([2, 2]).plus(10)\n@@ -371,7 +373,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `max_center.equals(:another_view).times(x: 2, y: 2).plus(10)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.max_center.equals(:another_view).times(x: 2, y: 2).plus(10)\n@@ -386,7 +388,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `center.equals(:another_view).times(2).times([3, 4])`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.center.equals(:another_view).times(2).times([3, 4])\n@@ -401,7 +403,7 @@ describe \'Constraints - Center helpers\' do\n     @constraint.attribute2.should == [:center_x, :center_y]\n   end\n   it \'should support `center.equals(:another_view).divided_by(2)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.center.equals(:another_view).divided_by(2)\ndiff --git a/spec/ios/constraints_helpers/relative_corners_spec.rb b/spec/ios/constraints_helpers/relative_corners_spec.rb\nindex 4583287..fdc3f1f 100644\n--- a/spec/ios/constraints_helpers/relative_corners_spec.rb\n+++ b/spec/ios/constraints_helpers/relative_corners_spec.rb\n@@ -3,12 +3,14 @@ describe \'Constraints - Relative corners helpers\' do\n   before do\n     @layout = MK::Layout.new\n     @constraint = nil\n-    @view = nil\n+    @view = UIView.new\n+    @parent_view = UIView.new\n+    @parent_view.addSubview(@view)\n     @another_view = nil\n   end\n \n   it \'should support `top_left [10, 10]`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.top_left([10, 10])\n       end\n@@ -26,21 +28,21 @@ describe \'Constraints - Relative corners helpers\' do\n     resolved[0].firstItem.should == @view\n     resolved[0].firstAttribute.should == NSLayoutAttributeLeft\n     resolved[0].relation.should == NSLayoutRelationEqual\n-    resolved[0].secondItem.should == nil\n-    resolved[0].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+    resolved[0].secondItem.should == @parent_view\n+    resolved[0].secondAttribute.should == NSLayoutAttributeLeft\n     resolved[0].multiplier.should == 1\n     resolved[0].constant.should == 10\n \n     resolved[1].firstItem.should == @view\n     resolved[1].firstAttribute.should == NSLayoutAttributeTop\n     resolved[1].relation.should == NSLayoutRelationEqual\n-    resolved[1].secondItem.should == nil\n-    resolved[1].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+    resolved[1].secondItem.should == @parent_view\n+    resolved[1].secondAttribute.should == NSLayoutAttributeTop\n     resolved[1].multiplier.should == 1\n     resolved[1].constant.should == 10\n   end\n   it \'should support `top_left.equals(:another_view).plus(10).plus([5, 10])`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.top_left.equals(:another_view).plus(10).plus([5, 10])\n@@ -74,7 +76,7 @@ describe \'Constraints - Relative corners helpers\' do\n   end\n \n   it \'should support `top_right [10, 10]`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.top_right([10, 10])\n       end\n@@ -92,21 +94,21 @@ describe \'Constraints - Relative corners helpers\' do\n     resolved[0].firstItem.should == @view\n     resolved[0].firstAttribute.should == NSLayoutAttributeRight\n     resolved[0].relation.should == NSLayoutRelationEqual\n-    resolved[0].secondItem.should == nil\n-    resolved[0].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+    resolved[0].secondItem.should == @parent_view\n+    resolved[0].secondAttribute.should == NSLayoutAttributeRight\n     resolved[0].multiplier.should == 1\n     resolved[0].constant.should == 10\n \n     resolved[1].firstItem.should == @view\n     resolved[1].firstAttribute.should == NSLayoutAttributeTop\n     resolved[1].relation.should == NSLayoutRelationEqual\n-    resolved[1].secondItem.should == nil\n-    resolved[1].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+    resolved[1].secondItem.should == @parent_view\n+    resolved[1].secondAttribute.should == NSLayoutAttributeTop\n     resolved[1].multiplier.should == 1\n     resolved[1].constant.should == 10\n   end\n   it \'should support `top_right.equals(:another_view).plus(10).plus([5, 10])`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.top_right.equals(:another_view).plus(10).plus([5, 10])\n@@ -140,7 +142,7 @@ describe \'Constraints - Relative corners helpers\' do\n   end\n \n   it \'should support `bottom_left [10, 10]`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.bottom_left([10, 10])\n       end\n@@ -158,21 +160,21 @@ describe \'Constraints - Relative corners helpers\' do\n     resolved[0].firstItem.should == @view\n     resolved[0].firstAttribute.should == NSLayoutAttributeLeft\n     resolved[0].relation.should == NSLayoutRelationEqual\n-    resolved[0].secondItem.should == nil\n-    resolved[0].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+    resolved[0].secondItem.should == @parent_view\n+    resolved[0].secondAttribute.should == NSLayoutAttributeLeft\n     resolved[0].multiplier.should == 1\n     resolved[0].constant.should == 10\n \n     resolved[1].firstItem.should == @view\n     resolved[1].firstAttribute.should == NSLayoutAttributeBottom\n     resolved[1].relation.should == NSLayoutRelationEqual\n-    resolved[1].secondItem.should == nil\n-    resolved[1].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+    resolved[1].secondItem.should == @parent_view\n+    resolved[1].secondAttribute.should == NSLayoutAttributeBottom\n     resolved[1].multiplier.should == 1\n     resolved[1].constant.should == 10\n   end\n   it \'should support `bottom_left.equals(:another_view).plus(10).plus([5, 10])`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.bottom_left.equals(:another_view).plus(10).plus([5, 10])\n@@ -206,7 +208,7 @@ describe \'Constraints - Relative corners helpers\' do\n   end\n \n   it \'should support `bottom_right [10, 10]`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.bottom_right([10, 10])\n       end\n@@ -224,21 +226,21 @@ describe \'Constraints - Relative corners helpers\' do\n     resolved[0].firstItem.should == @view\n     resolved[0].firstAttribute.should == NSLayoutAttributeRight\n     resolved[0].relation.should == NSLayoutRelationEqual\n-    resolved[0].secondItem.should == nil\n-    resolved[0].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+    resolved[0].secondItem.should == @parent_view\n+    resolved[0].secondAttribute.should == NSLayoutAttributeRight\n     resolved[0].multiplier.should == 1\n     resolved[0].constant.should == 10\n \n     resolved[1].firstItem.should == @view\n     resolved[1].firstAttribute.should == NSLayoutAttributeBottom\n     resolved[1].relation.should == NSLayoutRelationEqual\n-    resolved[1].secondItem.should == nil\n-    resolved[1].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+    resolved[1].secondItem.should == @parent_view\n+    resolved[1].secondAttribute.should == NSLayoutAttributeBottom\n     resolved[1].multiplier.should == 1\n     resolved[1].constant.should == 10\n   end\n   it \'should support `bottom_right.equals(:another_view).plus(10).plus([5, 10])`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.bottom_right.equals(:another_view).plus(10).plus([5, 10])\ndiff --git a/spec/ios/constraints_helpers/relative_location_spec.rb b/spec/ios/constraints_helpers/relative_location_spec.rb\nindex 09c1b06..780a0ea 100644\n--- a/spec/ios/constraints_helpers/relative_location_spec.rb\n+++ b/spec/ios/constraints_helpers/relative_location_spec.rb\n@@ -3,12 +3,14 @@ describe \'Constraints - Relative location helpers\' do\n   before do\n     @layout = MK::Layout.new\n     @constraint = nil\n-    @view = nil\n+    @view = UIView.new\n+    @parent_view = UIView.new\n+    @parent_view.addSubview(@view)\n     @another_view = nil\n   end\n \n   it \'should support `above(:another_view)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.above(:another_view)\n@@ -33,7 +35,7 @@ describe \'Constraints - Relative location helpers\' do\n     resolved[0].constant.should == 0\n   end\n   it \'should support `below(:another_view)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.below(:another_view)\n@@ -58,7 +60,7 @@ describe \'Constraints - Relative location helpers\' do\n     resolved[0].constant.should == 0\n   end\n   it \'should support `before(:another_view)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.before(:another_view)\n@@ -83,7 +85,7 @@ describe \'Constraints - Relative location helpers\' do\n     resolved[0].constant.should == 0\n   end\n   it \'should support `after(:another_view)`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n       @layout.constraints do\n         @constraint = @layout.after(:another_view)\ndiff --git a/spec/ios/constraints_helpers/simple_constraints_spec.rb b/spec/ios/constraints_helpers/simple_constraints_spec.rb\nindex 43ce6a1..a6b9d1a 100644\n--- a/spec/ios/constraints_helpers/simple_constraints_spec.rb\n+++ b/spec/ios/constraints_helpers/simple_constraints_spec.rb\n@@ -3,13 +3,15 @@ describe \'Constraints - Simple helpers\' do\n   before do\n     @layout = MotionKit::Layout.new\n     @constraint = nil\n-    @view = nil\n+    @view = UIView.new\n+    @parent_view = UIView.new\n+    @parent_view.addSubview(@view)\n     @another_view = nil\n   end\n \n   describe \'`x/left` support\' do\n     it \'should support `x 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.x(10)\n         end\n@@ -27,13 +29,13 @@ describe \'Constraints - Simple helpers\' do\n       resolved[0].firstItem.should.be.kind_of(UIView)\n       resolved[0].firstAttribute.should == NSLayoutAttributeLeft\n       resolved[0].relation.should == NSLayoutRelationEqual\n-      resolved[0].secondItem.should == nil\n-      resolved[0].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+      resolved[0].secondItem.should == @parent_view\n+      resolved[0].secondAttribute.should == NSLayoutAttributeLeft\n       resolved[0].multiplier.should == 1\n       resolved[0].constant.should == 10\n     end\n     it \'should update the constraint\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.x(10)\n         end\n@@ -49,7 +51,7 @@ describe \'Constraints - Simple helpers\' do\n       resolved[0].constant.should == 100\n     end\n     it \'should support `x.is == 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.x.is == 10\n         end\n@@ -63,7 +65,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `x.is <= 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.x.is <= 10\n         end\n@@ -77,7 +79,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `min_x.is == 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_x.is == 10\n         end\n@@ -91,17 +93,16 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should NOT support `min_x.is >= 10`\' do\n-      @layout.context(UIView.new) do\n-        @layout.constraints do\n-          -> do\n-            @layout.min_x.is >= 10\n-          end.should.raise(MotionKit::InvalidRelationshipError)\n+      -> do\n+        @layout.context(@view) do\n+          @layout.constraints do\n+              p @layout.min_x.is <= 10\n+          end\n         end\n-      end\n-\n+      end.should.raise(MotionKit::InvalidRelationshipError)\n     end\n     it \'should support `(x.is >= 10).priority(:low)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = (@layout.x.is >= 10).priority(:low)\n         end\n@@ -116,7 +117,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.priority.should == :low\n     end\n     it \'should support `min_x 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_x(10)\n         end\n@@ -130,7 +131,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `min_x.equals "50%"`\' do\n-      @superview = @layout.context(UIView.new) do\n+      @layout.context(@parent_view) do\n         @view = @layout.add(UIView.new) do\n           @layout.constraints do\n             @constraint = @layout.min_x(\'50%\')\n@@ -146,7 +147,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `min_x.equals("50%").of(:another_view)`\' do\n-      @superview = @layout.context(UIView.new) do\n+      @layout.context(@parent_view) do\n         @view = @layout.add(UIView.new) do\n           @layout.constraints do\n             @constraint = @layout.min_x.equals(\'50%\').of(:another_view)\n@@ -163,7 +164,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `min_x.equals("50%").of(:another_view, :right)`\' do\n-      @superview = @layout.context(UIView.new) do\n+      @layout.context(@parent_view) do\n         @view = @layout.add(UIView.new) do\n           @layout.constraints do\n             @constraint = @layout.min_x.equals(\'50%\').of(:another_view, :right)\n@@ -180,7 +181,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `max_x 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_x(10)\n         end\n@@ -194,7 +195,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `x.equals(:another_view[, :left])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.x.equals(:another_view)\n         end\n@@ -209,7 +210,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `x.equals(:another_view).plus(10).plus(20)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.x.equals(:another_view).plus(10).plus(20)\n         end\n@@ -224,7 +225,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `x.equals(:another_view).minus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.x.equals(:another_view).minus(10)\n         end\n@@ -239,7 +240,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `min_x.equals(:another_view[, :left])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_x.equals(:another_view)\n         end\n@@ -254,7 +255,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `max_x.equals(:another_view[, :left])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_x.equals(:another_view)\n         end\n@@ -269,7 +270,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `x.equals(:another_view, :right)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.x.equals(:another_view, :right)\n         end\n@@ -284,7 +285,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `min_x.equals(:another_view, :right)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_x.equals(:another_view, :right)\n         end\n@@ -299,7 +300,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `max_x.equals(:another_view, :right)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_x.equals(:another_view, :right)\n         end\n@@ -314,7 +315,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `x.equals(:another_view, :right).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.x.equals(:another_view, :right).plus(10)\n         end\n@@ -329,7 +330,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `min_x.equals(:another_view, :right).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_x.equals(:another_view, :right).plus(10)\n         end\n@@ -344,7 +345,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `max_x.equals(:another_view, :right).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_x.equals(:another_view, :right).plus(10)\n         end\n@@ -359,7 +360,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `x.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.x.equals(:another_view).times(2).plus(10)\n         end\n@@ -374,7 +375,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `x.equals(:another_view).times(2).times(3)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.x.equals(:another_view).times(2).times(3)\n         end\n@@ -389,7 +390,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `x.equals(:another_view).divided_by(2)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.x.equals(:another_view).divided_by(2)\n         end\n@@ -404,7 +405,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `min_x.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_x.equals(:another_view).times(2).plus(10)\n         end\n@@ -419,7 +420,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `max_x.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_x.equals(:another_view).times(2).plus(10)\n         end\n@@ -434,7 +435,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `left.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.left.equals(:another_view).times(2).plus(10)\n         end\n@@ -449,7 +450,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `min_left.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_left.equals(:another_view).times(2).plus(10)\n         end\n@@ -464,7 +465,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `max_left.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_left.equals(:another_view).times(2).plus(10)\n         end\n@@ -492,7 +493,7 @@ describe \'Constraints - Simple helpers\' do\n \n   describe \'`center_x` support\' do\n     it \'should support `center_x 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.center_x(10)\n         end\n@@ -510,13 +511,13 @@ describe \'Constraints - Simple helpers\' do\n       resolved[0].firstItem.should.be.kind_of(UIView)\n       resolved[0].firstAttribute.should == NSLayoutAttributeCenterX\n       resolved[0].relation.should == NSLayoutRelationEqual\n-      resolved[0].secondItem.should == nil\n-      resolved[0].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+      resolved[0].secondItem.should == @parent_view\n+      resolved[0].secondAttribute.should == NSLayoutAttributeCenterX\n       resolved[0].multiplier.should == 1\n       resolved[0].constant.should == 10\n     end\n     it \'should support `min_center_x 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_center_x(10)\n         end\n@@ -530,7 +531,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :center_x\n     end\n     it \'should support `max_center_x 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_center_x(10)\n         end\n@@ -544,7 +545,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :center_x\n     end\n     it \'should support `center_x.equals(:another_view[, :center_x])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.center_x.equals(:another_view)\n         end\n@@ -559,7 +560,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :center_x\n     end\n     it \'should support `min_center_x.equals(:another_view[, :center_x])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_center_x.equals(:another_view)\n         end\n@@ -574,7 +575,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :center_x\n     end\n     it \'should support `max_center_x.equals(:another_view[, :center_x])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_center_x.equals(:another_view)\n         end\n@@ -589,7 +590,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :center_x\n     end\n     it \'should support `center_x.equals(:another_view, :right)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.center_x.equals(:another_view, :right)\n         end\n@@ -604,7 +605,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `min_center_x.equals(:another_view, :right)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_center_x.equals(:another_view, :right)\n         end\n@@ -619,7 +620,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `max_center_x.equals(:another_view, :right)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_center_x.equals(:another_view, :right)\n         end\n@@ -634,7 +635,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `center_x.equals(:another_view, :right).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.center_x.equals(:another_view, :right).plus(10)\n         end\n@@ -649,7 +650,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `min_center_x.equals(:another_view, :right).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_center_x.equals(:another_view, :right).plus(10)\n         end\n@@ -664,7 +665,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `max_center_x.equals(:another_view, :right).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_center_x.equals(:another_view, :right).plus(10)\n         end\n@@ -679,7 +680,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `center_x.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.center_x.equals(:another_view).times(2).plus(10)\n         end\n@@ -694,7 +695,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :center_x\n     end\n     it \'should support `min_center_x.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_center_x.equals(:another_view).times(2).plus(10)\n         end\n@@ -709,7 +710,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :center_x\n     end\n     it \'should support `max_center_x.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_center_x.equals(:another_view).times(2).plus(10)\n         end\n@@ -737,7 +738,7 @@ describe \'Constraints - Simple helpers\' do\n \n   describe \'`right` support\' do\n     it \'should support `right 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.right(10)\n         end\n@@ -755,13 +756,13 @@ describe \'Constraints - Simple helpers\' do\n       resolved[0].firstItem.should.be.kind_of(UIView)\n       resolved[0].firstAttribute.should == NSLayoutAttributeRight\n       resolved[0].relation.should == NSLayoutRelationEqual\n-      resolved[0].secondItem.should == nil\n-      resolved[0].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+      resolved[0].secondItem.should == @parent_view\n+      resolved[0].secondAttribute.should == NSLayoutAttributeRight\n       resolved[0].multiplier.should == 1\n       resolved[0].constant.should == 10\n     end\n     it \'should support `min_right 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_right(10)\n         end\n@@ -775,7 +776,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `max_right 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_right(10)\n         end\n@@ -789,7 +790,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `right.equals(:another_view[, :right])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.right.equals(:another_view)\n         end\n@@ -804,7 +805,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `min_right.equals(:another_view[, :right])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_right.equals(:another_view)\n         end\n@@ -819,7 +820,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `max_right.equals(:another_view[, :right])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_right.equals(:another_view)\n         end\n@@ -834,7 +835,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `right.equals(:another_view, :left)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.right.equals(:another_view, :left)\n         end\n@@ -849,7 +850,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `min_right.equals(:another_view, :left)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_right.equals(:another_view, :left)\n         end\n@@ -864,7 +865,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `max_right.equals(:another_view, :left)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_right.equals(:another_view, :left)\n         end\n@@ -879,7 +880,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `right.equals(:another_view, :left).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.right.equals(:another_view, :left).plus(10)\n         end\n@@ -894,7 +895,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `min_right.equals(:another_view, :left).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_right.equals(:another_view, :left).plus(10)\n         end\n@@ -909,7 +910,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `max_right.equals(:another_view, :left).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_right.equals(:another_view, :left).plus(10)\n         end\n@@ -924,7 +925,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :left\n     end\n     it \'should support `right.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.right.equals(:another_view).times(2).plus(10)\n         end\n@@ -939,7 +940,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `min_right.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_right.equals(:another_view).times(2).plus(10)\n         end\n@@ -954,7 +955,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :right\n     end\n     it \'should support `max_right.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_right.equals(:another_view).times(2).plus(10)\n         end\n@@ -982,7 +983,7 @@ describe \'Constraints - Simple helpers\' do\n \n   describe \'`y/top` support\' do\n     it \'should support `y 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.y(10)\n         end\n@@ -1000,13 +1001,13 @@ describe \'Constraints - Simple helpers\' do\n       resolved[0].firstItem.should.be.kind_of(UIView)\n       resolved[0].firstAttribute.should == NSLayoutAttributeTop\n       resolved[0].relation.should == NSLayoutRelationEqual\n-      resolved[0].secondItem.should == nil\n-      resolved[0].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+      resolved[0].secondItem.should == @parent_view\n+      resolved[0].secondAttribute.should == NSLayoutAttributeTop\n       resolved[0].multiplier.should == 1\n       resolved[0].constant.should == 10\n     end\n     it \'should support `min_y 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_y(10)\n         end\n@@ -1020,7 +1021,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `max_y 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_y(10)\n         end\n@@ -1034,7 +1035,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `y.equals(:another_view[, :top])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.y.equals(:another_view)\n         end\n@@ -1049,7 +1050,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `min_y.equals(:another_view[, :top])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_y.equals(:another_view)\n         end\n@@ -1064,7 +1065,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `max_y.equals(:another_view[, :top])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_y.equals(:another_view)\n         end\n@@ -1079,7 +1080,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `y.equals(:another_view, :bottom)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.y.equals(:another_view, :bottom)\n         end\n@@ -1094,7 +1095,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :bottom\n     end\n     it \'should support `min_y.equals(:another_view, :bottom)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_y.equals(:another_view, :bottom)\n         end\n@@ -1109,7 +1110,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :bottom\n     end\n     it \'should support `max_y.equals(:another_view, :bottom)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_y.equals(:another_view, :bottom)\n         end\n@@ -1124,7 +1125,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :bottom\n     end\n     it \'should support `y.equals(:another_view, :bottom).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.y.equals(:another_view, :bottom).plus(10)\n         end\n@@ -1139,7 +1140,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :bottom\n     end\n     it \'should support `min_y.equals(:another_view, :bottom).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_y.equals(:another_view, :bottom).plus(10)\n         end\n@@ -1154,7 +1155,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :bottom\n     end\n     it \'should support `max_y.equals(:another_view, :bottom).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_y.equals(:another_view, :bottom).plus(10)\n         end\n@@ -1169,7 +1170,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :bottom\n     end\n     it \'should support `y.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.y.equals(:another_view).times(2).plus(10)\n         end\n@@ -1184,7 +1185,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `min_y.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_y.equals(:another_view).times(2).plus(10)\n         end\n@@ -1199,7 +1200,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `max_y.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_y.equals(:another_view).times(2).plus(10)\n         end\n@@ -1214,7 +1215,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `top.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.top.equals(:another_view).times(2).plus(10)\n         end\n@@ -1229,7 +1230,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `min_top.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_top.equals(:another_view).times(2).plus(10)\n         end\n@@ -1244,7 +1245,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `max_top.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_top.equals(:another_view).times(2).plus(10)\n         end\n@@ -1272,7 +1273,7 @@ describe \'Constraints - Simple helpers\' do\n \n   describe \'`center_y` support\' do\n     it \'should support `center_y 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.center_y(10)\n         end\n@@ -1290,13 +1291,13 @@ describe \'Constraints - Simple helpers\' do\n       resolved[0].firstItem.should.be.kind_of(UIView)\n       resolved[0].firstAttribute.should == NSLayoutAttributeCenterY\n       resolved[0].relation.should == NSLayoutRelationEqual\n-      resolved[0].secondItem.should == nil\n-      resolved[0].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+      resolved[0].secondItem.should == @parent_view\n+      resolved[0].secondAttribute.should == NSLayoutAttributeCenterY\n       resolved[0].multiplier.should == 1\n       resolved[0].constant.should == 10\n     end\n     it \'should support `min_center_y 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_center_y(10)\n         end\n@@ -1310,7 +1311,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :center_y\n     end\n     it \'should support `max_center_y 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_center_y(10)\n         end\n@@ -1324,7 +1325,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :center_y\n     end\n     it \'should support `center_y.equals(:another_view[, :center_y])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.center_y.equals(:another_view)\n         end\n@@ -1339,7 +1340,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :center_y\n     end\n     it \'should support `min_center_y.equals(:another_view[, :center_y])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_center_y.equals(:another_view)\n         end\n@@ -1354,7 +1355,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :center_y\n     end\n     it \'should support `max_center_y.equals(:another_view[, :center_y])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_center_y.equals(:another_view)\n         end\n@@ -1369,7 +1370,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :center_y\n     end\n     it \'should support `center_y.equals(:another_view, :top)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.center_y.equals(:another_view, :top)\n         end\n@@ -1384,7 +1385,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `min_center_y.equals(:another_view, :top)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_center_y.equals(:another_view, :top)\n         end\n@@ -1399,7 +1400,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `max_center_y.equals(:another_view, :top)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_center_y.equals(:another_view, :top)\n         end\n@@ -1414,7 +1415,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `center_y.equals(:another_view, :top).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.center_y.equals(:another_view, :top).plus(10)\n         end\n@@ -1429,7 +1430,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `min_center_y.equals(:another_view, :top).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_center_y.equals(:another_view, :top).plus(10)\n         end\n@@ -1444,7 +1445,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `max_center_y.equals(:another_view, :top).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_center_y.equals(:another_view, :top).plus(10)\n         end\n@@ -1459,7 +1460,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `center_y.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.center_y.equals(:another_view).times(2).plus(10)\n         end\n@@ -1474,7 +1475,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :center_y\n     end\n     it \'should support `min_center_y.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_center_y.equals(:another_view).times(2).plus(10)\n         end\n@@ -1489,7 +1490,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :center_y\n     end\n     it \'should support `max_center_y.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_center_y.equals(:another_view).times(2).plus(10)\n         end\n@@ -1517,7 +1518,7 @@ describe \'Constraints - Simple helpers\' do\n \n   describe \'`bottom` support\' do\n     it \'should support `bottom 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.bottom(10)\n         end\n@@ -1535,13 +1536,13 @@ describe \'Constraints - Simple helpers\' do\n       resolved[0].firstItem.should.be.kind_of(UIView)\n       resolved[0].firstAttribute.should == NSLayoutAttributeBottom\n       resolved[0].relation.should == NSLayoutRelationEqual\n-      resolved[0].secondItem.should == nil\n-      resolved[0].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+      resolved[0].secondItem.should == @parent_view\n+      resolved[0].secondAttribute.should == NSLayoutAttributeBottom\n       resolved[0].multiplier.should == 1\n       resolved[0].constant.should == 10\n     end\n     it \'should support `min_bottom 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_bottom(10)\n         end\n@@ -1555,7 +1556,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :bottom\n     end\n     it \'should support `max_bottom 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_bottom(10)\n         end\n@@ -1569,7 +1570,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :bottom\n     end\n     it \'should support `bottom.equals(:another_view[, :bottom])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.bottom.equals(:another_view)\n         end\n@@ -1584,7 +1585,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :bottom\n     end\n     it \'should support `min_bottom.equals(:another_view[, :bottom])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_bottom.equals(:another_view)\n         end\n@@ -1599,7 +1600,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :bottom\n     end\n     it \'should support `max_bottom.equals(:another_view[, :bottom])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_bottom.equals(:another_view)\n         end\n@@ -1614,7 +1615,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :bottom\n     end\n     it \'should support `bottom.equals(:another_view, :top)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.bottom.equals(:another_view, :top)\n         end\n@@ -1629,7 +1630,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `min_bottom.equals(:another_view, :top)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_bottom.equals(:another_view, :top)\n         end\n@@ -1644,7 +1645,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `max_bottom.equals(:another_view, :top)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_bottom.equals(:another_view, :top)\n         end\n@@ -1659,7 +1660,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `bottom.equals(:another_view, :top).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.bottom.equals(:another_view, :top).plus(10)\n         end\n@@ -1674,7 +1675,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `min_bottom.equals(:another_view, :top).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_bottom.equals(:another_view, :top).plus(10)\n         end\n@@ -1689,7 +1690,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `max_bottom.equals(:another_view, :top).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_bottom.equals(:another_view, :top).plus(10)\n         end\n@@ -1704,7 +1705,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :top\n     end\n     it \'should support `bottom.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.bottom.equals(:another_view).times(2).plus(10)\n         end\n@@ -1719,7 +1720,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :bottom\n     end\n     it \'should support `min_bottom.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_bottom.equals(:another_view).times(2).plus(10)\n         end\n@@ -1734,7 +1735,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :bottom\n     end\n     it \'should support `max_bottom.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_bottom.equals(:another_view).times(2).plus(10)\n         end\n@@ -1762,7 +1763,7 @@ describe \'Constraints - Simple helpers\' do\n \n   describe \'`width` support\' do\n     it \'should support `width 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.width(10)\n         end\n@@ -1786,7 +1787,7 @@ describe \'Constraints - Simple helpers\' do\n       resolved[0].constant.should == 10\n     end\n     it \'should support `min_width 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_width(10)\n         end\n@@ -1800,7 +1801,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :width\n     end\n     it \'should support `max_width 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_width(10)\n         end\n@@ -1814,7 +1815,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :width\n     end\n     it \'should support `width.equals(:another_view[, :width])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.width.equals(:another_view)\n         end\n@@ -1829,7 +1830,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :width\n     end\n     it \'should support `min_width.equals(:another_view[, :width])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_width.equals(:another_view)\n         end\n@@ -1844,7 +1845,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :width\n     end\n     it \'should support `max_width.equals(:another_view[, :width])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_width.equals(:another_view)\n         end\n@@ -1859,7 +1860,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :width\n     end\n     it \'should support `width.equals(:another_view, :height).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.width.equals(:another_view, :height).plus(10)\n         end\n@@ -1874,7 +1875,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :height\n     end\n     it \'should support `min_width.equals(:another_view, :height).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_width.equals(:another_view, :height).plus(10)\n         end\n@@ -1889,7 +1890,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :height\n     end\n     it \'should support `max_width.equals(:another_view, :height).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_width.equals(:another_view, :height).plus(10)\n         end\n@@ -1904,7 +1905,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :height\n     end\n     it \'should support `width.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.width.equals(:another_view).times(2).plus(10)\n         end\n@@ -1919,7 +1920,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :width\n     end\n     it \'should support `min_width.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_width.equals(:another_view).times(2).plus(10)\n         end\n@@ -1934,7 +1935,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :width\n     end\n     it \'should support `max_width.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_width.equals(:another_view).times(2).plus(10)\n         end\n@@ -1962,7 +1963,7 @@ describe \'Constraints - Simple helpers\' do\n \n   describe \'`height` support\' do\n     it \'should support `height 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.height(10)\n         end\n@@ -1986,7 +1987,7 @@ describe \'Constraints - Simple helpers\' do\n       resolved[0].constant.should == 10\n     end\n     it \'should support `min_height 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_height(10)\n         end\n@@ -2000,7 +2001,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :height\n     end\n     it \'should support `max_height 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_height(10)\n         end\n@@ -2014,7 +2015,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :height\n     end\n     it \'should support `height.equals(:another_view[, :height])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.height.equals(:another_view)\n         end\n@@ -2029,7 +2030,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :height\n     end\n     it \'should support `min_height.equals(:another_view[, :height])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_height.equals(:another_view)\n         end\n@@ -2044,7 +2045,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :height\n     end\n     it \'should support `max_height.equals(:another_view[, :height])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_height.equals(:another_view)\n         end\n@@ -2059,7 +2060,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :height\n     end\n     it \'should support `height.equals(:another_view).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.height.equals(:another_view).plus(10)\n         end\n@@ -2074,7 +2075,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :height\n     end\n     it \'should support `min_height.equals(:another_view).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_height.equals(:another_view).plus(10)\n         end\n@@ -2089,7 +2090,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :height\n     end\n     it \'should support `max_height.equals(:another_view).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_height.equals(:another_view).plus(10)\n         end\n@@ -2104,7 +2105,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :height\n     end\n     it \'should support `height.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.height.equals(:another_view).times(2).plus(10)\n         end\n@@ -2119,7 +2120,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :height\n     end\n     it \'should support `min_height.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_height.equals(:another_view).times(2).plus(10)\n         end\n@@ -2134,7 +2135,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :height\n     end\n     it \'should support `max_height.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_height.equals(:another_view).times(2).plus(10)\n         end\n@@ -2162,7 +2163,7 @@ describe \'Constraints - Simple helpers\' do\n \n   describe \'`leading` support\' do\n     it \'should support `leading 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.leading(10)\n         end\n@@ -2180,13 +2181,13 @@ describe \'Constraints - Simple helpers\' do\n       resolved[0].firstItem.should.be.kind_of(UIView)\n       resolved[0].firstAttribute.should == NSLayoutAttributeLeading\n       resolved[0].relation.should == NSLayoutRelationEqual\n-      resolved[0].secondItem.should == nil\n-      resolved[0].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+      resolved[0].secondItem.should == @parent_view\n+      resolved[0].secondAttribute.should == NSLayoutAttributeLeading\n       resolved[0].multiplier.should == 1\n       resolved[0].constant.should == 10\n     end\n     it \'should support `min_leading 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_leading(10)\n         end\n@@ -2200,7 +2201,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :leading\n     end\n     it \'should support `max_leading 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_leading(10)\n         end\n@@ -2214,7 +2215,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :leading\n     end\n     it \'should support `leading.equals(:another_view[, :leading])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.leading.equals(:another_view)\n         end\n@@ -2229,7 +2230,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :leading\n     end\n     it \'should support `min_leading.equals(:another_view[, :leading])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_leading.equals(:another_view)\n         end\n@@ -2244,7 +2245,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :leading\n     end\n     it \'should support `max_leading.equals(:another_view[, :leading])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_leading.equals(:another_view)\n         end\n@@ -2259,7 +2260,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :leading\n     end\n     it \'should support `leading.equals(:another_view).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.leading.equals(:another_view).plus(10)\n         end\n@@ -2274,7 +2275,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :leading\n     end\n     it \'should support `min_leading.equals(:another_view).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_leading.equals(:another_view).plus(10)\n         end\n@@ -2289,7 +2290,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :leading\n     end\n     it \'should support `max_leading.equals(:another_view).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_leading.equals(:another_view).plus(10)\n         end\n@@ -2304,7 +2305,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :leading\n     end\n     it \'should support `leading.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.leading.equals(:another_view).times(2).plus(10)\n         end\n@@ -2319,7 +2320,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :leading\n     end\n     it \'should support `min_leading.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_leading.equals(:another_view).times(2).plus(10)\n         end\n@@ -2334,7 +2335,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :leading\n     end\n     it \'should support `max_leading.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_leading.equals(:another_view).times(2).plus(10)\n         end\n@@ -2362,7 +2363,7 @@ describe \'Constraints - Simple helpers\' do\n \n   describe \'`trailing` support\' do\n     it \'should support `trailing 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.trailing(10)\n         end\n@@ -2380,13 +2381,13 @@ describe \'Constraints - Simple helpers\' do\n       resolved[0].firstItem.should.be.kind_of(UIView)\n       resolved[0].firstAttribute.should == NSLayoutAttributeTrailing\n       resolved[0].relation.should == NSLayoutRelationEqual\n-      resolved[0].secondItem.should == nil\n-      resolved[0].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+      resolved[0].secondItem.should == @parent_view\n+      resolved[0].secondAttribute.should == NSLayoutAttributeTrailing\n       resolved[0].multiplier.should == 1\n       resolved[0].constant.should == 10\n     end\n     it \'should support `min_trailing 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_trailing(10)\n         end\n@@ -2400,7 +2401,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :trailing\n     end\n     it \'should support `max_trailing 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_trailing(10)\n         end\n@@ -2414,7 +2415,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :trailing\n     end\n     it \'should support `trailing.equals(:another_view[, :trailing])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.trailing.equals(:another_view)\n         end\n@@ -2429,7 +2430,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :trailing\n     end\n     it \'should support `min_trailing.equals(:another_view[, :trailing])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_trailing.equals(:another_view)\n         end\n@@ -2444,7 +2445,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :trailing\n     end\n     it \'should support `max_trailing.equals(:another_view[, :trailing])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_trailing.equals(:another_view)\n         end\n@@ -2459,7 +2460,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :trailing\n     end\n     it \'should support `trailing.equals(:another_view).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.trailing.equals(:another_view).plus(10)\n         end\n@@ -2474,7 +2475,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :trailing\n     end\n     it \'should support `min_trailing.equals(:another_view).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_trailing.equals(:another_view).plus(10)\n         end\n@@ -2489,7 +2490,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :trailing\n     end\n     it \'should support `max_trailing.equals(:another_view).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_trailing.equals(:another_view).plus(10)\n         end\n@@ -2504,7 +2505,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :trailing\n     end\n     it \'should support `trailing.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.trailing.equals(:another_view).times(2).plus(10)\n         end\n@@ -2519,7 +2520,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :trailing\n     end\n     it \'should support `min_trailing.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_trailing.equals(:another_view).times(2).plus(10)\n         end\n@@ -2534,7 +2535,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :trailing\n     end\n     it \'should support `max_trailing.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_trailing.equals(:another_view).times(2).plus(10)\n         end\n@@ -2562,7 +2563,7 @@ describe \'Constraints - Simple helpers\' do\n \n   describe \'`baseline` support\' do\n     it \'should support `baseline 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.baseline(10)\n         end\n@@ -2580,13 +2581,13 @@ describe \'Constraints - Simple helpers\' do\n       resolved[0].firstItem.should.be.kind_of(UIView)\n       resolved[0].firstAttribute.should == NSLayoutAttributeBaseline\n       resolved[0].relation.should == NSLayoutRelationEqual\n-      resolved[0].secondItem.should == nil\n-      resolved[0].secondAttribute.should == NSLayoutAttributeNotAnAttribute\n+      resolved[0].secondItem.should == @parent_view\n+      resolved[0].secondAttribute.should == NSLayoutAttributeBaseline\n       resolved[0].multiplier.should == 1\n       resolved[0].constant.should == 10\n     end\n     it \'should support `min_baseline 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_baseline(10)\n         end\n@@ -2600,7 +2601,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :baseline\n     end\n     it \'should support `max_baseline 10`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_baseline(10)\n         end\n@@ -2614,7 +2615,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :baseline\n     end\n     it \'should support `baseline.equals(:another_view[, :baseline])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.baseline.equals(:another_view)\n         end\n@@ -2629,7 +2630,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :baseline\n     end\n     it \'should support `min_baseline.equals(:another_view[, :baseline])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_baseline.equals(:another_view)\n         end\n@@ -2644,7 +2645,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :baseline\n     end\n     it \'should support `max_baseline.equals(:another_view[, :baseline])`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_baseline.equals(:another_view)\n         end\n@@ -2659,7 +2660,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :baseline\n     end\n     it \'should support `baseline.equals(:another_view).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.baseline.equals(:another_view).plus(10)\n         end\n@@ -2674,7 +2675,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :baseline\n     end\n     it \'should support `min_baseline.equals(:another_view).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_baseline.equals(:another_view).plus(10)\n         end\n@@ -2689,7 +2690,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :baseline\n     end\n     it \'should support `max_baseline.equals(:another_view).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_baseline.equals(:another_view).plus(10)\n         end\n@@ -2704,7 +2705,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :baseline\n     end\n     it \'should support `baseline.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.baseline.equals(:another_view).times(2).plus(10)\n         end\n@@ -2719,7 +2720,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :baseline\n     end\n     it \'should support `min_baseline.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.min_baseline.equals(:another_view).times(2).plus(10)\n         end\n@@ -2734,7 +2735,7 @@ describe \'Constraints - Simple helpers\' do\n       @constraint.attribute2.should == :baseline\n     end\n     it \'should support `max_baseline.equals(:another_view).times(2).plus(10)`\' do\n-      @view = @layout.context(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.max_baseline.equals(:another_view).times(2).plus(10)\n         end\ndiff --git a/spec/ios/constraints_helpers/size_constraints_spec.rb b/spec/ios/constraints_helpers/size_constraints_spec.rb\nindex 48b1c4e..d938a4d 100644\n--- a/spec/ios/constraints_helpers/size_constraints_spec.rb\n+++ b/spec/ios/constraints_helpers/size_constraints_spec.rb\n@@ -3,13 +3,14 @@ describe \'Constraints - Size helpers\' do\n   before do\n     @layout = MK::Layout.new\n     @constraint = nil\n-    @superview = nil\n-    @view = nil\n+    @view = UIView.new\n+    @parent_view = UIView.new\n+    @parent_view.addSubview(@view)\n     @another_view = nil\n   end\n \n   it \'should support `size 10`\' do\n-    @view = @layout.context(UIView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size(10)\n       end\n@@ -317,7 +318,7 @@ describe \'Constraints - Size helpers\' do\n     @constraint.attribute2.should == [:width, :height]\n   end\n   it \'should support `max_size("50%")`\' do\n-    @superview = @layout.context(UIView.new) do\n+    @layout.context(@parent_view) do\n       @view = @layout.add(UIView.new) do\n         @layout.constraints do\n           @constraint = @layout.max_size(\'50%\')\n@@ -333,7 +334,7 @@ describe \'Constraints - Size helpers\' do\n     @constraint.attribute2.should == [:width, :height]\n   end\n   it \'should support `max_size("50% + 1").of(:another_view)`\' do\n-    @superview = @layout.context(UIView.new) do\n+    @layout.context(@parent_view) do\n       @view = @layout.add(UIView.new) do\n         @layout.constraints do\n           @constraint = @layout.max_size(\'50% + 1\').of(:another_view)\ndiff --git a/spec/ios/constraints_helpers/view_lookup_constraints_spec.rb b/spec/ios/constraints_helpers/view_lookup_constraints_spec.rb\nindex e4ff528..e5906bb 100644\n--- a/spec/ios/constraints_helpers/view_lookup_constraints_spec.rb\n+++ b/spec/ios/constraints_helpers/view_lookup_constraints_spec.rb\n@@ -3,13 +3,15 @@ describe \'Constraints - view_lookup method\' do\n   before do\n     @layout = MK::Layout.new\n     @constraint = nil\n-    @view = nil\n+    @view = UIView.new\n+    @parent_view = UIView.new\n+    @parent_view.addSubview(@view)\n     @another_view = nil\n   end\n \n   it \'should support :superview\' do\n-    @superview = @layout.context(UIView.new) do\n-      @view = @layout.add(UIView.new) do\n+    @layout.context(@parent_view) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.left.equals(:superview).plus(10)\n         end\n@@ -28,15 +30,15 @@ describe \'Constraints - view_lookup method\' do\n     resolved[0].firstItem.should.be.kind_of(UIView)\n     resolved[0].firstAttribute.should == NSLayoutAttributeLeft\n     resolved[0].relation.should == NSLayoutRelationEqual\n-    resolved[0].secondItem.should == @superview\n+    resolved[0].secondItem.should == @parent_view\n     resolved[0].secondAttribute.should == NSLayoutAttributeLeft\n     resolved[0].multiplier.should == 1\n     resolved[0].constant.should == 10\n   end\n \n   it \'should support :another_view\' do\n-    @superview = @layout.context(UIView.new) do\n-      @view = @layout.add(UIView.new) do\n+    @layout.context(@parent_view) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.left.equals(:another_view).plus(10)\n         end\n@@ -63,9 +65,9 @@ describe \'Constraints - view_lookup method\' do\n   end\n \n   it \'should support @another_view\' do\n-    @superview = @layout.context(UIView.new) do\n+    @layout.context(@parent_view) do\n       @another_view = @layout.add UIView.alloc.initWithFrame([[1, 1], [2, 2]]), :another_view\n-      @view = @layout.add(UIView.new) do\n+      @layout.context(@view) do\n         @layout.constraints do\n           @constraint = @layout.left.equals(@another_view).plus(10)\n         end\ndiff --git a/spec/osx/constraints_helpers/size_constraints_spec.rb b/spec/osx/constraints_helpers/size_constraints_spec.rb\nindex 8d9f23a..f99404e 100644\n--- a/spec/osx/constraints_helpers/size_constraints_spec.rb\n+++ b/spec/osx/constraints_helpers/size_constraints_spec.rb\n@@ -1,18 +1,21 @@\n-describe \'Size constraints helpers\' do\n+describe \'Constraints - Size helpers\' do\n \n   before do\n     @layout = MK::Layout.new\n     @constraint = nil\n-    @view = nil\n+    @view = NSView.new\n+    @parent_view = NSView.new\n+    @parent_view.addSubview(@view)\n     @another_view = nil\n   end\n \n   it \'should support `size 10`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [1, 1]\n@@ -20,12 +23,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `min_size 10`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [1, 1]\n@@ -33,12 +38,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `max_size 10`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [1, 1]\n@@ -46,12 +53,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `size [10, 10]`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size([10, 10])\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [1, 1]\n@@ -59,12 +68,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `min_size [10, 10]`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size([10, 10])\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [1, 1]\n@@ -72,12 +83,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `max_size [10, 10]`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size([10, 10])\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [1, 1]\n@@ -85,12 +98,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `size w: 10, h: 10`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size(w: 10, h: 10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [1, 1]\n@@ -98,12 +113,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `min_size w: 10, h: 10`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size(w: 10, h: 10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [1, 1]\n@@ -111,12 +128,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `max_size w: 10, h: 10`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size(w: 10, h: 10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [1, 1]\n@@ -124,12 +143,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `size.equals(:another_view[, :size])`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view)\n       end\n     end\n+\n     @constraint.constant.should == [0, 0]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [1, 1]\n@@ -137,12 +158,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `size.equals(:another_view).plus(10).plus([5, 10])`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view).plus(10).plus([5, 10])\n       end\n     end\n+\n     @constraint.constant.should == [15, 20]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [1, 1]\n@@ -150,12 +173,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `min_size.equals(:another_view[, :size])`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size.equals(:another_view)\n       end\n     end\n+\n     @constraint.constant.should == [0, 0]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [1, 1]\n@@ -163,12 +188,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `max_size.equals(:another_view[, :size])`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size.equals(:another_view)\n       end\n     end\n+\n     @constraint.constant.should == [0, 0]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [1, 1]\n@@ -176,12 +203,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `size.equals(:another_view).plus(10)`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [1, 1]\n@@ -189,12 +218,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `min_size.equals(:another_view).plus(10)`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size.equals(:another_view).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [1, 1]\n@@ -202,12 +233,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `max_size.equals(:another_view).plus(10)`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size.equals(:another_view).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [1, 1]\n@@ -215,12 +248,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `size.equals(:another_view).plus([10, 10])`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view).plus([10, 10])\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [1, 1]\n@@ -228,12 +263,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `min_size.equals(:another_view).plus([10, 10])`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size.equals(:another_view).plus([10, 10])\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [1, 1]\n@@ -241,12 +278,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `max_size.equals(:another_view).plus(w: 10, h: 10)`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size.equals(:another_view).plus(w: 10, h: 10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [1, 1]\n@@ -254,12 +293,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `size.equals(:another_view).times(2).plus(10)`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view).times(2).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [2, 2]\n@@ -267,12 +308,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `min_size.equals(:another_view).times(2).plus(10)`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size.equals(:another_view).times(2).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [2, 2]\n@@ -280,12 +323,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `max_size.equals(:another_view).times(2).plus(10)`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size.equals(:another_view).times(2).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [2, 2]\n@@ -293,12 +338,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `size.equals(:another_view).times([2, 2]).plus(10)`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view).times([2, 2]).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [2, 2]\n@@ -306,12 +353,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `min_size.equals(:another_view).times([2, 2]).plus(10)`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size.equals(:another_view).times([2, 2]).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [2, 2]\n@@ -319,12 +368,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `max_size.equals(:another_view).times(w: 2, h: 2).plus(10)`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size.equals(:another_view).times(w: 2, h: 2).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [2, 2]\n@@ -332,12 +383,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `size.equals(:another_view).times(2).times([3, 4])`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view).times(2).times([3, 4])\n       end\n     end\n+\n     @constraint.constant.should == [0, 0]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [6, 8]\n@@ -345,12 +398,14 @@ describe \'Size constraints helpers\' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it \'should support `size.equals(:another_view).divided_by(2)`\' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view).divided_by(2)\n       end\n     end\n+\n     @constraint.constant.should == [0, 0]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [0.5, 0.5]\n', 'commit_subject': 'fixes to constraints and specs', 'repo_name': 'motion-kit/motion-kit', 'committer': {'name': 'Colin T.A. Gray', 'email': '1e4e036ac0c0cf9270c673a4ee0169e3d03747ff@gmail.com', 'time_sec': '1409850762', 'tz_offset': '-360', 'date': {'seconds': '1409850762'}}, 'commit_tree': '901581662f84818a6801107954e0e1f17bf7ad60', 'commit_message': 'fixes to constraints and specs\n', 'language_name': 'Ruby', 'license': 'mit', 'hunks': "@@ -1,18 +1,21 @@\n-describe 'Size constraints helpers' do\n+describe 'Constraints - Size helpers' do\n \n   before do\n     @layout = MK::Layout.new\n     @constraint = nil\n-    @view = nil\n+    @view = NSView.new\n+    @parent_view = NSView.new\n+    @parent_view.addSubview(@view)\n     @another_view = nil\n   end\n \n   it 'should support `size 10`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [1, 1]\n@@ -20,12 +23,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `min_size 10`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [1, 1]\n@@ -33,12 +38,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `max_size 10`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [1, 1]\n@@ -46,12 +53,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `size [10, 10]`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size([10, 10])\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [1, 1]\n@@ -59,12 +68,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `min_size [10, 10]`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size([10, 10])\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [1, 1]\n@@ -72,12 +83,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `max_size [10, 10]`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size([10, 10])\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [1, 1]\n@@ -85,12 +98,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `size w: 10, h: 10`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size(w: 10, h: 10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [1, 1]\n@@ -98,12 +113,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `min_size w: 10, h: 10`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size(w: 10, h: 10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [1, 1]\n@@ -111,12 +128,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `max_size w: 10, h: 10`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size(w: 10, h: 10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [1, 1]\n@@ -124,12 +143,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `size.equals(:another_view[, :size])`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view)\n       end\n     end\n+\n     @constraint.constant.should == [0, 0]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [1, 1]\n@@ -137,12 +158,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `size.equals(:another_view).plus(10).plus([5, 10])`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view).plus(10).plus([5, 10])\n       end\n     end\n+\n     @constraint.constant.should == [15, 20]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [1, 1]\n@@ -150,12 +173,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `min_size.equals(:another_view[, :size])`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size.equals(:another_view)\n       end\n     end\n+\n     @constraint.constant.should == [0, 0]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [1, 1]\n@@ -163,12 +188,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `max_size.equals(:another_view[, :size])`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size.equals(:another_view)\n       end\n     end\n+\n     @constraint.constant.should == [0, 0]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [1, 1]\n@@ -176,12 +203,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `size.equals(:another_view).plus(10)`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [1, 1]\n@@ -189,12 +218,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `min_size.equals(:another_view).plus(10)`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size.equals(:another_view).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [1, 1]\n@@ -202,12 +233,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `max_size.equals(:another_view).plus(10)`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size.equals(:another_view).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [1, 1]\n@@ -215,12 +248,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `size.equals(:another_view).plus([10, 10])`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view).plus([10, 10])\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [1, 1]\n@@ -228,12 +263,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `min_size.equals(:another_view).plus([10, 10])`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size.equals(:another_view).plus([10, 10])\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [1, 1]\n@@ -241,12 +278,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `max_size.equals(:another_view).plus(w: 10, h: 10)`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size.equals(:another_view).plus(w: 10, h: 10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [1, 1]\n@@ -254,12 +293,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `size.equals(:another_view).times(2).plus(10)`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view).times(2).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [2, 2]\n@@ -267,12 +308,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `min_size.equals(:another_view).times(2).plus(10)`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size.equals(:another_view).times(2).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [2, 2]\n@@ -280,12 +323,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `max_size.equals(:another_view).times(2).plus(10)`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size.equals(:another_view).times(2).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [2, 2]\n@@ -293,12 +338,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `size.equals(:another_view).times([2, 2]).plus(10)`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view).times([2, 2]).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [2, 2]\n@@ -306,12 +353,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `min_size.equals(:another_view).times([2, 2]).plus(10)`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.min_size.equals(:another_view).times([2, 2]).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :gte\n     @constraint.multiplier.should == [2, 2]\n@@ -319,12 +368,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `max_size.equals(:another_view).times(w: 2, h: 2).plus(10)`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.max_size.equals(:another_view).times(w: 2, h: 2).plus(10)\n       end\n     end\n+\n     @constraint.constant.should == [10, 10]\n     @constraint.relationship.should == :lte\n     @constraint.multiplier.should == [2, 2]\n@@ -332,12 +383,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `size.equals(:another_view).times(2).times([3, 4])`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view).times(2).times([3, 4])\n       end\n     end\n+\n     @constraint.constant.should == [0, 0]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [6, 8]\n@@ -345,12 +398,14 @@ describe 'Size constraints helpers' do\n     @constraint.attribute.should == [:width, :height]\n     @constraint.attribute2.should == [:width, :height]\n   end\n+\n   it 'should support `size.equals(:another_view).divided_by(2)`' do\n-    @layout.context(NSView.new) do\n+    @layout.context(@view) do\n       @layout.constraints do\n         @constraint = @layout.size.equals(:another_view).divided_by(2)\n       end\n     end\n+\n     @constraint.constant.should == [0, 0]\n     @constraint.relationship.should == :equal\n     @constraint.multiplier.should == [0.5, 0.5]\n", 'addition_count': 84, 'deletion_count': 29, 'src_file': 'a/spec/osx/constraints_helpers/size_constraints_spec.rb', 'tgt_file': 'b/spec/osx/constraints_helpers/size_constraints_spec.rb', 'file_extension': '.rb', 'before_file': "describe 'Size constraints helpers' do\n\n  before do\n    @layout = MK::Layout.new\n    @constraint = nil\n    @view = nil\n    @another_view = nil\n  end\n\n  it 'should support `size 10`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.size(10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :equal\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == nil\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `min_size 10`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.min_size(10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :gte\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == nil\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `max_size 10`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.max_size(10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :lte\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == nil\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `size [10, 10]`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.size([10, 10])\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :equal\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == nil\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `min_size [10, 10]`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.min_size([10, 10])\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :gte\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == nil\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `max_size [10, 10]`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.max_size([10, 10])\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :lte\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == nil\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `size w: 10, h: 10`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.size(w: 10, h: 10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :equal\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == nil\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `min_size w: 10, h: 10`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.min_size(w: 10, h: 10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :gte\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == nil\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `max_size w: 10, h: 10`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.max_size(w: 10, h: 10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :lte\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == nil\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `size.equals(:another_view[, :size])`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.size.equals(:another_view)\n      end\n    end\n    @constraint.constant.should == [0, 0]\n    @constraint.relationship.should == :equal\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `size.equals(:another_view).plus(10).plus([5, 10])`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.size.equals(:another_view).plus(10).plus([5, 10])\n      end\n    end\n    @constraint.constant.should == [15, 20]\n    @constraint.relationship.should == :equal\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `min_size.equals(:another_view[, :size])`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.min_size.equals(:another_view)\n      end\n    end\n    @constraint.constant.should == [0, 0]\n    @constraint.relationship.should == :gte\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `max_size.equals(:another_view[, :size])`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.max_size.equals(:another_view)\n      end\n    end\n    @constraint.constant.should == [0, 0]\n    @constraint.relationship.should == :lte\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `size.equals(:another_view).plus(10)`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.size.equals(:another_view).plus(10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :equal\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `min_size.equals(:another_view).plus(10)`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.min_size.equals(:another_view).plus(10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :gte\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `max_size.equals(:another_view).plus(10)`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.max_size.equals(:another_view).plus(10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :lte\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `size.equals(:another_view).plus([10, 10])`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.size.equals(:another_view).plus([10, 10])\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :equal\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `min_size.equals(:another_view).plus([10, 10])`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.min_size.equals(:another_view).plus([10, 10])\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :gte\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `max_size.equals(:another_view).plus(w: 10, h: 10)`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.max_size.equals(:another_view).plus(w: 10, h: 10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :lte\n    @constraint.multiplier.should == [1, 1]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `size.equals(:another_view).times(2).plus(10)`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.size.equals(:another_view).times(2).plus(10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :equal\n    @constraint.multiplier.should == [2, 2]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `min_size.equals(:another_view).times(2).plus(10)`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.min_size.equals(:another_view).times(2).plus(10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :gte\n    @constraint.multiplier.should == [2, 2]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `max_size.equals(:another_view).times(2).plus(10)`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.max_size.equals(:another_view).times(2).plus(10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :lte\n    @constraint.multiplier.should == [2, 2]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `size.equals(:another_view).times([2, 2]).plus(10)`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.size.equals(:another_view).times([2, 2]).plus(10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :equal\n    @constraint.multiplier.should == [2, 2]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `min_size.equals(:another_view).times([2, 2]).plus(10)`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.min_size.equals(:another_view).times([2, 2]).plus(10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :gte\n    @constraint.multiplier.should == [2, 2]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `max_size.equals(:another_view).times(w: 2, h: 2).plus(10)`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.max_size.equals(:another_view).times(w: 2, h: 2).plus(10)\n      end\n    end\n    @constraint.constant.should == [10, 10]\n    @constraint.relationship.should == :lte\n    @constraint.multiplier.should == [2, 2]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `size.equals(:another_view).times(2).times([3, 4])`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.size.equals(:another_view).times(2).times([3, 4])\n      end\n    end\n    @constraint.constant.should == [0, 0]\n    @constraint.relationship.should == :equal\n    @constraint.multiplier.should == [6, 8]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n  it 'should support `size.equals(:another_view).divided_by(2)`' do\n    @layout.context(NSView.new) do\n      @layout.constraints do\n        @constraint = @layout.size.equals(:another_view).divided_by(2)\n      end\n    end\n    @constraint.constant.should == [0, 0]\n    @constraint.relationship.should == :equal\n    @constraint.multiplier.should == [0.5, 0.5]\n    @constraint.relative_to.should == :another_view\n    @constraint.attribute.should == [:width, :height]\n    @constraint.attribute2.should == [:width, :height]\n  end\n\nend\n", 'message': 'fixes to constraints and specs\n', 'author_name': 'Colin T.A. Gray', 'lang': 'rb'}