@@ -6,7 +6,8 @@ class PostgreSQLHstoreTest < Test::Unit::TestCase
6
6
7
7
class Hstore < ActiveRecord ::Base
8
8
self . table_name = 'hstores'
9
- store :tags , :accessors => [ :name ]
9
+
10
+ store_accessor :tags , [ :name ]
10
11
end
11
12
12
13
def setup
@@ -36,18 +37,17 @@ def teardown
36
37
37
38
def test_parse
38
39
column_type = Hstore . type_for_attribute ( 'tags' )
39
- assert_equal ( { } , column_type . deserialize ( '' ) )
40
- assert_equal ( { '1' => '2' } , column_type . deserialize ( '"1"=>"2"' ) )
41
- assert_equal ( { 'key' => nil } , column_type . deserialize ( 'key => NULL' ) )
42
- assert_equal ( { 'c' => '}' , '"a"' => 'b "a b' } , column_type . deserialize ( %q(c=>"}", "\"a\""=>"b \"a b") ) )
40
+
41
+ assert_equal ( { } , column_type . deserialize ( '' ) )
42
+ assert_equal ( { '1' => '2' } , column_type . deserialize ( '"1"=>"2"' ) )
43
43
end
44
44
45
45
def test_store_select
46
46
@connection . execute "insert into hstores (tags) VALUES ('name=>ferko,type=>suska')"
47
47
x = Hstore . first
48
+
48
49
assert_equal 'ferko' , x . name
49
- assert_equal 'suska' , x . tags [ : type]
50
- assert_instance_of ActiveSupport :: HashWithIndifferentAccess , x . tags
50
+ assert_equal 'suska' , x . tags [ ' type' ]
51
+ assert_instance_of Hash , x . tags
51
52
end
52
-
53
53
end
0 commit comments