diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-06-22 13:52:59 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-06-22 13:52:59 +0200 |
commit | 1e122ff71dc65637bfbb0abf6e530af8af140345 (patch) | |
tree | 90d5d7c0db801eb5ddabae2b25600044d7ec28e1 | |
parent | e32dade8666d8a79463becf651956d57ce6f6710 (diff) | |
parent | 1c4fa54eec0b49f19ba0107a2028c354d60a9033 (diff) | |
download | rails-1e122ff71dc65637bfbb0abf6e530af8af140345.tar.gz rails-1e122ff71dc65637bfbb0abf6e530af8af140345.tar.bz2 rails-1e122ff71dc65637bfbb0abf6e530af8af140345.zip |
Merge pull request #15850 from sgrif/sg-missing-tests
Add missing test cases for `attribute_method?`
-rw-r--r-- | activerecord/test/cases/attribute_methods_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
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) |