diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-06-17 10:50:11 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-06-17 10:50:11 -0700 |
commit | e086ff563569f72a156fe105cc47767ad376cc3f (patch) | |
tree | ec58d7ccf452268038994eb3d6d9552975f9acd8 /activerecord | |
parent | 252d11321f8ca0c47111304ffe37d9bf69cad77b (diff) | |
download | rails-e086ff563569f72a156fe105cc47767ad376cc3f.tar.gz rails-e086ff563569f72a156fe105cc47767ad376cc3f.tar.bz2 rails-e086ff563569f72a156fe105cc47767ad376cc3f.zip |
just construct real objects rather than mock and stub
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/attribute_methods/serialization_test.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/activerecord/test/cases/attribute_methods/serialization_test.rb b/activerecord/test/cases/attribute_methods/serialization_test.rb index 8ce6192096..75de773961 100644 --- a/activerecord/test/cases/attribute_methods/serialization_test.rb +++ b/activerecord/test/cases/attribute_methods/serialization_test.rb @@ -8,20 +8,21 @@ module ActiveRecord def type_cast(s); "#{s}!"; end end - def test_type_cast_serialized_value - value = stub(state: :serialized, value: "Hello world") - value.expects(:unserialized_value).with("Hello world!") + class NullCoder + def load(v); v; end + end + def test_type_cast_serialized_value + value = Serialization::Attribute.new(NullCoder.new, "Hello world", :serialized) type = Serialization::Type.new(FakeColumn.new) - type.type_cast(value) + assert_equal "Hello world!", type.type_cast(value) end def test_type_cast_unserialized_value - value = stub(state: :unserialized, value: "Hello world") - value.expects(:unserialized_value).with() - + value = Serialization::Attribute.new(nil, "Hello world", :unserialized) type = Serialization::Type.new(FakeColumn.new) type.type_cast(value) + assert_equal "Hello world", type.type_cast(value) end end end |