diff options
author | José Valim <jose.valim@gmail.com> | 2011-06-07 00:14:42 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-06-07 00:14:42 -0700 |
commit | e32e8ed966147e1a1b641d92544dfbf19021905a (patch) | |
tree | f10c850ee3638dd8ca93aa22f738ffbaff1a9915 /activerecord/test/cases | |
parent | 80451a1fa60f4efa74f2d0e61682441625c7b51e (diff) | |
parent | 5f66f7a9a2e497fdb8f8cbbfb423d9b3b199fd54 (diff) | |
download | rails-e32e8ed966147e1a1b641d92544dfbf19021905a.tar.gz rails-e32e8ed966147e1a1b641d92544dfbf19021905a.tar.bz2 rails-e32e8ed966147e1a1b641d92544dfbf19021905a.zip |
Merge pull request #1474 from ganeshkumar/update_column_changes
added tests for update_column
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/belongs_to_associations_test.rb | 9 |
1 files changed, 9 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 5a900e0605..7338513b41 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -296,6 +296,15 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase assert_equal 1, Topic.find(topic.id)[:replies_count] end + def test_belongs_to_counter_when_update_column + topic = Topic.create!(:title => "37s") + topic.replies.create!(:title => "re: 37s", :content => "rails") + assert_equal 1, Topic.find(topic.id)[:replies_count] + + topic.update_column(:content, "rails is wonderfull") + assert_equal 1, Topic.find(topic.id)[:replies_count] + end + def test_assignment_before_child_saved final_cut = Client.new("name" => "Final Cut") firm = Firm.find(1) |