diff options
author | Matthew Draper <matthew@trebex.net> | 2017-08-13 20:16:41 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-13 20:16:41 +0930 |
commit | c8c20290419ad2f4b60df0297ace22b8f7f40f2b (patch) | |
tree | b30f926c521ef7f3d906aea5de62bc9362f43fc2 /activerecord/test | |
parent | f505f23ca4ab28c9ef06350b093c832f1982cac1 (diff) | |
parent | 7b11f0c8cac849d6098289da64d9440b8c21783e (diff) | |
download | rails-c8c20290419ad2f4b60df0297ace22b8f7f40f2b.tar.gz rails-c8c20290419ad2f4b60df0297ace22b8f7f40f2b.tar.bz2 rails-c8c20290419ad2f4b60df0297ace22b8f7f40f2b.zip |
Merge pull request #30079 from kamipo/move_test_not_compatible_with_serialize_macro
Move `test_not_compatible_with_serialize_macro` to `JSONSharedTestCases`
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/json_test.rb | 13 | ||||
-rw-r--r-- | activerecord/test/cases/json_shared_test_cases.rb | 9 |
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 |