spec/ios/layout_spec.rb in motion-kit-0.10.11 vs spec/ios/layout_spec.rb in motion-kit-0.11.0

- old
+ new

@@ -1,8 +1,8 @@ -describe MotionKit::Layout do +describe 'Simple Layout' do before do - @subject = TestLayout.new + @subject = TestLayout.new.build end it "should be an instance of MotionKit::Layout" do @subject.should.be.kind_of(MotionKit::Layout) end @@ -10,11 +10,11 @@ it "should be an instance of MK::Layout" do @subject.should.be.kind_of(MK::Layout) end it "should add a UIView subview with the name :basic_view" do - view = @subject.view.subviews.find { |view| view.motion_kit_id == :basic_view } + view = @subject.get(:basic_view) view.should.be.kind_of(UIView) end it "should add two subviews under :basic_view" do @subject.view.subviews.first.subviews.length.should == 2 @@ -28,38 +28,21 @@ @subject.view.subviews.first.subviews[1].should.be.kind_of UILabel end it "should allow getting the subviews by their id" do @subject.get(:basic_view).should.be.kind_of UIView - @subject.get(:basic_view, in: @subject.view).should.be.kind_of UIView - @subject.get(:basic_view, in: @subject.view).should == @subject.get(:basic_view) - @subject.get(:basic_button).should.be.kind_of UIButton - @subject.get(:basic_button, in: @subject.view).should.be.kind_of UIView - @subject.get(:basic_button, in: @subject.view).should == @subject.get(:basic_button) - @subject.get(:basic_label).should.be.kind_of UILabel - @subject.get(:basic_label, in: @subject.view).should.be.kind_of UIView - @subject.get(:basic_label, in: @subject.view).should == @subject.get(:basic_label) end it "should allow getting the subviews by first, last and nth child" do @subject.first(:repeated_label_3).should.be.kind_of UIView - @subject.first(:repeated_label_3, in: @subject.other_view).should.be.kind_of UIView @subject.nth(:repeated_label_3, 1).should.be.kind_of UIButton - @subject.nth(:repeated_label_3, at: 1, in: @subject.other_view).should.be.kind_of UIButton @subject.last(:repeated_label_3).should.be.kind_of UILabel - @subject.last(:repeated_label_3, in: @subject.other_view).should.be.kind_of UILabel end it "should allow getting all the subviews by name" do views = @subject.all(:repeated_label_3) - views.length.should == 3 - views[0].should.be.kind_of UIView - views[1].should.be.kind_of UIButton - views[2].should.be.kind_of UILabel - - views = @subject.all(:repeated_label_3, in: @subject.other_view) views.length.should == 3 views[0].should.be.kind_of UIView views[1].should.be.kind_of UIButton views[2].should.be.kind_of UILabel end