Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
test for #1570
Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
Neeraj Singh authored and josevalim committed Jun 23, 2010
1 parent 687d7f5 commit a9c69f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions activerecord/test/cases/named_scope_test.rb
Expand Up @@ -9,6 +9,11 @@
class NamedScopeTest < ActiveRecord::TestCase
fixtures :posts, :authors, :topics, :comments, :author_addresses

def test_named_scope_with_STI
assert_equal 5,Post.with_type_self.count
assert_equal 1,SpecialPost.with_type_self.count
end

def test_implements_enumerable
assert !Topic.find(:all).empty?

Expand Down
1 change: 1 addition & 0 deletions activerecord/test/models/post.rb
@@ -1,4 +1,5 @@
class Post < ActiveRecord::Base
named_scope :with_type_self, lambda{{:conditions => ["type=?", self.name]}}
named_scope :containing_the_letter_a, :conditions => "body LIKE '%a%'"
named_scope :ranked_by_comments, :order => "comments_count DESC"
named_scope :limit, lambda {|limit| {:limit => limit} }
Expand Down

0 comments on commit a9c69f3

Please sign in to comment.