From 527a97e72903e88298ea6bd3231299cdcfb684e8 Mon Sep 17 00:00:00 2001 From: Jens Balvig Date: Tue, 13 Dec 2022 15:42:40 +0100 Subject: [PATCH] Body text goes missing when using add_file --- spec/mail/message_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/mail/message_spec.rb b/spec/mail/message_spec.rb index e2405cf58..54bc8827b 100644 --- a/spec/mail/message_spec.rb +++ b/spec/mail/message_spec.rb @@ -136,6 +136,14 @@ def create_mail_with_splat_args expect(Mail::Message.new(raw_email).part[0].header[:filename]).to be_nil end + it "should preserve body text" do + m = Mail.new + m.body = "Body text" + m.add_file(:filename => "attachment.data", :content => "a") + + expect(m.body.to_s).to eq("Body text") + end + it "should not raise a warning on having non US-ASCII characters in the header (should just handle it)" do expect { read_fixture('emails', 'plain_emails', 'raw_email_string_in_date_field.eml')