@@ -30,7 +30,8 @@ def create_test_record
3030 AllTypes . create col_string : "string" , col_int64 : 100 , col_float64 : 3.14 , col_numeric : 6.626 , col_bool : true ,
3131 col_bytes : StringIO . new ( "bytes" ) , col_date : ::Date . new ( 2021 , 6 , 23 ) ,
3232 col_timestamp : ::Time . new ( 2021 , 6 , 23 , 17 , 8 , 21 , "+02:00" ) ,
33- col_json : { kind : "user_renamed" , change : %w[ jack john ] } ,
33+ col_json : { kind : "user_renamed" , change : %w[ jack john ] } ,
34+ col_uuid : "3840ba25-55df-4cb7-a210-1fe37278954f" ,
3435 col_array_string : [ "string1" , nil , "string2" ] ,
3536 col_array_int64 : [ 100 , nil , 200 , "300" ] ,
3637 col_array_float64 : [ 3.14 , nil , 2.0 /3.0 , "3.14" ] ,
@@ -42,7 +43,8 @@ def create_test_record
4243 ::Time . new ( 2021 , 6 , 24 , 17 , 8 , 21 , "+02:00" ) , "2021-06-25 17:08:21 +02:00" ] ,
4344 col_array_json : [ { kind : "user_renamed" , change : %w[ jack john ] } , nil , \
4445 { kind : "user_renamed" , change : %w[ alice meredith ] } ,
45- "{\" kind\" :\" user_renamed\" ,\" change\" :[\" bob\" ,\" carol\" ]}" ]
46+ "{\" kind\" :\" user_renamed\" ,\" change\" :[\" bob\" ,\" carol\" ]}" ] ,
47+ col_array_uuid : [ "e986c19c-9bf3-44f8-851d-710ad3d0067b" , nil , "a02f50b6-2860-48dc-acd6-49b42abc3094" ]
4648 end
4749
4850 def test_create_record
@@ -67,6 +69,7 @@ def test_create_record
6769 assert_equal ::Time . new ( 2021 , 6 , 23 , 17 , 8 , 21 , "+02:00" ) . utc , record . col_timestamp . utc
6870 assert_equal ( { "kind" => "user_renamed" , "change" => %w[ jack john ] } ) ,
6971 record . col_json
72+ assert_equal "3840ba25-55df-4cb7-a210-1fe37278954f" , record . col_uuid
7073
7174 assert_equal [ "string1" , nil , "string2" ] , record . col_array_string
7275 assert_equal [ 100 , nil , 200 , 300 ] , record . col_array_int64
@@ -85,6 +88,7 @@ def test_create_record
8588 { "kind" => "user_renamed" , "change" => %w[ alice meredith ] } , \
8689 "{\" kind\" :\" user_renamed\" ,\" change\" :[\" bob\" ,\" carol\" ]}" ] ,
8790 record . col_array_json
91+ assert_equal [ "e986c19c-9bf3-44f8-851d-710ad3d0067b" , nil , "a02f50b6-2860-48dc-acd6-49b42abc3094" ] , record . col_array_uuid
8892 end
8993 end
9094
@@ -100,6 +104,7 @@ def test_update_record
100104 col_date : ::Date . new ( 2021 , 6 , 28 ) ,
101105 col_timestamp : ::Time . new ( 2021 , 6 , 28 , 11 , 22 , 21 , "+02:00" ) ,
102106 col_json : { kind : "user_created" , change : %w[ jack alice ] } ,
107+ col_uuid : "b493579f-f4f6-41f6-a520-8373ecf1cde4" ,
103108 col_array_string : [ "new string 1" , "new string 2" ] ,
104109 col_array_int64 : [ 300 , 200 , 100 ] ,
105110 col_array_float64 : [ 1.1 , 2.2 , 3.3 ] ,
@@ -108,7 +113,8 @@ def test_update_record
108113 col_array_bytes : [ StringIO . new ( "new bytes 1" ) , StringIO . new ( "new bytes 2" ) ] ,
109114 col_array_date : [ ::Date . new ( 2021 , 6 , 28 ) ] ,
110115 col_array_timestamp : [ ::Time . utc ( 2020 , 12 , 31 , 0 , 0 , 0 ) ] ,
111- col_array_json : [ { kind : "user_created" , change : %w[ jack alice ] } ]
116+ col_array_json : [ { kind : "user_created" , change : %w[ jack alice ] } ] ,
117+ col_array_uuid : [ "a664b1eb-4dc7-4795-9ed8-28fab6644cea" , nil , "1c794d81-bc6d-4771-9c92-a920d28a7aaa" ]
112118 end
113119
114120 # Verify that the record was updated.
@@ -123,6 +129,7 @@ def test_update_record
123129 assert_equal ::Time . new ( 2021 , 6 , 28 , 11 , 22 , 21 , "+02:00" ) . utc , record . col_timestamp . utc
124130 assert_equal ( { "kind" => "user_created" , "change" => %w[ jack alice ] } ) ,
125131 record . col_json
132+ assert_equal "b493579f-f4f6-41f6-a520-8373ecf1cde4" , record . col_uuid
126133
127134 assert_equal [ "new string 1" , "new string 2" ] , record . col_array_string
128135 assert_equal [ 300 , 200 , 100 ] , record . col_array_int64
@@ -135,6 +142,8 @@ def test_update_record
135142 assert_equal [ ::Time . utc ( 2020 , 12 , 31 , 0 , 0 , 0 ) ] , record . col_array_timestamp . map ( &:utc )
136143 assert_equal [ { "kind" => "user_created" , "change" => %w[ jack alice ] } ] ,
137144 record . col_array_json
145+ assert_equal [ "a664b1eb-4dc7-4795-9ed8-28fab6644cea" , nil , "1c794d81-bc6d-4771-9c92-a920d28a7aaa" ] ,
146+ record . col_array_uuid
138147 end
139148 end
140149
@@ -151,7 +160,8 @@ def test_create_empty_arrays
151160 col_array_bytes : [ ] ,
152161 col_array_date : [ ] ,
153162 col_array_timestamp : [ ] ,
154- col_array_json : [ ]
163+ col_array_json : [ ] ,
164+ col_array_uuid : [ ]
155165 end
156166
157167 record = AllTypes . find record . id
@@ -164,6 +174,7 @@ def test_create_empty_arrays
164174 assert_equal [ ] , record . col_array_date
165175 assert_equal [ ] , record . col_array_timestamp
166176 assert_equal [ ] , record . col_array_json
177+ assert_equal [ ] , record . col_array_uuid
167178 end
168179 end
169180 end
0 commit comments