Sha256: 9da958d2f58be01517fd39daf52fc6993ce2f699233f40d6cae3fc4d5104e697

Contents?: true

Size: 666 Bytes

Versions: 3

Compression:

Stored size: 666 Bytes

Contents

require File.dirname(__FILE__) + "/spec_helper"

describe DataMapper::EmbeddedValue do
    
  before(:all) do
    @bob = Person[:name => 'Bob']
  end
  
  it 'should proxy getting values for you' do
    @bob.address.street.should == '123 Happy Ln.'
  end
  
  it 'should return a sub-class of the containing class' do
    @bob.address.class.should be(Person::Address)
  end
  
  it 'should allow definition of instance methods' do
    @bob.address.city_state_zip_code.should == 'Dallas, TX 75000'
  end
  
  it 'should allow you to use your own classes as well as long as they inherit from EmbeddedValue' do
    @bob.location.to_s.should == 'Dallas, TX'
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datamapper-0.2.3 spec/embedded_value_spec.rb
datamapper-0.2.1 spec/embedded_value_spec.rb
datamapper-0.2.2 spec/embedded_value_spec.rb