Sha256: cc6db13241829df80355bdf485bdee9fc5f08816deb2e70103e9ae0c6b2210ec

Contents?: true

Size: 771 Bytes

Versions: 4

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

4 entries across 4 versions & 1 rubygems

Version Path
activerecord-jdbcteradata-adapter-0.3.7 spec/associations_spec.rb
activerecord-jdbcteradata-adapter-0.3.6 spec/associations_spec.rb
activerecord-jdbcteradata-adapter-0.3.4 spec/associations_spec.rb
activerecord-jdbcteradata-adapter-0.3.3 spec/associations_spec.rb