From 646bfe1a5e7b30863e5ab8a5927246be3a69ed3b Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Tue, 20 Aug 2013 19:27:17 -0700 Subject: Avoid compiling regexs in AR::Base.respond_to? Caches the patterns of ActiveRecord::DynamicMatchers in a class instance variable. --- activerecord/test/cases/finder_respond_to_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/finder_respond_to_test.rb b/activerecord/test/cases/finder_respond_to_test.rb index 6101eb7b68..3ff22f222f 100644 --- a/activerecord/test/cases/finder_respond_to_test.rb +++ b/activerecord/test/cases/finder_respond_to_test.rb @@ -21,6 +21,11 @@ class FinderRespondToTest < ActiveRecord::TestCase assert_respond_to Topic, :find_by_title end + def test_should_respond_to_find_by_with_bang + ensure_topic_method_is_not_cached(:find_by_title!) + assert_respond_to Topic, :find_by_title! + end + def test_should_respond_to_find_by_two_attributes ensure_topic_method_is_not_cached(:find_by_title_and_author_name) assert_respond_to Topic, :find_by_title_and_author_name -- cgit v1.2.3