From 8b82c5042dbd8bb8b15b0ca4ac915ee5e1547879 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 17 Jan 2005 00:32:56 +0000 Subject: Test for #489 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@434 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/associations_test.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index 0001eebe9f..668bcb54a8 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -487,8 +487,10 @@ class HasManyAssociationsTest < Test::Unit::TestCase end class BelongsToAssociationsTest < Test::Unit::TestCase + fixtures :accounts, :companies, :developers, :projects, :topics + def setup - create_fixtures "accounts", "companies", "developers", "projects", "developers_projects", "topics" + create_fixtures "developers_projects" @signals37 = Firm.find(1) end @@ -577,6 +579,11 @@ class BelongsToAssociationsTest < Test::Unit::TestCase assert_equal apple, final_cut.firm(true) end + def test_new_record_with_foreign_key_but_no_object + c = Client.new("firm_id" => 1) + assert_equal @first_firm, c.firm_with_basic_id + end + def test_field_name_same_as_foreign_key computer = Computer.find 1 assert_not_nil computer.developer, ":foreign key == attribute didn't lock up" -- cgit v1.2.3