From c18eda83393ec75c533c43aa4a06966324bbd126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Co=C3=AAlho?= Date: Sun, 22 Oct 2023 13:08:15 +0000 Subject: [PATCH] Little refactor --- test/rubrik/sign_test.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/rubrik/sign_test.rb b/test/rubrik/sign_test.rb index 09f526b..bae849b 100644 --- a/test/rubrik/sign_test.rb +++ b/test/rubrik/sign_test.rb @@ -23,13 +23,13 @@ def test_document_with_interactive_form expected_output.readlines.zip(output_pdf.readlines).each do |(expected_line, actual_line)| # We must erase the signature because it is timestampped - if T.must(actual_line).match?("/Type /Sig") - T.must(actual_line).sub!(/<[a-f0-9]+>/, "") - T.must(expected_line).sub!(/<[a-f0-9]+>/, "") + if actual_line&.match?("/Type /Sig") + actual_line.sub!(/<[a-f0-9]+>/, "") + expected_line.sub!(/<[a-f0-9]+>/, "") # The signature field name is also random - elsif T.must(actual_line).match?("Signature-[a-f0-9]{4}") - T.must(actual_line).sub!(/Signature-[a-f0-9]{4}/, "") - T.must(expected_line).sub!(/Signature-[a-f0-9]{4}/, "") + elsif actual_line&.match?(/Signature-[a-f0-9]{4}/) + actual_line.sub!(/Signature-[a-f0-9]{4}/, "") + expected_line.sub!(/Signature-[a-f0-9]{4}/, "") end assert_equal(expected_line, actual_line) @@ -59,13 +59,13 @@ def test_document_without_interactive_form expected_output.readlines.zip(output_pdf.readlines).each do |(expected_line, actual_line)| # We can't verify the signature because it changes on every run - if T.must(actual_line).match?("/Type /Sig") - T.must(actual_line).sub!(/<[a-f0-9]+>/, "") - T.must(expected_line).sub!(/<[a-f0-9]+>/, "") + if actual_line&.match?("/Type /Sig") + actual_line.sub!(/<[a-f0-9]+>/, "") + expected_line.sub!(/<[a-f0-9]+>/, "") # The signature field name is also random - elsif T.must(actual_line).match?("Signature-[a-f0-9]{4}") - T.must(actual_line).sub!(/Signature-[a-f0-9]{4}/, "") - T.must(expected_line).sub!(/Signature-[a-f0-9]{4}/, "") + elsif actual_line&.match?(/Signature-[a-f0-9]{4}/) + actual_line.sub!(/Signature-[a-f0-9]{4}/, "") + expected_line.sub!(/Signature-[a-f0-9]{4}/, "") end assert_equal(expected_line, actual_line)