Skip to content

Instantly share code, notes, and snippets.

@AquaGeek
Created May 13, 2011 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AquaGeek/969911 to your computer and use it in GitHub Desktop.
Save AquaGeek/969911 to your computer and use it in GitHub Desktop.
Rails Lighthouse ticket #1117
From 8f7771d3b5359199d354f32d2b646039802e40ad Mon Sep 17 00:00:00 2001
From: Victor Costan <costan@gmail.com>
Date: Wed, 21 Apr 2010 00:42:51 -0400
Subject: [PATCH] Failing test case for serialization on binary fields in sqlite3.
---
.../test/cases/serialization_on_binaries_test.rb | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
create mode 100644 activerecord/test/cases/serialization_on_binaries_test.rb
diff --git a/activerecord/test/cases/serialization_on_binaries_test.rb b/activerecord/test/cases/serialization_on_binaries_test.rb
new file mode 100644
index 0000000..ed3650a
--- /dev/null
+++ b/activerecord/test/cases/serialization_on_binaries_test.rb
@@ -0,0 +1,18 @@
+require "cases/helper"
+
+# Just like the Binary model, except "data" is serialized.
+class SerializedBinary < ActiveRecord::Base
+ set_table_name "binaries"
+ serialize :data
+end
+
+class SerializationOnBinaryTest < ActiveRecord::TestCase
+ def test_binary_serialized
+ golden = [{'awesome " awesome ' => 3, false => Set.new([1, 2, 3, 4, 5])}]
+ b = SerializedBinary.new :data => golden
+ b.save!
+
+ assert_equal golden, SerializedBinary.last.data,
+ "Attempting to serialize and de-serialize into a binary column"
+ end
+end
--
1.7.0.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment