aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/finder_respond_to_test.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2012-03-12 11:39:19 +0000
committerAndrew White <andyw@pixeltrix.co.uk>2012-03-12 14:16:19 +0000
commiteee32af45e7909c02370324833d7117fe9b6eb37 (patch)
tree628b5bb0a1babe14985122e18ef6ebd4b4a6d34c /activerecord/test/cases/finder_respond_to_test.rb
parent1e2de2cb74088a4dda5799587530be63279cc9c8 (diff)
downloadrails-eee32af45e7909c02370324833d7117fe9b6eb37.tar.gz
rails-eee32af45e7909c02370324833d7117fe9b6eb37.tar.bz2
rails-eee32af45e7909c02370324833d7117fe9b6eb37.zip
Add dynamic find_or_create_by_{attribute}! method.
Diffstat (limited to 'activerecord/test/cases/finder_respond_to_test.rb')
-rw-r--r--activerecord/test/cases/finder_respond_to_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_respond_to_test.rb b/activerecord/test/cases/finder_respond_to_test.rb
index 235805a67c..810c1500cc 100644
--- a/activerecord/test/cases/finder_respond_to_test.rb
+++ b/activerecord/test/cases/finder_respond_to_test.rb
@@ -56,6 +56,16 @@ class FinderRespondToTest < ActiveRecord::TestCase
assert_respond_to Topic, :find_or_create_by_title_and_author_name
end
+ def test_should_respond_to_find_or_create_from_one_attribute_bang
+ ensure_topic_method_is_not_cached(:find_or_create_by_title!)
+ assert_respond_to Topic, :find_or_create_by_title!
+ end
+
+ def test_should_respond_to_find_or_create_from_two_attributes_bang
+ ensure_topic_method_is_not_cached(:find_or_create_by_title_and_author_name!)
+ assert_respond_to Topic, :find_or_create_by_title_and_author_name!
+ end
+
def test_should_not_respond_to_find_by_one_missing_attribute
assert !Topic.respond_to?(:find_by_undertitle)
end