Skip to content

Instantly share code, notes, and snippets.

@telagraphic
Created November 18, 2012 01:24
Show Gist options
  • Save telagraphic/4102485 to your computer and use it in GitHub Desktop.
Save telagraphic/4102485 to your computer and use it in GitHub Desktop.
association test
class TestAccount < Test::Unit::TestCase
def setup
@associate = Account.create(:account_type => "checking", :name => "checkers", :balance => 600)
@credit = @associate.credits.create(:amount => 40, :description => "bar tab", :transaction_type => "credit")
end
def test_credits_association
assert_not_nil(@credit)
assert_equal(40, @credit.amount)
assert_equal(@associate.id, @credit.account_id)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment