Sha256: 320b639aff1453bb250ef651cede14f42699181592675c5adca19b0c981fb4d9

Contents?: true

Size: 579 Bytes

Versions: 3

Compression:

Stored size: 579 Bytes

Contents

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

describe 'Single Table Inheritance' do
  
  before(:all) do
    fixtures(:people)
  end
  
  it "should save and load the correct Type" do
    database do
      ted = SalesPerson.new(:name => 'Ted')
      ted.save
    
      clone = Person.first(:name => 'Ted')
      ted.should == clone
      
      ted.should be_a_kind_of(SalesPerson)
    end
  end
  
  it "secondary database should inherit the same attributes" do
    
    database(:mock) do |db|
      db.table(SalesPerson)[:name].should_not be_nil
    end
    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

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