Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clarify that Sender is a single address, not an address list

Closes #303
  • Loading branch information...
commit 1bfb0af1b6ace9379cd0bf81b1e50bb7765eca97 1 parent 2babe56
@jeremy jeremy authored
View
1  CHANGELOG.rdoc
@@ -23,6 +23,7 @@ Coping with third-party bugs:
* Parse multipart boundary from Content-Type headers containing extra semicolons (jeremy)
Housekeeping:
+* Clarify that Sender is a single address, not an address list (jeremy)
* Add an MIT-LICENSE file to make licensing clear & obvious; update to 2013 (jeremy)
* Close pull request 499 - Clean up some dead code (ConradIrwin)
* Close pull request 489, 495 - Docs typos (JackDanger, francois)
View
12 lib/mail/fields/sender_field.rb
@@ -15,16 +15,16 @@
# == Examples:
#
# mail = Mail.new
-# mail.sender = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
-# mail.sender #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
+# mail.sender = 'Mikel Lindsaar <mikel@test.lindsaar.net>'
+# mail.sender #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>'
# mail[:sender] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::SenderField:0x180e1c4
# mail['sender'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::SenderField:0x180e1c4
# mail['Sender'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::SenderField:0x180e1c4
#
-# mail[:sender].encoded #=> 'Sender: Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net\r\n'
-# mail[:sender].decoded #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
-# mail[:sender].addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
-# mail[:sender].formatted #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
+# mail[:sender].encoded #=> "Sender: Mikel Lindsaar <mikel@test.lindsaar.net>\r\n"
+# mail[:sender].decoded #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>'
+# mail[:sender].addresses #=> ['mikel@test.lindsaar.net']
+# mail[:sender].formatted #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>']
#
require 'mail/fields/common/common_address'
View
13 spec/mail/fields/sender_field_spec.rb
@@ -16,15 +16,20 @@
end
it "should accept a string with the field name" do
- t = Mail::SenderField.new('Sender: Mikel Lindsaar <mikel@test.lindsaar.net>, "Bob Smith" <bob@me.com>')
+ t = Mail::SenderField.new('Sender: Mikel Lindsaar <mikel@test.lindsaar.net>')
t.name.should eq 'Sender'
- t.value.should eq 'Mikel Lindsaar <mikel@test.lindsaar.net>, "Bob Smith" <bob@me.com>'
+ t.value.should eq 'Mikel Lindsaar <mikel@test.lindsaar.net>'
end
it "should accept a string without the field name" do
- t = Mail::SenderField.new('Mikel Lindsaar <mikel@test.lindsaar.net>, "Bob Smith" <bob@me.com>')
+ t = Mail::SenderField.new('Mikel Lindsaar <mikel@test.lindsaar.net>')
t.name.should eq 'Sender'
- t.value.should eq 'Mikel Lindsaar <mikel@test.lindsaar.net>, "Bob Smith" <bob@me.com>'
+ t.value.should eq 'Mikel Lindsaar <mikel@test.lindsaar.net>'
+ end
+
+ it "should reject headers with multiple mailboxes" do
+ pending 'Sender accepts an address list now, but should only accept a single address'
+ doing { Mail::SenderField.new('Sender: Mikel Lindsaar <mikel@test.lindsaar.net>, "Bob Smith" <bob@me.com>') }.should raise_error
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.