Skip to content

Commit

Permalink
Make References field singular like In-Reply-To
Browse files Browse the repository at this point in the history
Closes mikel#1220
  • Loading branch information
rafbm authored and jeremy committed Mar 28, 2018
1 parent e851a62 commit fbc5d91
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/mail/fields/references_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ module Mail
class ReferencesField < CommonMessageIdField #:nodoc:
NAME = 'References'

def self.singular?
true
end

def initialize(value = nil, charset = nil)
value = value.join("\r\n\s") if value.is_a?(Array)
super value, charset
Expand Down
10 changes: 10 additions & 0 deletions spec/mail/message_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,16 @@ def create_mail_with_splat_args
expect(Mail::Utilities.blank?(mail.in_reply_to)).to be_truthy
end

it "should be able to pass two In-Reply-To headers" do
mail = Mail.new("From: bob\r\nIn-Reply-To: <[email protected]>\r\nIn-Reply-To: <[email protected]>\r\nSubject: Hello!\r\n\r\nemail message\r\n")
expect(mail.in_reply_to).to eq '[email protected]'
end

it "should be able to pass two References headers" do
mail = Mail.new("From: bob\r\nReferences: <[email protected]>\r\nReferences: <[email protected]>\r\nSubject: Hello!\r\n\r\nemail message\r\n")
expect(mail.references).to eq '[email protected]'
end

describe "YAML serialization" do
before(:each) do
# Ensure specs don't randomly fail due to messages being generated 1 second apart
Expand Down

0 comments on commit fbc5d91

Please sign in to comment.