aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-01-02 13:51:00 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-01-02 13:51:00 +0000
commit959f362ac483bb12dab7d0207d973f1ebadcb033 (patch)
treeae37356f90480ee68a5d1fee3bcd1cac48ffc079 /activerecord/test
parentac8fd7dfb91eb0e554537e671eaf1615a1d19757 (diff)
downloadrails-959f362ac483bb12dab7d0207d973f1ebadcb033.tar.gz
rails-959f362ac483bb12dab7d0207d973f1ebadcb033.tar.bz2
rails-959f362ac483bb12dab7d0207d973f1ebadcb033.zip
Added find_all style to the new dynamic finders
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@308 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-xactiverecord/test/finder_test.rb8
-rw-r--r--activerecord/test/fixtures/topics.yml2
2 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb
index fdbbc68e98..723166c8ad 100755
--- a/activerecord/test/finder_test.rb
+++ b/activerecord/test/finder_test.rb
@@ -178,6 +178,14 @@ class FinderTest < Test::Unit::TestCase
assert_nil Topic.find_by_title_and_author_name("The First Topic", "Mary")
end
+ def test_find_all_by_one_attribute
+ topics = Topic.find_all_by_content("Have a nice day")
+ assert_equal 2, topics.size
+ assert topics.include?(@topics["first"].find)
+
+ assert_equal [], Topic.find_all_by_title("The First Topic!!")
+ end
+
protected
def bind(statement, *vars)
if vars.first.is_a?(Hash)
diff --git a/activerecord/test/fixtures/topics.yml b/activerecord/test/fixtures/topics.yml
index 5571bd914c..f4942acb6c 100644
--- a/activerecord/test/fixtures/topics.yml
+++ b/activerecord/test/fixtures/topics.yml
@@ -15,7 +15,7 @@ second:
title: The Second Topic's of the day
author_name: Mary
written_on: 2003-07-15 15:28:00
- content: Have a great day!
+ content: Have a nice day
approved: 1
replies_count: 2
parent_id: 1