diff options
author | Xavier Noria <fxn@hashref.com> | 2010-03-31 07:47:58 -0700 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-03-31 07:47:58 -0700 |
commit | 824fa10f4d1306cc1e310a7d5de7e95cfb07d6f8 (patch) | |
tree | 1967c2a945d6e131d467fb4f0178a0f60e01ae8a /activerecord/test/cases/named_scope_test.rb | |
parent | 1ed1652bef981d9402797b6cb9f0920a40eea21a (diff) | |
parent | db28d407f76a790a31e27bf51560e23425dd6944 (diff) | |
download | rails-824fa10f4d1306cc1e310a7d5de7e95cfb07d6f8.tar.gz rails-824fa10f4d1306cc1e310a7d5de7e95cfb07d6f8.tar.bz2 rails-824fa10f4d1306cc1e310a7d5de7e95cfb07d6f8.zip |
Merge commit 'rails/master'
Diffstat (limited to 'activerecord/test/cases/named_scope_test.rb')
-rw-r--r-- | activerecord/test/cases/named_scope_test.rb | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb index 6c2b4fa3a7..2396ca10b0 100644 --- a/activerecord/test/cases/named_scope_test.rb +++ b/activerecord/test/cases/named_scope_test.rb @@ -371,8 +371,21 @@ class NamedScopeTest < ActiveRecord::TestCase end def test_named_scopes_with_reserved_names - [:where, :with_scope].each do |protected_method| - assert_raises(ArgumentError) { Topic.scope protected_method } + class << Topic + def public_method; end + public :public_method + + def protected_method; end + protected :protected_method + + def private_method; end + private :private_method + end + + [:public_method, :protected_method, :private_method].each do |reserved_method| + assert Topic.respond_to?(reserved_method, true) + ActiveRecord::Base.logger.expects(:warn) + Topic.scope(reserved_method) end end @@ -394,6 +407,12 @@ class NamedScopeTest < ActiveRecord::TestCase assert_equal topics(:second), approved[0] assert approved.loaded? end + + def test_nested_named_scopes_queries_size + assert_queries(1) do + Topic.approved.by_lifo.replied.written_before(Time.now).all + end + end end class DynamicScopeMatchTest < ActiveRecord::TestCase |