From 9fae0279255a6c06041fb750a4d7b63e16ec16bb Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 20 Mar 2024 16:33:04 +0900 Subject: [PATCH] Refactor converting hash with struct Update #503 --- test/many_data/test_snapshots.rb | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/test/many_data/test_snapshots.rb b/test/many_data/test_snapshots.rb index 17725129..757bb853 100644 --- a/test/many_data/test_snapshots.rb +++ b/test/many_data/test_snapshots.rb @@ -10,20 +10,11 @@ # https://github.com/kachick/ruby-ulid/issues/89 class TestSnapshots < Test::Unit::TestCase - toml = PerfectTOML.load_file("#{__dir__}/fixtures/snapshots_2024-01-10_07-59.toml") - EXAMPLES = toml.each_pair.with_object([]) do |(encoded, table), list| - list << Example.new( - string: encoded, - integer: table.fetch('integer'), - timestamp: table.fetch('timestamp'), - randomness: table.fetch('randomness'), - to_time: table.fetch('to_time'), - inspect: table.fetch('inspect'), - uuidv4: table.fetch('uuidv4'), - octets: table.fetch('octets'), - period: nil - ) + toml = PerfectTOML.load_file("#{__dir__}/fixtures/snapshots_2024-01-10_07-59.toml", symbolize_names: true) + EXAMPLES = toml.each_pair.to_a.map do |(encoded, table)| + Example.new(**table, string: encoded.id2name, period: nil) end + raise 'looks like misloading' unless EXAMPLES.size > 1000 def assert_example(ulid, example) assert_equal(example.string, ulid.to_s)