From 959f362ac483bb12dab7d0207d973f1ebadcb033 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 2 Jan 2005 13:51:00 +0000 Subject: 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 --- activerecord/test/finder_test.rb | 8 ++++++++ activerecord/test/fixtures/topics.yml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'activerecord/test') 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 -- cgit v1.2.3