@@ -113,6 +113,10 @@ module Transformation
113
113
)
114
114
end
115
115
116
+ let ( :transformation_with_symbolized_metadata ) do
117
+ Pipeline . new ( transformation , SymbolizeMetadataKeys . new , to_domain_event : NULL )
118
+ end
119
+
116
120
specify "#dump" do
117
121
result = transformation . dump ( record )
118
122
expect ( result ) . to eq ( dump_of_record )
@@ -338,16 +342,23 @@ module Transformation
338
342
event_id : uuid ,
339
343
metadata : {
340
344
} ,
341
- data : active_support_time_with_zone ,
345
+ data : {
346
+ active_support_time_with_zone : active_support_time_with_zone ,
347
+ } ,
342
348
event_type : "TestEvent" ,
343
349
timestamp : nil ,
344
350
valid_at : nil ,
345
351
)
346
352
347
353
expect ( transformation . dump ( record ) . metadata [ :types ] ) . to eq (
348
- { data : " ActiveSupport::TimeWithZone" , metadata : { } } ,
354
+ { data : { "active_support_time_with_zone" => %w[ Symbol ActiveSupport::TimeWithZone ] } , metadata : { } } ,
349
355
)
350
- expect ( transformation . load ( transformation . dump ( record ) ) ) . to eq ( record )
356
+ expect ( transformation_with_symbolized_metadata . dump ( record ) . metadata [ :types ] ) . to eq (
357
+ { data : { active_support_time_with_zone : %w[ Symbol ActiveSupport::TimeWithZone ] } , metadata : { } } ,
358
+ )
359
+ [ transformation , transformation_with_symbolized_metadata ] . each do |t |
360
+ expect ( t . load ( t . dump ( record ) ) ) . to eq ( record )
361
+ end
351
362
ensure
352
363
Time . zone = current_tz
353
364
end
@@ -365,14 +376,23 @@ module Transformation
365
376
event_id : uuid ,
366
377
metadata : {
367
378
} ,
368
- data : ostruct ,
379
+ data : {
380
+ ostruct : ostruct ,
381
+ } ,
369
382
event_type : "TestEvent" ,
370
383
timestamp : nil ,
371
384
valid_at : nil ,
372
385
)
373
386
374
- expect ( transformation . dump ( record ) . metadata [ :types ] ) . to eq ( { data : "OpenStruct" , metadata : { } } )
375
- expect ( transformation . load ( transformation . dump ( record ) ) ) . to eq ( record )
387
+ expect ( transformation . dump ( record ) . metadata [ :types ] ) . to eq (
388
+ { data : { ostruct : %w[ Symbol OpenStruct ] } , metadata : { } } ,
389
+ )
390
+ expect ( transformation_with_symbolized_metadata . dump ( record ) . metadata [ :types ] ) . to eq (
391
+ { data : { ostruct : %w[ Symbol OpenStruct ] } , metadata : { } } ,
392
+ )
393
+ [ transformation , transformation_with_symbolized_metadata ] . each do |t |
394
+ expect ( t . load ( t . dump ( record ) ) ) . to eq ( record )
395
+ end
376
396
end
377
397
378
398
specify "handle classes with overloaded name like ActiveSupport::TimeWithZone < 7.1" do
0 commit comments