diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-10-25 08:17:40 -0700 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-10-25 08:17:40 -0700 |
commit | dc8fac1cacb120dc2535b67bdd6436d220901c7a (patch) | |
tree | 0949275d6b2bc9827ab9a35b88575cbb423f8456 /activerecord/test/cases/adapters | |
parent | 0e918ea97acc71e23e7a43963a5147d0ad8a994d (diff) | |
parent | c3606afb2a54ac11e31360cf1dbe13fbdf893f73 (diff) | |
download | rails-dc8fac1cacb120dc2535b67bdd6436d220901c7a.tar.gz rails-dc8fac1cacb120dc2535b67bdd6436d220901c7a.tar.bz2 rails-dc8fac1cacb120dc2535b67bdd6436d220901c7a.zip |
Merge pull request #12643 from severin/pg_cast_json_on_write
cast json values on write to be consistent with reading from the db.
Diffstat (limited to 'activerecord/test/cases/adapters')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/json_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/json_test.rb b/activerecord/test/cases/adapters/postgresql/json_test.rb index f7609404ce..c33c7ef968 100644 --- a/activerecord/test/cases/adapters/postgresql/json_test.rb +++ b/activerecord/test/cases/adapters/postgresql/json_test.rb @@ -49,6 +49,13 @@ class PostgresqlJSONTest < ActiveRecord::TestCase JsonDataType.reset_column_information end + def test_cast_value_on_write + x = JsonDataType.new payload: {"string" => "foo", :symbol => :bar} + assert_equal({"string" => "foo", "symbol" => "bar"}, x.payload) + x.save + assert_equal({"string" => "foo", "symbol" => "bar"}, x.reload.payload) + end + def test_type_cast_json assert @column |