Permalink
Browse files

Body should call to_s on given input... incase someone gave it an IO.…

…readlines result (Array)
  • Loading branch information...
1 parent 388b4b7 commit b59f058d41fdc82b442a703b97a03133bdd7c81d @mikel mikel committed Jan 22, 2010
Showing with 10 additions and 1 deletion.
  1. +1 −1 lib/mail/body.rb
  2. +9 −0 spec/mail/body_spec.rb
View
@@ -35,7 +35,7 @@ def initialize(string = '')
if string.blank?
@raw_source = ''
else
- @raw_source = string
+ @raw_source = string.to_s
end
@encoding = nil
set_charset
@@ -39,6 +39,15 @@
body.to_s.should == ''
end
+ it "should accept an array as the body and join it" do
+ doing { Mail::Body.new(["line one\n", "line two\n"]) }.should_not raise_error
+ end
+
+ it "should accept an array as the body and join it" do
+ body = Mail::Body.new(["line one\n", "line two\n"])
+ body.encoded.should == "line one\r\nline two\r\n"
+ end
+
end
describe "encoding" do

0 comments on commit b59f058

Please sign in to comment.