Sha256: 945781301f8fbf8d1832b37714e3e71ee75170320015ab0ae7dc3de05ab87c97
Contents?: true
Size: 1.1 KB
Versions: 7
Compression:
Stored size: 1.1 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 'can refresh manually' do @bound.attribute = 'Updated.' @object.refresh.attribute.should.equal 'Updated.' @object.refresh.nested.attribute.should.equal 'Updated.' end end end end
Version data entries
7 entries across 7 versions & 1 rubygems