Sha256: 73cf05f0b15da924c92a70121c73370fa7f079a346f593a2e84ff311ca197cec
Contents?: true
Size: 1.22 KB
Versions: 144
Compression:
Stored size: 1.22 KB
Contents
class AttrUpdatesTest < UIView attr_updates :color attr :did_update def setNeedsDisplay @did_update = true super end def reset! @did_update = false end end describe 'UIView##attr_updates' do it 'should assign the ivar' do subject = AttrUpdatesTest.new subject.color = :red subject.color.should == :red end it 'should reset did_update' do subject = AttrUpdatesTest.new subject.reset! subject.did_update.should == false end it 'should cause setNeedsDisplay to be called' do subject = AttrUpdatesTest.new subject.reset! subject.did_update.should == false subject.color = :red # value changed from nil subject.color.should == :red subject.did_update.should == true end it 'should not cause setNeedsDisplay to be called if the value doesn\'t change' do subject = AttrUpdatesTest.new subject.reset! subject.did_update.should == false subject.color = :red # value changed from nil subject.color.should == :red subject.did_update.should == true subject.reset! subject.did_update.should == false subject.color = :red # same value, so no update subject.color.should == :red subject.did_update.should == false end end
Version data entries
144 entries across 144 versions & 1 rubygems