Skip to content

Commit

Permalink
Little refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tomascco committed Oct 22, 2023
1 parent 11130fe commit c18eda8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions test/rubrik/sign_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c18eda8

Please sign in to comment.