Skip to content

Commit

Permalink
spec
Browse files Browse the repository at this point in the history
  • Loading branch information
ahorek committed Jan 9, 2019
1 parent 0623039 commit cce11dc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spec/mail/message_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,26 @@ def message_headers_should_match(message, other)
expect(mail.parts.last.content_transfer_encoding).to match(/7bit|8bit|binary/)
end

it "should not add an empty charset" do
mail = Mail.new do
to 'mikel@test.lindsaar.net'
from 'bob@test.lindsaar.net'
subject 'Multipart email'
text_part do
body 'This is plain text'
end
html_part do
content_type 'text/html; charset=UTF-8'
body '<h1>This is HTML</h1>'
end
end
mail.charset = nil

expect(mail.multipart?).to eq true
expect(mail.parts.count).to eq 2
expect(mail.encoded.scan(/charset=UTF-8/).count).to eq 2
end

describe "convert_to_multipart" do
subject do
read_fixture('emails', 'attachment_emails', 'attachment_only_email.eml').tap(&:convert_to_multipart)
Expand Down

0 comments on commit cce11dc

Please sign in to comment.