Sha256: 9453cb6cbd5ebb60f441c07e5cdbe56676d7e171b9758217c677ec328288d08d

Contents?: true

Size: 771 Bytes

Versions: 2

Compression:

Stored size: 771 Bytes

Contents

require 'spec_helper'

require 'models/purchase_orders'

describe 'AssociationsSpec' do
  before(:all) do
    CreateVendors.up
    CreateProducts.up
    CreatePurchaseOrders.up
  end

  it 'should create all of the tables' do
    vendor = Vendor.new(:name => 'Test vendor', :catch_phrase => 'Hello, world')
    vendor.products.build(:name => 'Test product', :price => 100.00)
    vendor.save

    vendor.products.count.should == 1

    purchase_order = PurchaseOrder.new
    purchase_order.product = vendor.products.first

    purchase_order.code = "ORDER1"
    purchase_order.quantity = 2
    purchase_order.save

    vendor.purchase_orders.count.should == 1
  end

  after(:all) do
    CreateVendors.down
    CreateProducts.down
    CreatePurchaseOrders.down
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activerecord-jdbcteradata-adapter-0.3.2 spec/associations_spec.rb
activerecord-jdbcteradata-adapter-0.3.1 spec/associations_spec.rb