spec/cg_rect_spec.rb in geomotion-0.13.2 vs spec/cg_rect_spec.rb in geomotion-0.14.0

- old
+ new

@@ -412,10 +412,16 @@ it "works with options and no margin" do rect = CGRect.make(height: 50).above(height: 10) rect.origin.y.should == -10 rect.size.height.should == 10 end + + it "works with options and margin as option" do + rect = CGRect.make(height: 50).above(margin: 20, height: 10) + rect.origin.y.should == -30 + rect.size.height.should == 10 + end end describe "#below" do it "works without margins" do rect = CGRect.make(height: 50).below @@ -438,10 +444,16 @@ it "works with options and no margin" do rect = CGRect.make(height: 50).below(height: 10) rect.origin.y.should == 50 rect.size.height.should == 10 end + + it "works with options and margin as option" do + rect = CGRect.make(height: 50).below(margin: 20, height: 10) + rect.origin.y.should == 70 + rect.size.height.should == 10 + end end describe "#before" do it "works without margins" do rect = CGRect.make(width: 50).before @@ -464,10 +476,16 @@ it "works with options and no margin" do rect = CGRect.make(width: 50).before(width: 10) rect.origin.x.should == -10 rect.size.width.should == 10 end + + it "works with options and margin as option" do + rect = CGRect.make(width: 50).before(margin: 20, width: 10) + rect.origin.x.should == -30 + rect.size.width.should == 10 + end end describe "#beside" do it "works without margins" do rect = CGRect.make(width: 50).beside @@ -490,10 +508,16 @@ it "works with options and no margin" do rect = CGRect.make(width: 50).beside(width: 10) rect.origin.x.should == 50 rect.size.width.should == 10 end + + it "works with options and margin as option" do + rect = CGRect.make(width: 50).beside(margin: 20, width: 10) + rect.origin.x.should == 70 + rect.size.width.should == 10 + end end describe "#top_left" do it "works with margins" do rect = CGRect.make(x: 10, y: 20, width: 100, height: 200) @@ -1099,9 +1123,17 @@ rect.should == CGRectMake(5, 10, 45, 10) end it "should work with absolute" do rect = @rect.from_bottom(height: 10, absolute: true) rect.should == CGRectMake(10, 110, 50, 10) + end + end + + describe "#to_ary" do + it "should allow parallel assigment" do + position, size = @rect + position.should == CGPointMake(10.0, 100.0) + size.should == CGSizeMake(50, 20) end end end