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:12:22 +0000
commit90d96353e6dcd962b182e03f53f2214acde00907 (patch)
tree8279d07b64cc468003f982847689a0ecb79b179f /activerecord/test/cases/finder_respond_to_test.rb
parent2b9041ba96375467717a79b0d2c5e6ecca038b5e (diff)
downloadrails-90d96353e6dcd962b182e03f53f2214acde00907.tar.gz
rails-90d96353e6dcd962b182e03f53f2214acde00907.tar.bz2
rails-90d96353e6dcd962b182e03f53f2214acde00907.zip
Add dynamic find_or_create_by_{attribute}! method.
(cherry picked from commit 5282485d310d1a6ffcf55e4e7f56ab234e16880d) Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/dynamic_finder_match.rb
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