Test that has_one works.

This commit is contained in:
Yehuda Katz 2012-01-11 13:07:43 -07:00
parent 72b8213bee
commit 89103f1e74

View File

@ -105,5 +105,23 @@ class AssociationTest < ActiveModel::TestCase
]
}, @root_hash)
end
def test_with_default_has_one
@post_serializer_class.class_eval do
has_one :comment
end
include! :comment
assert_equal({
:comment => 1
}, @hash)
assert_equal({
:comments => [
{ :body => "ZOMG A COMMENT" }
]
}, @root_hash)
end
end
end