aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/associations_test.rb')
-rwxr-xr-xactiverecord/test/associations_test.rb9
1 files changed, 8 insertions, 1 deletions
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"