diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-06-17 14:16:21 -0600 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-06-17 14:16:21 -0600 |
commit | d9812729c325006212ad0e0e1566cc76c072e709 (patch) | |
tree | 6a0fc1238eacbb6be98ff3e9b454c0568e83c7eb /activerecord/test | |
parent | 63b347df427ed2189fac7e75e36a3a4b9f6c2a68 (diff) | |
download | rails-d9812729c325006212ad0e0e1566cc76c072e709.tar.gz rails-d9812729c325006212ad0e0e1566cc76c072e709.tar.bz2 rails-d9812729c325006212ad0e0e1566cc76c072e709.zip |
Don't assume that Hstore columns have always changed
HStore columns come back from the database separated by a comma and a
space, not just a comma. We need to mirror that behavior since we
compare the two values.
Also adds a regression test against JSON to ensure we don't have the
same bug there.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/hstore_test.rb | 1 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/json_test.rb | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/hstore_test.rb b/activerecord/test/cases/adapters/postgresql/hstore_test.rb index 83b495d600..c4e2917251 100644 --- a/activerecord/test/cases/adapters/postgresql/hstore_test.rb +++ b/activerecord/test/cases/adapters/postgresql/hstore_test.rb @@ -170,6 +170,7 @@ class PostgresqlHstoreTest < ActiveRecord::TestCase hstore.reload assert_equal 'four', hstore.settings['three'] + assert_not hstore.changed? end def test_gen1 diff --git a/activerecord/test/cases/adapters/postgresql/json_test.rb b/activerecord/test/cases/adapters/postgresql/json_test.rb index a3400a5a19..3c07209472 100644 --- a/activerecord/test/cases/adapters/postgresql/json_test.rb +++ b/activerecord/test/cases/adapters/postgresql/json_test.rb @@ -183,6 +183,7 @@ class PostgresqlJSONTest < ActiveRecord::TestCase json.save! json.reload - assert json.payload['three'] = 'four' + assert_equal({ 'one' => 'two', 'three' => 'four' }, json.payload) + assert_not json.changed? end end |