diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-03 11:54:41 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-03 11:54:41 -0300 |
commit | be543efe64fc19625fb56d5d2e38191c064c7636 (patch) | |
tree | 5df6376cf8f3f6ad6fe6b90eb6276fca4e4c292a /activerecord/test | |
parent | 03c9c0e2fa83e4ccaefb3b06970b9c3efe170be5 (diff) | |
parent | e2763b487ea905c14c0fb8298b6d67d123a046ad (diff) | |
download | rails-be543efe64fc19625fb56d5d2e38191c064c7636.tar.gz rails-be543efe64fc19625fb56d5d2e38191c064c7636.tar.bz2 rails-be543efe64fc19625fb56d5d2e38191c064c7636.zip |
Merge pull request #16034 from sgrif/sg-hstore-type-object
Use the type object for type casting HStore columns
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/hstore_test.rb | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/hstore_test.rb b/activerecord/test/cases/adapters/postgresql/hstore_test.rb index 8f78dbecf5..2631b6a939 100644 --- a/activerecord/test/cases/adapters/postgresql/hstore_test.rb +++ b/activerecord/test/cases/adapters/postgresql/hstore_test.rb @@ -112,13 +112,7 @@ class PostgresqlHstoreTest < ActiveRecord::TestCase end def test_type_cast_hstore - assert @column - - data = "\"1\"=>\"2\"" - hash = @column.class.string_to_hstore data - assert_equal({'1' => '2'}, hash) - assert_equal({'1' => '2'}, @column.type_cast_from_database(data)) - + assert_equal({'1' => '2'}, @column.type_cast_from_database("\"1\"=>\"2\"")) assert_equal({}, @column.type_cast_from_database("")) assert_equal({'key'=>nil}, @column.type_cast_from_database('key => NULL')) assert_equal({'c'=>'}','"a"'=>'b "a b'}, @column.type_cast_from_database(%q(c=>"}", "\"a\""=>"b \"a b"))) @@ -173,19 +167,19 @@ class PostgresqlHstoreTest < ActiveRecord::TestCase end def test_gen1 - assert_equal(%q(" "=>""), @column.class.hstore_to_string({' '=>''})) + assert_equal(%q(" "=>""), @column.cast_type.type_cast_for_database({' '=>''})) end def test_gen2 - assert_equal(%q(","=>""), @column.class.hstore_to_string({','=>''})) + assert_equal(%q(","=>""), @column.cast_type.type_cast_for_database({','=>''})) end def test_gen3 - assert_equal(%q("="=>""), @column.class.hstore_to_string({'='=>''})) + assert_equal(%q("="=>""), @column.cast_type.type_cast_for_database({'='=>''})) end def test_gen4 - assert_equal(%q(">"=>""), @column.class.hstore_to_string({'>'=>''})) + assert_equal(%q(">"=>""), @column.cast_type.type_cast_for_database({'>'=>''})) end def test_parse1 |