spec/unit/postmark/message_extensions/mail_spec.rb in postmark-1.0.0 vs spec/unit/postmark/message_extensions/mail_spec.rb in postmark-1.0.1

- old
+ new

@@ -64,10 +64,20 @@ body "Hello Sheldon!" add_file empty_gif_path end end + let(:mail_message_with_named_addresses) do + Mail.new do + from "Sheldon <sheldon@bigbangtheory.com>" + to "\"Leonard Hofstadter\" <leonard@bigbangtheory.com>" + subject "Hello!" + body "Hello Sheldon!" + reply_to 'Penny "The Neighbor" <penny@bigbangtheory.com>' + end + end + describe "#html?" do it 'is true for html only email' do mail_html_message.should be_html end end @@ -198,8 +208,18 @@ "Attachments" => [{"Name"=>"empty.gif", "Content"=>encoded_empty_gif_data, "ContentType"=>"image/gif"}], "TextBody"=>"Hello Sheldon!", "To"=>"lenard@bigbangtheory.com"} + end + + it 'converts messages with named addresses correctly' do + mail_message_with_named_addresses.to_postmark_hash.should == { + "From" => "Sheldon <sheldon@bigbangtheory.com>", + "Subject" => "Hello!", + "TextBody" => "Hello Sheldon!", + "To" => "Leonard Hofstadter <leonard@bigbangtheory.com>", + "ReplyTo" => "\"Penny \\\"The Neighbor\\\"\" <penny@bigbangtheory.com>" + } end end end \ No newline at end of file