Skip to content

Instantly share code, notes, and snippets.

@fairchild
Created January 28, 2009 23:30
Show Gist options
  • Select an option

  • Save fairchild/54254 to your computer and use it in GitHub Desktop.

Select an option

Save fairchild/54254 to your computer and use it in GitHub Desktop.
def test_create_and_accept
ask = Order.create(:created_by => @sally,
:type => 'Ask',
:shares=>10, :price=>11,
:company=>@company,
:expires => 2.days.from_now,
:purchase_agreement_acceptance => '1',
:proof_of_ownership => '1',
:escrow_acceptance => '1')
assert_equal 4, ask.contracts.count
assert_equal 1, @sally.orders.size
ask.accepted_by = @bob
assert !ask.save
assert_match /Acrredited Investor/i, ask.errors[:base]
assert @bob.update_attribute(:accredited_200k_income, true)
assert @bob.accredited?
assert ask.accepted_by == @bob
ask.accepted_by.reload
assert ask.save!
assert_equal ask.accepted_by, @bob
assert_equal 6, ask.contracts.count
assert_equal 1, @bob.accepted_orders.count
assert_equal 1, @sally.orders.count
assert_equal 1, @bob.orders.size
assert_equal @bob.trades.size, @sally.transactions.size
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment