Permalink
Browse files

Merge pull request #1474 from ganeshkumar/update_column_changes

added  tests for update_column
  • Loading branch information...
josevalim committed Jun 7, 2011
2 parents 80451a1 + 5f66f7a commit e32e8ed966147e1a1b641d92544dfbf19021905a
Showing with 9 additions and 0 deletions.
  1. +9 −0 activerecord/test/cases/associations/belongs_to_associations_test.rb
@@ -296,6 +296,15 @@ def test_belongs_to_counter_after_update_attributes
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)

0 comments on commit e32e8ed

Please sign in to comment.