From 4031493cf8eb85d25c2a1ff23ddd657c2123d387 Mon Sep 17 00:00:00 2001 From: Balint Erdi Date: Fri, 15 Jan 2010 11:22:10 +0100 Subject: [PATCH] failing unit test for ticket 2907-custom-counter_cache-is-not-used-when-using-collectionsize-method https://rails.lighthouseapp.com/projects/8994/tickets/2907-custom-counter_cache-is-not-used-when-using-collectionsize-method --- .../associations/belongs_to_associations_test.rb | 2 +- activerecord/test/cases/base_test.rb | 2 +- activerecord/test/cases/reflection_test.rb | 6 +++--- activerecord/test/models/reply.rb | 2 +- activerecord/test/schema/schema.rb | 1 + 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index 9f3945f..5769066 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -312,7 +312,7 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase silly = SillyReply.create(:title => "gaga", :content => "boo-boo") silly.reply = reply - assert_equal 1, reply.reload[:replies_count] + assert_equal 1, reply.reload[:inane_replies_count] assert_equal 1, reply.replies.size reply[:replies_count] = 17 diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 6f7a779..ab47fc7 100755 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -2084,7 +2084,7 @@ class BasicsTest < ActiveRecord::TestCase def test_inspect_instance topic = topics(:first) - assert_equal %(#), topic.inspect + assert_equal %(#), topic.inspect end def test_inspect_new_instance diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb index 3278300..d54a5da 100644 --- a/activerecord/test/cases/reflection_test.rb +++ b/activerecord/test/cases/reflection_test.rb @@ -24,18 +24,18 @@ class ReflectionTest < ActiveRecord::TestCase def test_read_attribute_names assert_equal( - %w( id title author_name author_email_address bonus_time written_on last_read content approved replies_count parent_id parent_title type ).sort, + %w( id title author_name author_email_address bonus_time written_on last_read content approved replies_count inane_replies_count parent_id parent_title type ).sort, @first.attribute_names ) end def test_columns - assert_equal 13, Topic.columns.length + assert_equal 14, Topic.columns.length end def test_columns_are_returned_in_the_order_they_were_declared column_names = Topic.columns.map { |column| column.name } - assert_equal %w(id title author_name author_email_address written_on bonus_time last_read content approved replies_count parent_id parent_title type), column_names + assert_equal %w(id title author_name author_email_address written_on bonus_time last_read content approved replies_count inane_replies_count parent_id parent_title type), column_names end def test_content_columns diff --git a/activerecord/test/models/reply.rb b/activerecord/test/models/reply.rb index 4063785..a173678 100644 --- a/activerecord/test/models/reply.rb +++ b/activerecord/test/models/reply.rb @@ -36,7 +36,7 @@ class Reply < Topic end class SillyReply < Reply - belongs_to :reply, :foreign_key => "parent_id", :counter_cache => :replies_count + belongs_to :reply, :foreign_key => "parent_id", :counter_cache => :inane_replies_count end module Web diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index c8e652a..8f62293 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -445,6 +445,7 @@ ActiveRecord::Schema.define do t.text :content t.boolean :approved, :default => true t.integer :replies_count, :default => 0 + t.integer :inane_replies_count, :default => 0 t.integer :parent_id t.string :parent_title t.string :type -- 1.6.5