1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

test, better describe SerializationTypeMismatch behavior. refs #14716.

This commit is contained in:
Yves Senn 2014-10-16 11:48:07 +02:00
parent f18a4d07ef
commit d4d03a520d
2 changed files with 3 additions and 4 deletions

View file

@ -8,8 +8,8 @@ module ActiveRecord
# object, and retrieved as the same object, then specify the name of that
# attribute using this method and it will be handled automatically. The
# serialization is done through YAML. If +class_name+ is specified, the
# serialized object must be of that class on retrieval or
# <tt>SerializationTypeMismatch</tt> will be raised.
# serialized object must be of that class on assignment and retrieval.
# Otherwise <tt>SerializationTypeMismatch</tt> will be raised.
#
# ==== Parameters
#

View file

@ -140,11 +140,10 @@ class SerializedAttributeTest < ActiveRecord::TestCase
assert_equal 1, Topic.where(:content => nil).count
end
def test_serialized_attribute_should_raise_exception_on_save_with_wrong_type
def test_serialized_attribute_should_raise_exception_on_assignment_with_wrong_type
Topic.serialize(:content, Hash)
assert_raise(ActiveRecord::SerializationTypeMismatch) do
topic = Topic.new(content: 'string')
topic.save
end
end