diff options
author | Diego Algorta <diego@oboxodo.com> | 2009-02-13 03:07:39 -0300 |
---|---|---|
committer | rick <technoweenie@gmail.com> | 2009-02-25 09:21:08 -0800 |
commit | 0dd2f96f5c90f8abacb0fe0757ef7e5db4a4d501 (patch) | |
tree | c696bfc85598fa5a3ad1c5ba0db9636ab90f740a /activerecord/test/cases | |
parent | 92a30b0c88384feafc0da2864c01ff5c3a6f25ff (diff) | |
download | rails-0dd2f96f5c90f8abacb0fe0757ef7e5db4a4d501.tar.gz rails-0dd2f96f5c90f8abacb0fe0757ef7e5db4a4d501.tar.bz2 rails-0dd2f96f5c90f8abacb0fe0757ef7e5db4a4d501.zip |
Fixed bug that makes named_scopes _forgot_ current scope
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/named_scope_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb index e1e27fa130..f28285faaf 100644 --- a/activerecord/test/cases/named_scope_test.rb +++ b/activerecord/test/cases/named_scope_test.rb @@ -142,6 +142,15 @@ class NamedScopeTest < ActiveRecord::TestCase assert_equal authors(:david).comments & Comment.containing_the_letter_e, authors(:david).comments.containing_the_letter_e end + def test_named_scopes_honor_current_scopes_from_when_defined + assert !Post.ranked_by_comments.limit(5).empty? + assert !authors(:david).posts.ranked_by_comments.limit(5).empty? + assert_not_equal Post.ranked_by_comments.limit(5), authors(:david).posts.ranked_by_comments.limit(5) + assert_not_equal Post.top(5), authors(:david).posts.top(5) + assert_equal authors(:david).posts.ranked_by_comments.limit(5), authors(:david).posts.top(5) + assert_equal Post.ranked_by_comments.limit(5), Post.top(5) + end + def test_active_records_have_scope_named__all__ assert !Topic.find(:all).empty? |