Skip to content

Commit

Permalink
Calling #to_s on a field with a nil value returns an empty string ins…
Browse files Browse the repository at this point in the history
…tead of nil

Fixes #194
  • Loading branch information
jeremy committed Jan 27, 2013
1 parent 80ccb5f commit 83b97d2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rdoc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Performance:
* Close pull request 488 - Speed up field construction & comparison (bpot) * Close pull request 488 - Speed up field construction & comparison (bpot)


Bugs: Bugs:
* Calling #to_s on a field with a nil value returns an empty string instead of nil (jeremy)
* The Received header may contain zero name/value pairs, qmail-style (jeremy) * The Received header may contain zero name/value pairs, qmail-style (jeremy)
* Fix that setting an attachment with a :mime_type and :encoding would override the :encoding (jeremy) * Fix that setting an attachment with a :mime_type and :encoding would override the :encoding (jeremy)
* Fix that declaring an html_part but no text_part would use multipart/alternative anyway (jeremy) * Fix that declaring an html_part but no text_part would use multipart/alternative anyway (jeremy)
Expand Down
2 changes: 1 addition & 1 deletion lib/mail/fields/common/common_field.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def value
end end


def to_s def to_s
decoded decoded.to_s
end end


def default def default
Expand Down
2 changes: 1 addition & 1 deletion spec/mail/fields/unstructured_field_spec.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@


it "should return '' on to_s if there is no value" do it "should return '' on to_s if there is no value" do
@field.value = nil @field.value = nil
@field.encoded.should eq '' @field.to_s.should eq ''
end end


it "should give an encoded value ready to insert into an email" do it "should give an encoded value ready to insert into an email" do
Expand Down

0 comments on commit 83b97d2

Please sign in to comment.