Skip to content

Commit

Permalink
Failing counter cache test. References #6896.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7675 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Sep 28, 2007
1 parent 191a048 commit 26174b2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions activerecord/test/associations_test.rb
Expand Up @@ -1158,6 +1158,24 @@ def test_belongs_to_counter_with_reassigning
assert_equal 0, Topic.find(t2.id).replies.size
end

def test_belongs_to_counter_after_save
topic = Topic.create!(:title => "monday night")
topic.replies.create!(:title => "re: monday night", :content => "football")
assert_equal 1, Topic.find(topic.id)[:replies_count]

topic.save!
assert_equal 1, Topic.find(topic.id)[:replies_count]
end

def test_belongs_to_counter_after_update_attributes
topic = Topic.create!(:title => "37s")
topic.replies.create!(:title => "re: 37s", :content => "rails")
assert_equal 1, Topic.find(topic.id)[:replies_count]

topic.update_attributes(:title => "37signals")
assert_equal 1, Topic.find(topic.id)[:replies_count]
end

def test_assignment_before_parent_saved
client = Client.find(:first)
apple = Firm.new("name" => "Apple")
Expand Down

0 comments on commit 26174b2

Please sign in to comment.