From bc933d0fa1b3a89deaf3e7c74d7717eb8fc7152a Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Tue, 29 Dec 2009 12:27:40 +0530 Subject: Make sure Relation responds to dynamic finder methods --- activerecord/test/cases/relations_test.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'activerecord/test/cases/relations_test.rb') diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index c3cce8c5f2..1c344c0b48 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -142,7 +142,15 @@ class RelationTest < ActiveRecord::TestCase relation = Topic.scoped ["map", "uniq", "sort", "insert", "delete", "update"].each do |method| - assert relation.respond_to?(method), "Topic.all should respond to #{method.inspect}" + assert relation.respond_to?(method), "Topic.scoped should respond to #{method.inspect}" + end + end + + def test_respond_to_dynamic_finders + relation = Topic.scoped + + ["find_by_title", "find_by_title_and_author_name", "find_or_create_by_title", "find_or_initialize_by_title_and_author_name"].each do |method| + assert relation.respond_to?(method), "Topic.scoped should respond to #{method.inspect}" end end -- cgit v1.2.3