diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2014-03-18 01:27:54 -0700 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2014-03-18 01:27:54 -0700 |
commit | 4279a75a144515d1a35f8617f0ef61ddec33e7fd (patch) | |
tree | 282d0aea6bdcd599ef460c009ef718b9e66b55c5 /activerecord/test | |
parent | 34e54fa0542ebb3403932ab785239119e449dc3c (diff) | |
parent | e64875ffde5787eee24a96070f3cf51727347304 (diff) | |
download | rails-4279a75a144515d1a35f8617f0ef61ddec33e7fd.tar.gz rails-4279a75a144515d1a35f8617f0ef61ddec33e7fd.tar.bz2 rails-4279a75a144515d1a35f8617f0ef61ddec33e7fd.zip |
Merge pull request #14413 from arthurnn/port_test_cc
Add counter cache test for class_name
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/belongs_to_associations_test.rb | 11 |
1 files changed, 11 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 9340bc0a83..56ac284331 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -824,6 +824,17 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase assert_equal 0, comments(:greetings).reload.children_count end + def test_belongs_to_with_id_assigning + post = posts(:welcome) + comment = Comment.create! body: "foo", post: post + parent = comments(:greetings) + assert_equal 0, parent.reload.children_count + comment.parent_id = parent.id + + comment.save! + assert_equal 1, parent.reload.children_count + end + def test_polymorphic_with_custom_primary_key toy = Toy.create! sponsor = Sponsor.create!(:sponsorable => toy) |