Sha256: 705695d8417d6c4b09cd72621c1e754b3c9c866da48a99321fc68bc592c36666
Contents?: true
Size: 1.34 KB
Versions: 3
Compression:
Stored size: 1.34 KB
Contents
class Viewish def superview @superview ||= Viewish.new end def bounds CGRect.new([0, 0], [100, 44]) end def frame CGRect.new([10, 10], [100, 44]) end end describe 'Teacup.calculate' do it 'should return static numbers' do Teacup.calculate(nil, nil, 1).should == 1 end it 'should call blocks' do a = 'hi!' Teacup.calculate(a, nil, ->{ self.should == a 2 }).should == 2 end it 'should return percents with :width' do Teacup.calculate(Viewish.new, :width, '50%').should == 50 end it 'should return percents with :height' do Teacup.calculate(Viewish.new, :height, '50%').should == 22 end describe 'should return percents with offset' do it ':width, 50% + 10' do Teacup.calculate(Viewish.new, :width, '50% + 10').should == 60 end it ':width, 50% - 10' do Teacup.calculate(Viewish.new, :width, '50% - 10').should == 40 end it ':width, 25% + 5' do Teacup.calculate(Viewish.new, :width, '25% + 5').should == 30 end it ':height, 50% + 10' do Teacup.calculate(Viewish.new, :height, '50% + 10').should == 32 end it ':height, 50% - 10' do Teacup.calculate(Viewish.new, :height, '50% - 10').should == 12 end it ':height, 25% + 5' do Teacup.calculate(Viewish.new, :height, '25% + 5').should == 16 end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
teacup-2.1.16 | spec/ios/calculations_spec.rb |
teacup-2.1.15 | spec/ios/calculations_spec.rb |
teacup-2.1.14 | spec/ios/calculations_spec.rb |