aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-08-05 08:26:39 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-08-11 03:11:30 +0900
commit7b11f0c8cac849d6098289da64d9440b8c21783e (patch)
treef1e951c860ee76fcff78dec05b93ca1adc0128a3 /activerecord/test/cases
parent8f44d1661981a57838543b8a9890c855d7b02b89 (diff)
downloadrails-7b11f0c8cac849d6098289da64d9440b8c21783e.tar.gz
rails-7b11f0c8cac849d6098289da64d9440b8c21783e.tar.bz2
rails-7b11f0c8cac849d6098289da64d9440b8c21783e.zip
Move `test_not_compatible_with_serialize_macro` to `JSONSharedTestCases`
Because `JSONSharedTestCases` is also used for `Mysql2JSONTest`.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/adapters/postgresql/json_test.rb13
-rw-r--r--activerecord/test/cases/json_shared_test_cases.rb9
2 files changed, 11 insertions, 11 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/json_test.rb b/activerecord/test/cases/adapters/postgresql/json_test.rb
index 79dcfe110c..ee08841eb3 100644
--- a/activerecord/test/cases/adapters/postgresql/json_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/json_test.rb
@@ -21,8 +21,8 @@ module PostgresqlJSONSharedTestCases
@connection.add_column "json_data_type", "permissions", column_type, default: { "users": "read", "posts": ["read", "write"] }
klass.reset_column_information
- assert_equal({ "users" => "read", "posts" => ["read", "write"] }, JsonDataType.column_defaults["permissions"])
- assert_equal({ "users" => "read", "posts" => ["read", "write"] }, JsonDataType.new.permissions)
+ assert_equal({ "users" => "read", "posts" => ["read", "write"] }, klass.column_defaults["permissions"])
+ assert_equal({ "users" => "read", "posts" => ["read", "write"] }, klass.new.permissions)
end
def test_deserialize_with_array
@@ -33,15 +33,6 @@ module PostgresqlJSONSharedTestCases
x.reload
assert_equal ["foo" => "bar"], x.objects
end
-
- def test_not_compatible_with_serialize_macro
- new_klass = Class.new(klass) do
- serialize :payload, JSON
- end
- assert_raises(ActiveRecord::AttributeMethods::Serialization::ColumnNotSerializableError) do
- new_klass.new
- end
- end
end
class PostgresqlJSONTest < ActiveRecord::PostgreSQLTestCase
diff --git a/activerecord/test/cases/json_shared_test_cases.rb b/activerecord/test/cases/json_shared_test_cases.rb
index f708acf0aa..952194c6dc 100644
--- a/activerecord/test/cases/json_shared_test_cases.rb
+++ b/activerecord/test/cases/json_shared_test_cases.rb
@@ -216,6 +216,15 @@ module JSONSharedTestCases
assert_equal true, json.payload
end
+ def test_not_compatible_with_serialize_macro
+ new_klass = Class.new(klass) do
+ serialize :payload, JSON
+ end
+ assert_raises(ActiveRecord::AttributeMethods::Serialization::ColumnNotSerializableError) do
+ new_klass.new
+ end
+ end
+
private
def klass
JsonDataType