Sha256: 0aa7ed7abdc94318dab4055ef9ad8bcb413c507f900c1449024efc1558ab9634
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
class FakeBound attr_accessor :attribute end class FakeModel include MotionBindable::Bindable attr_accessor :attribute attr_accessor :nested end describe 'MotionBindable::Strategies::Proc' do before do MotionBindable::Strategy.register_strategy( MotionBindable::Strategies::Proc, Proc ) end context 'nested model' do before do @bound = FakeBound.new @bound.attribute = 'Testing.' @object = FakeModel.new @object.nested = FakeModel.new end context 'is bound' do before do @object.bind_attributes({ attribute: proc { @bound.attribute }, nested: { attribute: proc { @bound.attribute } } }) end it 'should refresh upon bind' do @object.attribute.should.equal 'Testing.' @object.nested.attribute.should.equal 'Testing.' end it 'attribute is updated when the bound object is updated' do @bound.attribute = 'updated' wait(0.5) do @object.attribute.should.equal 'updated' end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems