Skip to content

Commit

Permalink
Merge pull request #15850 from sgrif/sg-missing-tests
Browse files Browse the repository at this point in the history
Add missing test cases for `attribute_method?`
  • Loading branch information
senny committed Jun 22, 2014
2 parents e32dade + 1c4fa54 commit 1e122ff
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions activerecord/test/cases/attribute_methods_test.rb
Expand Up @@ -831,6 +831,17 @@ def some_method_that_is_not_on_super
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)
Expand Down

0 comments on commit 1e122ff

Please sign in to comment.