Skip to content

Commit b7ebe6b

Browse files
authored
Merge branch 'mikel:master' into part_spec_master
2 parents a1f44c9 + 2a4b664 commit b7ebe6b

File tree

10 files changed

+259
-22
lines changed

10 files changed

+259
-22
lines changed

.github/workflows/adhoc.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Adhoc RSpec tests
2+
3+
on:
4+
workflow_dispatch:
5+
6+
pull_request:
7+
branches: [ feature/parse_lf ]
8+
push:
9+
branches: [ feature/parse_lf ]
10+
11+
jobs:
12+
ruby:
13+
name: ${{ matrix.ruby }} (timeout ${{ matrix.timeout }})
14+
runs-on: ubuntu-latest
15+
timeout-minutes: ${{ matrix.timeout }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- ruby: 2.5
21+
timeout: 5
22+
- ruby: 2.6
23+
timeout: 5
24+
- ruby: 2.7
25+
timeout: 5
26+
- ruby: '3.0'
27+
timeout: 5
28+
- ruby: 3.1
29+
timeout: 5
30+
- ruby: jruby
31+
timeout: 10
32+
- ruby: jruby-head
33+
timeout: 10
34+
- ruby: jruby-9.4
35+
timeout: 10
36+
- ruby: jruby-9.3
37+
timeout: 10
38+
- ruby: jruby-9.2
39+
timeout: 10
40+
steps:
41+
- name: Psych 5.0.0 needs libyaml-dev
42+
run: |
43+
sudo apt-get update
44+
sudo apt-get install libyaml-dev
45+
- uses: actions/checkout@v2
46+
with:
47+
ref: feature/parse_lf
48+
- uses: ruby/setup-ruby@v1
49+
with:
50+
ruby-version: ${{ matrix.ruby }}
51+
rubygems: 3.2.3
52+
bundler-cache: true
53+
cache-version: 4
54+
- name: Show psych
55+
run: |
56+
gem list psych --details
57+
continue-on-error: true
58+
- name: Run tests1
59+
run: bundle exec rake spec || echo "action_state=failed" >> $GITHUB_ENV
60+
continue-on-error: true
61+
- name: Run tests2
62+
run: bundle exec rake spec || echo "action_state=failed" >> $GITHUB_ENV
63+
continue-on-error: true
64+
- name: Run tests3
65+
run: bundle exec rake spec || echo "action_state=failed" >> $GITHUB_ENV
66+
continue-on-error: true
67+
- name: Run tests4
68+
run: bundle exec rake spec || echo "action_state=failed" >> $GITHUB_ENV
69+
continue-on-error: true
70+
- name: Run tests5
71+
run: bundle exec rake spec || echo "action_state=failed" >> $GITHUB_ENV
72+
continue-on-error: true
73+
- name: Run tests6
74+
run: bundle exec rake spec || echo "action_state=failed" >> $GITHUB_ENV
75+
continue-on-error: true
76+
- name: Run Summary
77+
run: |
78+
echo "${{ env.action_state }}"
79+
# This will be be true for a successful run
80+
test "${{ env.action_state }}" != 'failed'

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: RSpec tests
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches: [ master ]
67
pull_request:
@@ -44,7 +45,7 @@ jobs:
4445
run: |
4546
sudo apt-get update
4647
sudo apt-get install libyaml-dev
47-
- uses: actions/checkout@v2
48+
- uses: actions/checkout@v3
4849
- uses: ruby/setup-ruby@v1
4950
with:
5051
ruby-version: ${{ matrix.ruby }}
@@ -61,7 +62,7 @@ jobs:
6162
run: |
6263
sudo apt-get update
6364
sudo apt-get install libyaml-dev
64-
- uses: actions/checkout@v2
65+
- uses: actions/checkout@v3
6566
- uses: ruby/setup-ruby@v1
6667
with:
6768
ruby-version: 3

Gemfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ source 'https://rubygems.org'
22

33
gemspec
44

5-
if RUBY_VERSION < '2.7.0'
6-
gem 'activesupport', '< 6'
7-
else
8-
gem 'activesupport', :git => 'https://github.com/rails/rails', :branch => 'main'
5+
if ENV['MBCHARS'] # see spec/environment.rb
6+
if RUBY_VERSION < '2.7.0'
7+
gem 'activesupport', '< 6'
8+
else
9+
gem 'activesupport', :git => 'https://github.com/rails/rails', :branch => 'main'
10+
end
911
end
1012

1113
gem 'jruby-openssl', :platforms => :jruby

lib/mail/body.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ def initialize(string = '')
3939
else
4040
# Do join first incase we have been given an Array in Ruby 1.9
4141
if string.respond_to?(:join)
42-
@raw_source = ::Mail::Utilities.to_crlf(string.join(''))
42+
@raw_source = string.join('')
4343
elsif string.respond_to?(:to_s)
44-
@raw_source = ::Mail::Utilities.to_crlf(string.to_s)
44+
@raw_source = string.to_s
4545
else
4646
raise "You can only assign a string or an object that responds_to? :join or :to_s to a body."
4747
end
@@ -272,7 +272,7 @@ def extract_parts
272272
parts_regex = /
273273
(?: # non-capturing group
274274
\A | # start of string OR
275-
\r\n # line break
275+
\r?\n # line break with optional CR
276276
)
277277
(
278278
--#{Regexp.escape(boundary || "")} # boundary delimiter

lib/mail/message.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,10 @@ def <=>(other)
349349
# the same content, ignoring the Message-ID field, unless BOTH emails have a defined and
350350
# different Message-ID value, then they are false.
351351
#
352+
# Note that Mail creates Date and Mime-Type fields if they don't exist.
353+
# The Date field is derived from the current time, so this needs to be allowed for in comparisons.
354+
# (Mime-type does not depend on dynamic data, so cannot affect equality)
355+
#
352356
# So, in practice the == operator works like this:
353357
#
354358
# m1 = Mail.new("Subject: Hello\r\n\r\nHello")
@@ -370,14 +374,17 @@ def <=>(other)
370374
# m1 = Mail.new("Message-ID: <1234@test>\r\nSubject: Hello\r\n\r\nHello")
371375
# m2 = Mail.new("Message-ID: <DIFFERENT@test>\r\nSubject: Hello\r\n\r\nHello")
372376
# m1 == m2 #=> false
373-
def ==(other)
377+
def ==(other) # TODO could be more efficient
374378
return false unless other.respond_to?(:encoded)
375379

380+
stamp = Mail::CommonDateField.normalize_datetime('')
381+
# Note: must always dup the inputs so they are not altered by encoded
376382
if self.message_id && other.message_id
377-
self.encoded == other.encoded
383+
dup.tap { |m| m.date ||= stamp }.encoded ==
384+
other.dup.tap { |m| m.date ||= stamp }.encoded
378385
else
379-
dup.tap { |m| m.message_id = '<temp@test>' }.encoded ==
380-
other.dup.tap { |m| m.message_id = '<temp@test>' }.encoded
386+
dup.tap { |m| m.message_id = '<temp@test>'; m.date ||= stamp }.encoded ==
387+
other.dup.tap { |m| m.message_id = '<temp@test>'; m.date ||= stamp }.encoded
381388
end
382389
end
383390

lib/mail/utilities.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ def Utilities.b_value_decode(str)
420420
end
421421
transcode_to_scrubbed_utf8(str)
422422
rescue Encoding::UndefinedConversionError, ArgumentError, Encoding::ConverterNotFoundError, Encoding::InvalidByteSequenceError
423-
warn "Encoding conversion failed #{$!}"
423+
warn "WARNING: Encoding conversion failed #{$!}"
424424
str.dup.force_encoding(Encoding::UTF_8)
425425
end
426426

@@ -444,7 +444,7 @@ def Utilities.q_value_decode(str)
444444
end
445445
transcode_to_scrubbed_utf8(str)
446446
rescue Encoding::UndefinedConversionError, ArgumentError, Encoding::ConverterNotFoundError
447-
warn "Encoding conversion failed #{$!}"
447+
warn "WARNING: Encoding conversion failed #{$!}"
448448
str.dup.force_encoding(Encoding::UTF_8)
449449
end
450450

@@ -453,7 +453,7 @@ def Utilities.param_decode(str, encoding)
453453
str = charset_encoder.encode(str, encoding) if encoding
454454
transcode_to_scrubbed_utf8(str)
455455
rescue Encoding::UndefinedConversionError, ArgumentError, Encoding::ConverterNotFoundError
456-
warn "Encoding conversion failed #{$!}"
456+
warn "WARNING: Encoding conversion failed #{$!}"
457457
str.dup.force_encoding(Encoding::UTF_8)
458458
end
459459

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
From [email protected] Tue May 10 11:28:07 2005
2+
Return-Path: <[email protected]>
3+
X-Original-To: [email protected]
4+
Delivered-To: [email protected]
5+
Received: from localhost (localhost [127.0.0.1])
6+
by xxx.xxxxx.com (Postfix) with ESMTP id 50FD3A96F
7+
for <[email protected]>; Tue, 10 May 2005 17:26:50 +0000 (GMT)
8+
Received: from xxx.xxxxx.com ([127.0.0.1])
9+
by localhost (xxx.xxxxx.com [127.0.0.1]) (amavisd-new, port 10024)
10+
with LMTP id 70060-03 for <[email protected]>;
11+
Tue, 10 May 2005 17:26:49 +0000 (GMT)
12+
Received: from xxx.xxxxx.com (xxx.xxxxx.com [69.36.39.150])
13+
by xxx.xxxxx.com (Postfix) with ESMTP id 8B957A94B
14+
for <[email protected]>; Tue, 10 May 2005 17:26:48 +0000 (GMT)
15+
Received: from xxx.xxxxx.com (xxx.xxxxx.com [64.233.184.203])
16+
by xxx.xxxxx.com (Postfix) with ESMTP id 9972514824C
17+
for <[email protected]>; Tue, 10 May 2005 12:26:40 -0500 (CDT)
18+
Received: by xxx.xxxxx.com with SMTP id 68so1694448wri
19+
for <[email protected]>; Tue, 10 May 2005 10:26:40 -0700 (PDT)
20+
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
21+
s=beta; d=xxxxx.com;
22+
h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type;
23+
b=g8ZO5ttS6GPEMAz9WxrRk9+9IXBUfQIYsZLL6T88+ECbsXqGIgfGtzJJFn6o9CE3/HMrrIGkN5AisxVFTGXWxWci5YA/7PTVWwPOhJff5BRYQDVNgRKqMl/SMttNrrRElsGJjnD1UyQ/5kQmcBxq2PuZI5Zc47u6CILcuoBcM+A=
24+
Received: by 10.54.96.19 with SMTP id t19mr621017wrb;
25+
Tue, 10 May 2005 10:26:39 -0700 (PDT)
26+
Received: by 10.54.110.5 with HTTP; Tue, 10 May 2005 10:26:39 -0700 (PDT)
27+
Message-ID: <[email protected]>
28+
Date: Tue, 10 May 2005 11:26:39 -0600
29+
From: Test Tester <[email protected]>
30+
Reply-To: Test Tester <[email protected]>
31+
32+
Subject: Another PDF with 🎉 Unicode chars in it 🍿
33+
Mime-Version: 1.0
34+
Content-Type: multipart/mixed;
35+
boundary="----=_Part_2192_32400445.1115745999735"
36+
X-Virus-Scanned: amavisd-new at textdrive.com
37+
38+
------=_Part_2192_32400445.1115745999735
39+
Content-Type: text/plain; charset=ISO-8859-1
40+
Content-Transfer-Encoding: quoted-printable
41+
Content-Disposition: inline
42+
43+
Just attaching another PDF, here, to see what the message looks like,
44+
and to see if I can figure out what is going wrong here. Â
45+
46+
------=_Part_2192_32400445.1115745999735
47+
Content-Type: application/pdf; name="broken.pdf"
48+
Content-Transfer-Encoding: base64
49+
Content-Disposition: attachment; filename="broken.pdf"
50+
51+
JVBERi0xLjQNCiXk9tzfDQoxIDAgb2JqDQo8PCAvTGVuZ3RoIDIgMCBSDQogICAvRmlsdGVyIC9G
52+
bGF0ZURlY29kZQ0KPj4NCnN0cmVhbQ0KeJy9Wt2KJbkNvm/od6jrhZxYln9hWEh2p+8HBvICySaE
53+
ycLuTV4/1ifJ9qnq09NpSBimu76yLUuy/qzqcPz7+em3Ixx/CDc6CsXxs3b5+fvfjr/8cPz6/BRu
54+
rbfAx/n3739/fuJylJ5u5fjX81OuDr4deK4Bz3z/aDP+8fz0yw8g0Ofq7ktr1Mn+u28rvhy/jVeD
55+
QSa+9YNKHP/pxjvDNfVAx/m3MFz54FhvTbaseaxiDoN2LeMVMw+yA7RbHSCDzxZuaYB2E1Yay7QU
56+
x89vz0+tyFDKMlAHK5yqLmnjF+c4RjEiQIUeKwblXMe+AsZjN1J5yGQL5DHpDHksurM81rF6PKab
57+
gK6zAarIDzIiUY23rJsN9iorAE816aIu6lsgAdQFsuhhkHOUFgVjp2GjMqSewITXNQ27jrMeamkg
58+
1rPI3iLWG2CIaSBB+V1245YVRICGbbpYKHc2USFDl6M09acQVQYhlwIrkBNLISvXhGlF1wi5FHCw
59+
wxZkoGNJlVeJCEsqKA+3YAV5AMb6KkeaqEJQmFKKQU8T1pRi2ihE1Y4CDrqoYFFXYjJJOatsyzuI
60+
8SIlykuxKTMibWK8H1PgEvqYgs4GmQSrEjJAalgGirIhik+p4ZQN9E3ETFPAHE1b8pp1l/0Rc1gl
61+
fQs0ABWvyoZZzU8VnPXwVVcO9BEsyjEJaO6eBoZRyKGlrKoYoOygA8BGIzgwN3RQ15ouigG5idZQ
62+
fx2U4Db2CqiLO0WHAZoylGiCAqhniNQjFjQPSkmjwfNTgQ6M1Ih+eWo36wFmjIxDJZiGUBiWsAyR
63+
xX3EekGOizkGI96Ol9zVZTAivikURhRsHh2E3JhWMpSTZCnnonrLhMCodgrNcgo4uyJUJc6qnVss
64+
nrGd1Ptr0YwisCOYyIbUwVjV4xBUNLbguSO2YHujonAMJkMdSI7bIw91Akq2AUlMUWGFTMAOamjU
65+
OvZQCxIkY2pCpMFo/IwLdVLHs6nddwTRrgoVbvLU9eB0G4EMndV0TNoxHbt3JBWwK6hhv3iHfDtF
66+
yokB302IpEBTnWICde4uYc/1khDbSIkQopO6lcqamGBu1OSE3N5IPSsZX00CkSHRiiyx6HQIShsS
67+
HSVNswdVsaOUSAWq9aYhDtGDaoG5a3lBGkYt/lFlBFt1UqrYnzVtUpUQnLiZeouKgf1KhRBViRRk
68+
ExepJCzTwEmFDalIRbLEGtw0gfpESOpIAF/NnpPzcVCG86s0g2DuSyd41uhNGbEgaSrWEXORErbw
69+
------=_Part_2192_32400445.1115745999735--
70+
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
From [email protected] Tue May 10 11:28:07 2005
2+
Return-Path: <[email protected]>
3+
X-Original-To: [email protected]
4+
Delivered-To: [email protected]
5+
Received: from localhost (localhost [127.0.0.1])
6+
by xxx.xxxxx.com (Postfix) with ESMTP id 50FD3A96F
7+
for <[email protected]>; Tue, 10 May 2005 17:26:50 +0000 (GMT)
8+
Received: from xxx.xxxxx.com ([127.0.0.1])
9+
by localhost (xxx.xxxxx.com [127.0.0.1]) (amavisd-new, port 10024)
10+
with LMTP id 70060-03 for <[email protected]>;
11+
Tue, 10 May 2005 17:26:49 +0000 (GMT)
12+
Received: from xxx.xxxxx.com (xxx.xxxxx.com [69.36.39.150])
13+
by xxx.xxxxx.com (Postfix) with ESMTP id 8B957A94B
14+
for <[email protected]>; Tue, 10 May 2005 17:26:48 +0000 (GMT)
15+
Received: from xxx.xxxxx.com (xxx.xxxxx.com [64.233.184.203])
16+
by xxx.xxxxx.com (Postfix) with ESMTP id 9972514824C
17+
for <[email protected]>; Tue, 10 May 2005 12:26:40 -0500 (CDT)
18+
Received: by xxx.xxxxx.com with SMTP id 68so1694448wri
19+
for <[email protected]>; Tue, 10 May 2005 10:26:40 -0700 (PDT)
20+
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
21+
s=beta; d=xxxxx.com;
22+
h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type;
23+
b=g8ZO5ttS6GPEMAz9WxrRk9+9IXBUfQIYsZLL6T88+ECbsXqGIgfGtzJJFn6o9CE3/HMrrIGkN5AisxVFTGXWxWci5YA/7PTVWwPOhJff5BRYQDVNgRKqMl/SMttNrrRElsGJjnD1UyQ/5kQmcBxq2PuZI5Zc47u6CILcuoBcM+A=
24+
Received: by 10.54.96.19 with SMTP id t19mr621017wrb;
25+
Tue, 10 May 2005 10:26:39 -0700 (PDT)
26+
Received: by 10.54.110.5 with HTTP; Tue, 10 May 2005 10:26:39 -0700 (PDT)
27+
Message-ID: <[email protected]>
28+
Date: Tue, 10 May 2005 11:26:39 -0600
29+
From: Test Tester <[email protected]>
30+
Reply-To: Test Tester <[email protected]>
31+
32+
Subject: Another PDF with 🎉 Unicode chars in it 🍿
33+
Mime-Version: 1.0
34+
Content-Type: multipart/mixed;
35+
boundary="----=_Part_2192_32400445.1115745999735"
36+
X-Virus-Scanned: amavisd-new at textdrive.com
37+
38+
------=_Part_2192_32400445.1115745999735
39+
Content-Type: text/plain; charset=ISO-8859-1
40+
Content-Transfer-Encoding: quoted-printable
41+
Content-Disposition: inline
42+
43+
Just attaching another PDF, here, to see what the message looks like,
44+
and to see if I can figure out what is going wrong here. Â
45+
46+
------=_Part_2192_32400445.1115745999735
47+
Content-Type: application/pdf; name="broken.pdf"
48+
Content-Transfer-Encoding: base64
49+
Content-Disposition: attachment; filename="broken.pdf"
50+
51+
JVBERi0xLjQNCiXk9tzfDQoxIDAgb2JqDQo8PCAvTGVuZ3RoIDIgMCBSDQogICAvRmlsdGVyIC9G
52+
bGF0ZURlY29kZQ0KPj4NCnN0cmVhbQ0KeJy9Wt2KJbkNvm/od6jrhZxYln9hWEh2p+8HBvICySaE
53+
ycLuTV4/1ifJ9qnq09NpSBimu76yLUuy/qzqcPz7+em3Ixx/CDc6CsXxs3b5+fvfjr/8cPz6/BRu
54+
rbfAx/n3739/fuJylJ5u5fjX81OuDr4deK4Bz3z/aDP+8fz0yw8g0Ofq7ktr1Mn+u28rvhy/jVeD
55+
QSa+9YNKHP/pxjvDNfVAx/m3MFz54FhvTbaseaxiDoN2LeMVMw+yA7RbHSCDzxZuaYB2E1Yay7QU
56+
x89vz0+tyFDKMlAHK5yqLmnjF+c4RjEiQIUeKwblXMe+AsZjN1J5yGQL5DHpDHksurM81rF6PKab
57+
gK6zAarIDzIiUY23rJsN9iorAE816aIu6lsgAdQFsuhhkHOUFgVjp2GjMqSewITXNQ27jrMeamkg
58+
1rPI3iLWG2CIaSBB+V1245YVRICGbbpYKHc2USFDl6M09acQVQYhlwIrkBNLISvXhGlF1wi5FHCw
59+
wxZkoGNJlVeJCEsqKA+3YAV5AMb6KkeaqEJQmFKKQU8T1pRi2ihE1Y4CDrqoYFFXYjJJOatsyzuI
60+
8SIlykuxKTMibWK8H1PgEvqYgs4GmQSrEjJAalgGirIhik+p4ZQN9E3ETFPAHE1b8pp1l/0Rc1gl
61+
fQs0ABWvyoZZzU8VnPXwVVcO9BEsyjEJaO6eBoZRyKGlrKoYoOygA8BGIzgwN3RQ15ouigG5idZQ
62+
fx2U4Db2CqiLO0WHAZoylGiCAqhniNQjFjQPSkmjwfNTgQ6M1Ih+eWo36wFmjIxDJZiGUBiWsAyR
63+
xX3EekGOizkGI96Ol9zVZTAivikURhRsHh2E3JhWMpSTZCnnonrLhMCodgrNcgo4uyJUJc6qnVss
64+
nrGd1Ptr0YwisCOYyIbUwVjV4xBUNLbguSO2YHujonAMJkMdSI7bIw91Akq2AUlMUWGFTMAOamjU
65+
OvZQCxIkY2pCpMFo/IwLdVLHs6nddwTRrgoVbvLU9eB0G4EMndV0TNoxHbt3JBWwK6hhv3iHfDtF
66+
yokB302IpEBTnWICde4uYc/1khDbSIkQopO6lcqamGBu1OSE3N5IPSsZX00CkSHRiiyx6HQIShsS
67+
HSVNswdVsaOUSAWq9aYhDtGDaoG5a3lBGkYt/lFlBFt1UqrYnzVtUpUQnLiZeouKgf1KhRBViRRk
68+
ExepJCzTwEmFDalIRbLEGtw0gfpESOpIAF/NnpPzcVCG86s0g2DuSyd41uhNGbEgaSrWEXORErbw
69+
------=_Part_2192_32400445.1115745999735--
70+

spec/mail/attachments_list_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,23 @@ def check_decoded(actual, expected)
234234
expect(mail.attachments[0].decoded.length).to eq 1026
235235
end
236236

237+
it "should decode an attachment and non-ascii text" do
238+
mail = read_fixture('emails/attachment_emails/attachment_pdf_non_ascii.eml')
239+
expect(mail.attachments[0].decoded.length).to eq 1026
240+
end
241+
237242
it "should decode an attachment with linefeeds" do
238243
mail = read_fixture('emails/attachment_emails/attachment_pdf_lf.eml')
239244
expect(mail.attachments.size).to eq(1)
240245
expect(mail.attachments[0].decoded.length).to eq 1026
241246
end
242247

248+
it "should decode an attachment with linefeeds and non-ascii text" do
249+
mail = read_fixture('emails/attachment_emails/attachment_pdf_non_ascii_lf.eml')
250+
expect(mail.attachments.size).to eq(1)
251+
expect(mail.attachments[0].decoded.length).to eq 1026
252+
end
253+
243254
it "should find an attachment that has an encoded name value" do
244255
mail = read_fixture('emails/attachment_emails/attachment_with_encoded_name.eml')
245256
expect(mail.attachments.length).to eq 1

spec/mail/message_spec.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,23 +1719,19 @@ def with_encoder(encoder)
17191719
it "should ignore the message id value if self has a nil message id" do
17201720
m1 = Mail.new("To: [email protected]\r\nSubject: Yo!\r\n\r\nHello there")
17211721
m2 = Mail.new("To: [email protected]\r\nMessage-ID: <[email protected]>\r\nSubject: Yo!\r\n\r\nHello there")
1722-
1722+
expect(m1).to eq m2
17231723
# confirm there are no side-effects in the comparison
17241724
expect(m1[:message_id]).to be_nil
17251725
expect(m2[:message_id].value).to eq '<[email protected]>'
1726-
1727-
expect(m1).to eq m2
17281726
end
17291727

17301728
it "should ignore the message id value if other has a nil message id" do
17311729
m1 = Mail.new("To: [email protected]\r\nMessage-ID: <[email protected]>\r\nSubject: Yo!\r\n\r\nHello there")
17321730
m2 = Mail.new("To: [email protected]\r\nSubject: Yo!\r\n\r\nHello there")
1733-
1731+
expect(m1).to eq m2
17341732
# confirm there are no side-effects in the comparison
17351733
expect(m1[:message_id].value).to eq '<[email protected]>'
17361734
expect(m2[:message_id]).to be_nil
1737-
1738-
expect(m1).to eq m2
17391735
end
17401736

17411737
it "should not be == if both emails have different Message IDs" do

0 commit comments

Comments
 (0)