aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorTarmo Tänav <tarmo@itech.ee>2008-06-13 23:39:10 +0300
committerJeremy Kemper <jeremy@bitsweat.net>2008-06-22 17:26:00 -0700
commit1afae84ab2656cd58a861ab4a4b1745d80088d0f (patch)
tree29544057e3738abdc680d795aa8fe49ebdf1176b /activerecord/test/cases
parent43cbcb10ae85adc4403e950e69ee14123a20d8ae (diff)
downloadrails-1afae84ab2656cd58a861ab4a4b1745d80088d0f.tar.gz
rails-1afae84ab2656cd58a861ab4a4b1745d80088d0f.tar.bz2
rails-1afae84ab2656cd58a861ab4a4b1745d80088d0f.zip
Fixed that scopes defined with a string name could not be composed
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/named_scope_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb
index d890cf7936..73673e0f0e 100644
--- a/activerecord/test/cases/named_scope_test.rb
+++ b/activerecord/test/cases/named_scope_test.rb
@@ -59,6 +59,12 @@ class NamedScopeTest < ActiveRecord::TestCase
assert_equal Topic.count(:conditions => {:approved => true}), Topic.approved.count
end
+ def test_scopes_with_string_name_can_be_composed
+ # NOTE that scopes defined with a string as a name worked on their own
+ # but when called on another scope the other scope was completely replaced
+ assert_equal Topic.replied.approved, Topic.replied.approved_as_string
+ end
+
def test_scopes_are_composable
assert_equal (approved = Topic.find(:all, :conditions => {:approved => true})), Topic.approved
assert_equal (replied = Topic.find(:all, :conditions => 'replies_count > 0')), Topic.replied