From 00ce4b4aa176ff5bd07d01d1fae5d7ee27b53e8f Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 5 Jun 2013 17:14:55 +0900 Subject: adding a test for #10830 Conflicts: activerecord/test/cases/adapters/postgresql/bytea_test.rb --- .../test/cases/adapters/postgresql/bytea_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'activerecord') diff --git a/activerecord/test/cases/adapters/postgresql/bytea_test.rb b/activerecord/test/cases/adapters/postgresql/bytea_test.rb index d7d77f96e2..f3990980eb 100644 --- a/activerecord/test/cases/adapters/postgresql/bytea_test.rb +++ b/activerecord/test/cases/adapters/postgresql/bytea_test.rb @@ -15,6 +15,7 @@ class PostgresqlByteaTest < ActiveRecord::TestCase @connection.transaction do @connection.create_table('bytea_data_type') do |t| t.binary 'payload' + t.binary 'serialized' end end end @@ -84,4 +85,21 @@ class PostgresqlByteaTest < ActiveRecord::TestCase assert_equal(nil, record.payload) assert_equal(nil, ByteaDataType.where(id: record.id).first.payload) end + + class Serializer + def load(str); str; end + def dump(str); str; end + end + + def test_serialize + serializer = Serializer.new + klass = Class.new(ByteaDataType) { + serialize :serialized, Serializer.new + } + obj = klass.new + obj.serialized = "hello world" + obj.save! + obj.reload + assert_equal "hello world", obj.serialized + end end -- cgit v1.2.3