Sha256: 7ca0bb5ada8b6e97622bfac2b7d6b13232020e6fa11e6b01fd0082c77f425020
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
describe 'MotionBindable::Bindable' do class FakeStrategy < MotionBindable::Strategy end class FakeBindable include MotionBindable::Bindable attr_accessor :attribute attr_accessor :nested end before do @object = FakeBindable.new @bound = Object.new @object.stub!(:strategy_for) { |_| FakeStrategy } end describe '#bind_attributes' do before do @object.nested = FakeBindable.new end it 'accepts nested attributes' do FakeStrategy.stub!(:bind) do |attribute| @attribute = attribute end @object.bind_attributes({ attribute: @bound, nested: { attribute: @bound } }) @attribute.should.equal @object.nested.attribute end it 'passes the strategy to bind' do @called = false @object.stub!(:bind) { |_| @called = true } @object.bind_attributes({ attribute: @bound }) @called.should.equal true end end describe '#bind' do before do @strategy = FakeStrategy.new(@object, :attribute) end it 'should be chainable' do @object.bind(@strategy).should.equal @object end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
motion_bindable-0.0.1 | spec/bindable_spec.rb |