From 1c4fa54eec0b49f19ba0107a2028c354d60a9033 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Sat, 21 Jun 2014 13:30:33 -0600 Subject: Add missing test cases for `attribute_method?` --- activerecord/test/cases/attribute_methods_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index f832ca3451..84a7a8ef68 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -831,6 +831,17 @@ class AttributeMethodsTest < ActiveRecord::TestCase end end + def test_attribute_method? + assert @target.attribute_method?(:title) + assert @target.attribute_method?(:title=) + assert_not @target.attribute_method?(:wibble) + end + + def test_attribute_method_returns_false_if_table_does_not_exist + @target.table_name = 'wibble' + assert_not @target.attribute_method?(:title) + end + private def new_topic_like_ar_class(&block) -- cgit v1.2.3