diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-01-16 19:20:37 +0000 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-16 13:43:53 -0800 |
commit | bf24fe810c0591619ac01cc88d8a40423895d9d7 (patch) | |
tree | 6d952e007713e5a7147a203b1648e3acb9f36c18 /activerecord/test/cases | |
parent | 3ef693724c4719564361b3f48f8977b795c935e0 (diff) | |
download | rails-bf24fe810c0591619ac01cc88d8a40423895d9d7.tar.gz rails-bf24fe810c0591619ac01cc88d8a40423895d9d7.tar.bz2 rails-bf24fe810c0591619ac01cc88d8a40423895d9d7.zip |
belongs_to records should be initialized within the association scope
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/belongs_to_associations_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index ef6c482f67..01073bca3d 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -608,4 +608,25 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase assert_equal groucho, sponsor.sponsorable assert_equal groucho, sponsor.thing end + + def test_build_with_conditions + client = companies(:second_client) + firm = client.build_bob_firm + + assert_equal "Bob", firm.name + end + + def test_create_with_conditions + client = companies(:second_client) + firm = client.create_bob_firm + + assert_equal "Bob", firm.name + end + + def test_create_bang_with_conditions + client = companies(:second_client) + firm = client.create_bob_firm! + + assert_equal "Bob", firm.name + end end |