Sha256: 04271a1d47e146aff58fe7c9df4fa787f618e7921c542ae7c2f853e3da24ac8c

Contents?: true

Size: 812 Bytes

Versions: 1

Compression:

Stored size: 812 Bytes

Contents

class KVBTesterA
  
  attr_accessor :first_name
  
end

class KVBTesterB
  
  attr_reader :my_name
  
  def initialize
    @my_name = "Jon Stewart"
  end
  
end

describe "KeyValueBinding#bind_to" do
  
  it "show allow bindings to be exposed" do
    KVBTesterA.expose_binding :foo_test
    KVBTesterA.expose_binding :bar_test
    
    KVBTesterA.new.respond_to?(:foo_test_binding=).should == true
    KVBTesterA.new.respond_to?(:bar_test_binding=).should == true
  end
  
  it "should propogate KVC compliant chnages to bound objects" do
    a = KVBTesterA.new
    b = KVBTesterB.new
    
    a.first_name = "Roger"
            
    b.bind :my_name, :to => a, :path => :first_name
    
    b.my_name.should == "Roger"
    
    a.first_name = "Adam Beynon"
  
    b.my_name.should == "Adam Beynon"
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-0.1.0 opals/foundation/spec/system/key_value_binding/bind_spec.rb