Sha256: b327fc98277470fd270fd6b06f2239274f483bbb59e070ccd2fb527fbd82ab97

Contents?: true

Size: 862 Bytes

Versions: 3

Compression:

Stored size: 862 Bytes

Contents

# Since the gem provides model methods these tests serve as a kind of 'integration tests' for the gem
require 'spec_helper'

describe SpaceShuttle do
  
  it "raises exception on external foreign key violation caused by destroy" do
    # test that foreign key contraints to tables outside of the CTI hierarchy
    # prevent destroy
    shuttle = SpaceShuttle.create(:name => 'Discovery')
    rocket_engine = RocketEngine.create(:name => 'Booster', 
                                        :space_ship_id => shuttle.convert_to(:space_ship).id)
    expect {
      shuttle.destroy
    }.to raise_error
  end
  
  it "stores attributes that were added to ascendant classes after initial creation of the tables" do
    shuttle = SpaceShuttle.create(:name => 'Discovery', :reliability => 100)
    shuttle.convert_to(:space_ship).reliability.should eq 100
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dbview_cti-0.0.3 spec/models/space_shuttle_spec.rb
dbview_cti-0.0.2 spec/models/space_shuttle_spec.rb
dbview_cti-0.0.1 spec/models/space_shuttle_spec.rb