diff --git a/test/data/mail/mail067.yml b/test/data/mail/mail067.yml new file mode 100644 index 000000000..3e22fc297 --- /dev/null +++ b/test/data/mail/mail067.yml @@ -0,0 +1,7 @@ +--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess +from: Bob Smith | deal +from_email: info@example.de +from_display_name: Bob Smith | deal +subject: Testmail - Alias in info@example.de Gruppe +content_type: text/plain +body: no visible content diff --git a/test/unit/email_parser_test.rb b/test/unit/email_parser_test.rb index e61c2e5e0..c972d6c37 100644 --- a/test/unit/email_parser_test.rb +++ b/test/unit/email_parser_test.rb @@ -17,9 +17,17 @@ class EmailParserTest < ActiveSupport::TestCase messages.each do |m| # assert: raw content hash is a subset of parsed message hash - assert_operator(m[:content].except(:attachments), :<=, m[:parsed], - "parsed message data from #{m[:source]} does not match " \ - "message content from #{m[:source].ext('yml')}") + expected_msg = m[:content].except(:attachments) + parsed_msg = m[:parsed].slice(*expected_msg.keys) + failure_msg = [parsed_msg, expected_msg] + .map(&:to_a).map(&:sort).reduce(&:zip) + .reject { |a| a.uniq.one? } + .map { |a, b| "#{a.first.upcase}\n #{m[:source]}: #{a.last}\n #{m[:source].ext('yml')}: #{b.last}" } + .join("\n") + + assert_operator(expected_msg, :<=, parsed_msg, + "parsed message data does not match message content:\n" + + failure_msg) # assert: attachments in parsed message hash match metadata in raw hash next if m[:content][:attachments].blank?