aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-12-02 22:29:34 -0200
committerJosé Valim <jose.valim@gmail.com>2009-12-02 22:29:34 -0200
commit6e55b32e98fcaad82184d2e21ee611a3465e4b20 (patch)
treee316b8ca72f2bef50668c222400a159b36fbc090 /activerecord/test
parentc2e97cb410d759f383d29920165abdbf4b70e019 (diff)
parent399909b11c094ab32542d300c72940b1b263b8e6 (diff)
downloadrails-6e55b32e98fcaad82184d2e21ee611a3465e4b20.tar.gz
rails-6e55b32e98fcaad82184d2e21ee611a3465e4b20.tar.bz2
rails-6e55b32e98fcaad82184d2e21ee611a3465e4b20.zip
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb8
-rwxr-xr-xactiverecord/test/cases/base_test.rb10
2 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index 86d14c9c81..3c490c1eeb 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1178,5 +1178,13 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
client = firm.clients_using_primary_key.create!(:name => 'test')
assert_equal firm.name, client.firm_name
end
+
+ def test_normal_method_call_in_association_proxy
+ assert_equal 'Welcome to the weblog', Comment.all.map { |comment| comment.post }.first.title
+ end
+
+ def test_instance_eval_in_association_proxy
+ assert_equal 'Welcome to the weblog', Comment.all.map { |comment| comment.post }.first.instance_eval{title}
+ end
end
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index 5c2911eca1..737ca01d46 100755
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -680,6 +680,16 @@ class BasicsTest < ActiveRecord::TestCase
assert_equal -2, Topic.find(2).replies_count
end
+ def test_reset_counter_cache
+ assert_equal 1, Topic.find(1).replies_count
+
+ Topic.increment_counter("replies_count", 1)
+ assert_equal 2, Topic.find(1).replies_count
+
+ Topic.reset_counter_cache(:replies)
+ assert_equal 1, Topic.find(1).replies_count
+ end
+
def test_update_counter
category = categories(:general)
assert_nil category.categorizations_count