Permalink
Browse files

Merge remote-tracking branch 'github/fix_nme_on_nil'

  • Loading branch information...
2 parents 3971d15 + 1480dc5 commit bd0f3d0237e498fd7e8402afb809797e09fa8fed @ConradIrwin committed Aug 20, 2012
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/mail/message.rb
  2. +5 −0 spec/mail/message_spec.rb
View
@@ -1422,7 +1422,7 @@ def message_content_type
# Returns the character set defined in the content type field
def charset
if @header
- content_type ? content_type_parameters['charset'] : @charset
+ has_content_type? ? content_type_parameters['charset'] : @charset
else
@charset
end
@@ -116,6 +116,11 @@ def basic_email
mail.sub_type.should eq 'plain'
end
+ it "should not explode on unparseable content-type field" do
+ mail = Mail::Message.new("Content-Type: txt/plain; charset=utf-8;")
+ doing{ mail.charset }.should_not raise_error
+ end
+
it "should be able to pass an empty reply-to header" do
mail = Mail.new(File.read(fixture('emails', 'error_emails', 'empty_in_reply_to.eml')))
mail.in_reply_to.should be_blank

0 comments on commit bd0f3d0

Please sign in to comment.