diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-03-30 10:41:56 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-03-30 15:36:18 +0200 |
commit | 8d99ec9a4dcef5918c4487a0d94ef0a9622fe8c9 (patch) | |
tree | aeb56a9d16aa9165e2ea5695da43c49da784ce30 /activerecord/test/cases | |
parent | 41b45d56553316f175660fe6e2923409adee37e2 (diff) | |
download | rails-8d99ec9a4dcef5918c4487a0d94ef0a9622fe8c9.tar.gz rails-8d99ec9a4dcef5918c4487a0d94ef0a9622fe8c9.tar.bz2 rails-8d99ec9a4dcef5918c4487a0d94ef0a9622fe8c9.zip |
Named scopes shouldn't test equality using to_a if it's not an Array, this was causing records to be loaded before they were needed.
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/named_scope_test.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb index 40c724b87e..2396ca10b0 100644 --- a/activerecord/test/cases/named_scope_test.rb +++ b/activerecord/test/cases/named_scope_test.rb @@ -374,14 +374,14 @@ class NamedScopeTest < ActiveRecord::TestCase 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) @@ -407,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 |