Skip to content

Commit

Permalink
Cover parent nil case
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyshields authored and Mikel Lindsaar committed Nov 30, 2022
1 parent 49df03a commit 4282e27
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions spec/mail/message_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2041,6 +2041,39 @@ def self.delivering_email(mail)
expect(mail.charset).to eq 'ISO-8859-1'
expect(p.charset).to eq nil
end

it "should preserve the charset of the mail when nil vs UTF-8" do
mail = Mail.new
mail['charset'] = nil
expect(mail.charset).to eq nil
p = Mail::Part.new(:content_type => 'text/html', :body => 'HTML TEXT', :charset => 'UTF-8')
expect(p.charset).to eq 'UTF-8'
mail.add_part(p)
expect(mail.charset).to eq nil
expect(p.charset).to eq 'UTF-8'
end

it "should preserve the charset of the mail when nil vs ISO-8859-1" do
mail = Mail.new
mail['charset'] = nil
expect(mail.charset).to eq nil
p = Mail::Part.new(:content_type => 'text/html', :body => 'HTML TEXT', :charset => 'ISO-8859-1')
expect(p.charset).to eq 'ISO-8859-1'
mail.add_part(p)
expect(mail.charset).to eq nil
expect(p.charset).to eq 'ISO-8859-1'
end

it "should preserve the charset of the mail when nil vs nil" do
mail = Mail.new
mail['charset'] = nil
expect(mail.charset).to eq nil
p = Mail::Part.new(:content_type => 'text/html', :body => 'HTML TEXT')
expect(p.charset).to eq nil
mail.add_part(p)
expect(mail.charset).to eq nil
expect(p.charset).to eq nil
end
end

describe "ordering messages" do
Expand Down

0 comments on commit 4282e27

Please sign in to comment.