Permalink
Browse files

adding a test for #10830

Conflicts:
	activerecord/test/cases/adapters/postgresql/bytea_test.rb
  • Loading branch information...
tenderlove committed Jun 5, 2013
1 parent 79af2c7 commit e312246a8950e79bd0896044e9bc148355fe14e0
Showing with 18 additions and 0 deletions.
  1. +18 −0 activerecord/test/cases/adapters/postgresql/bytea_test.rb
@@ -15,6 +15,7 @@ def setup
@connection.transaction do
@connection.create_table('bytea_data_type') do |t|
t.binary 'payload'
+ t.binary 'serialized'
end
end
end
@@ -84,4 +85,21 @@ def test_write_nil
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

0 comments on commit e312246

Please sign in to comment.