Skip to content
Browse files

Upgrade to RSpec 3.0.0

This upgrade was mostly done with transpec, so is automated. All the
specs still pass, but there may be ugly style things.
  • Loading branch information...
1 parent 76725fc commit 7bcecd7e2505817c39478f35a3caa167ad34549e @mootpointer mootpointer committed Jun 10, 2014
Showing with 2,577 additions and 2,577 deletions.
  1. +1 −1 mail.gemspec
  2. +53 −53 spec/mail/attachments_list_spec.rb
  3. +97 −97 spec/mail/body_spec.rb
  4. +13 −13 spec/mail/configuration_spec.rb
  5. +14 −14 spec/mail/core_extensions/string_spec.rb
  6. +22 −22 spec/mail/core_extensions_spec.rb
  7. +21 −21 spec/mail/elements/address_list_spec.rb
  8. +70 −70 spec/mail/elements/address_spec.rb
  9. +3 −3 spec/mail/elements/date_time_element_spec.rb
  10. +6 −6 spec/mail/elements/envelope_from_element_spec.rb
  11. +7 −7 spec/mail/elements/message_ids_element_spec.rb
  12. +3 −3 spec/mail/elements/phrase_list_spec.rb
  13. +5 −5 spec/mail/elements/received_element_spec.rb
  14. +21 −21 spec/mail/encoding_spec.rb
  15. +4 −4 spec/mail/encodings/base64_spec.rb
  16. +8 −8 spec/mail/encodings/quoted_printable_spec.rb
  17. +119 −119 spec/mail/encodings_spec.rb
  18. +95 −95 spec/mail/example_emails_spec.rb
  19. +6 −6 spec/mail/field_list_spec.rb
  20. +72 −72 spec/mail/field_spec.rb
  21. +15 −15 spec/mail/fields/bcc_field_spec.rb
  22. +16 −16 spec/mail/fields/cc_field_spec.rb
  23. +5 −5 spec/mail/fields/comments_field_spec.rb
  24. +4 −4 spec/mail/fields/common/address_container_spec.rb
  25. +41 −41 spec/mail/fields/common/common_address_spec.rb
  26. +3 −3 spec/mail/fields/common/common_date_spec.rb
  27. +12 −12 spec/mail/fields/common/common_field_spec.rb
  28. +4 −4 spec/mail/fields/common/common_message_id_spec.rb
  29. +18 −18 spec/mail/fields/common/parameter_hash_spec.rb
  30. +5 −5 spec/mail/fields/content_description_field_spec.rb
  31. +19 −19 spec/mail/fields/content_disposition_field_spec.rb
  32. +22 −22 spec/mail/fields/content_id_field_spec.rb
  33. +8 −8 spec/mail/fields/content_location_field_spec.rb
  34. +18 −18 spec/mail/fields/content_transfer_encoding_field_spec.rb
  35. +242 −242 spec/mail/fields/content_type_field_spec.rb
  36. +15 −15 spec/mail/fields/date_field_spec.rb
  37. +3 −3 spec/mail/fields/envelope_spec.rb
  38. +20 −20 spec/mail/fields/from_field_spec.rb
  39. +17 −17 spec/mail/fields/in_reply_to_field_spec.rb
  40. +13 −13 spec/mail/fields/keywords_field_spec.rb
  41. +23 −23 spec/mail/fields/message_id_field_spec.rb
  42. +17 −17 spec/mail/fields/mime_version_field_spec.rb
  43. +16 −16 spec/mail/fields/received_field_spec.rb
  44. +16 −16 spec/mail/fields/references_field_spec.rb
  45. +14 −14 spec/mail/fields/reply_to_field_spec.rb
  46. +14 −14 spec/mail/fields/resent_bcc_field_spec.rb
  47. +14 −14 spec/mail/fields/resent_cc_field_spec.rb
  48. +12 −12 spec/mail/fields/resent_date_field_spec.rb
  49. +14 −14 spec/mail/fields/resent_from_field_spec.rb
  50. +8 −8 spec/mail/fields/resent_message_id_field_spec.rb
  51. +10 −10 spec/mail/fields/resent_sender_field_spec.rb
  52. +14 −14 spec/mail/fields/resent_to_field_spec.rb
  53. +6 −6 spec/mail/fields/return_path_field_spec.rb
  54. +12 −12 spec/mail/fields/sender_field_spec.rb
  55. +11 −11 spec/mail/fields/structured_field_spec.rb
  56. +20 −20 spec/mail/fields/to_field_spec.rb
  57. +33 −33 spec/mail/fields/unstructured_field_spec.rb
  58. +130 −130 spec/mail/header_spec.rb
  59. +7 −7 spec/mail/mail_spec.rb
  60. +474 −473 spec/mail/message_spec.rb
  61. +114 −114 spec/mail/mime_messages_spec.rb
  62. +2 −2 spec/mail/multibyte_spec.rb
  63. +22 −22 spec/mail/multipart_report_spec.rb
  64. +12 −12 spec/mail/network/delivery_methods/exim_spec.rb
  65. +9 −9 spec/mail/network/delivery_methods/file_delivery_spec.rb
  66. +13 −13 spec/mail/network/delivery_methods/sendmail_spec.rb
  67. +8 −8 spec/mail/network/delivery_methods/smtp_connection_spec.rb
  68. +17 −17 spec/mail/network/delivery_methods/smtp_spec.rb
  69. +10 −10 spec/mail/network/delivery_methods/test_mailer_spec.rb
  70. +64 −64 spec/mail/network/retriever_methods/imap_spec.rb
  71. +50 −50 spec/mail/network/retriever_methods/pop3_spec.rb
  72. +23 −23 spec/mail/network/retriever_methods/test_retriever_spec.rb
  73. +64 −64 spec/mail/network_spec.rb
  74. +5 −5 spec/mail/parsers/address_lists_parser_spec.rb
  75. +14 −14 spec/mail/parsers/content_transfer_encoding_parser_spec.rb
  76. +30 −30 spec/mail/part_spec.rb
  77. +2 −2 spec/mail/parts_list_spec.rb
  78. +9 −9 spec/mail/round_tripping_spec.rb
  79. +65 −65 spec/mail/utilities_spec.rb
  80. +5 −5 spec/mail/version_specific/escape_paren_1_8_spec.rb
  81. +34 −34 spec/matchers_spec.rb
  82. +0 −1 spec/spec_helper.rb
View
2 mail.gemspec
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('bundler', '>= 1.0.3')
s.add_development_dependency('rake', '> 0.8.7')
- s.add_development_dependency('rspec', '~> 2.12.0')
+ s.add_development_dependency('rspec', '~> 3.0.0')
s.add_development_dependency('rdoc')
s.require_path = 'lib'
View
106 spec/mail/attachments_list_spec.rb
@@ -7,10 +7,10 @@ def encode_base64(str)
def check_decoded(actual, expected)
if RUBY_VERSION >= '1.9'
- actual.encoding.should eq Encoding::BINARY
- actual.should eq expected.force_encoding(Encoding::BINARY)
+ expect(actual.encoding).to eq Encoding::BINARY
+ expect(actual).to eq expected.force_encoding(Encoding::BINARY)
else
- actual.should eq expected
+ expect(actual).to eq expected
end
end
@@ -24,51 +24,51 @@ def check_decoded(actual, expected)
describe "from direct content" do
it "should work" do
@mail.attachments['test.png'] = @test_png
- @mail.attachments['test.png'].filename.should eq 'test.png'
+ expect(@mail.attachments['test.png'].filename).to eq 'test.png'
check_decoded(@mail.attachments[0].decoded, @test_png)
end
it "should work out magically the mime_type" do
@mail.attachments['test.png'] = @test_png
- @mail.attachments[0].mime_type.should eq 'image/png'
+ expect(@mail.attachments[0].mime_type).to eq 'image/png'
end
it "should assign the filename" do
@mail.attachments['test.png'] = @test_png
- @mail.attachments[0].filename.should eq 'test.png'
+ expect(@mail.attachments[0].filename).to eq 'test.png'
end
it "should assign mime-encoded multibyte filename" do
@mail.attachments['てすと.txt'] = File.open(fixture('attachments', 'てすと.txt'), 'rb', &:read)
- @mail.attachments.should_not be_blank
- Mail::Encodings.decode_encode(@mail.attachments[0].filename, :decode).should eq 'てすと.txt'
+ expect(@mail.attachments).not_to be_blank
+ expect(Mail::Encodings.decode_encode(@mail.attachments[0].filename, :decode)).to eq 'てすと.txt'
end
end
describe "from a supplied Hash" do
it "should work" do
@mail.attachments['test.png'] = { :content => @test_png }
- @mail.attachments[0].filename.should eq 'test.png'
+ expect(@mail.attachments[0].filename).to eq 'test.png'
check_decoded(@mail.attachments[0].decoded, @test_png)
end
it "should allow you to override the content_type" do
@mail.attachments['test.png'] = { :content => @test_png,
:content_type => "application/x-gzip" }
- @mail.attachments[0].content_type.should eq 'application/x-gzip'
+ expect(@mail.attachments[0].content_type).to eq 'application/x-gzip'
end
it "should allow you to override the mime_type" do
@mail.attachments['test.png'] = { :content => @test_png,
:mime_type => "application/x-gzip" }
- @mail.attachments[0].mime_type.should eq 'application/x-gzip'
+ expect(@mail.attachments[0].mime_type).to eq 'application/x-gzip'
end
it "should allow you to override the mime_type" do
@mail.attachments['invoice.jpg'] = { :data => "you smiling",
:mime_type => "image/x-jpg",
:transfer_encoding => "base64" }
- @mail.attachments[0].mime_type.should eq 'image/x-jpg'
+ expect(@mail.attachments[0].mime_type).to eq 'image/x-jpg'
end
end
@@ -78,13 +78,13 @@ def check_decoded(actual, expected)
it "should set its content_transfer_encoding" do
@mail.attachments['test.png'] = { :content => @test_png }
@mail.ready_to_send!
- @mail.attachments[0].content_transfer_encoding.should eq 'base64'
+ expect(@mail.attachments[0].content_transfer_encoding).to eq 'base64'
end
it "should encode its body to base64" do
@mail.attachments['test.png'] = { :content => @test_png }
@mail.ready_to_send!
- @mail.attachments[0].encoded.should include(encode_base64(@test_png))
+ expect(@mail.attachments[0].encoded).to include(encode_base64(@test_png))
end
it "should allow you to pass in an encoded attachment with an encoding" do
@@ -97,14 +97,14 @@ def check_decoded(actual, expected)
it "should allow you set a mime type and encoding without overriding the encoding" do
encoded = encode_base64('<foo/>')
@mail.attachments['test.png'] = { :mime_type => 'text/xml', :content => encoded, :encoding => 'base64' }
- @mail.attachments[0].content_transfer_encoding.should eq 'base64'
+ expect(@mail.attachments[0].content_transfer_encoding).to eq 'base64'
check_decoded(@mail.attachments[0].decoded, '<foo/>')
end
it "should not allow you to pass in an encoded attachment with an unknown encoding" do
base64_encoded_data = encode_base64(@test_png)
- doing {@mail.attachments['test.png'] = { :content => base64_encoded_data,
- :encoding => 'weird_encoding' }}.should raise_error
+ expect {@mail.attachments['test.png'] = { :content => base64_encoded_data,
+ :encoding => 'weird_encoding' }}.to raise_error
end
it "should be able to call read on the attachment to return the decoded data" do
@@ -114,15 +114,15 @@ def check_decoded(actual, expected)
else
expected = @mail.attachments[0].read
end
- expected.should eq @test_png
+ expect(expected).to eq @test_png
end
it "should only add one newline between attachment body and boundary" do
contents = "I have\ntwo lines with trailing newlines\n\n"
@mail.attachments['text.txt'] = { :content => contents}
encoded = @mail.encoded
regex = /\r\n#{Regexp.escape(contents.gsub(/\n/, "\r\n"))}\r\n--#{@mail.boundary}--\r\n\Z/
- encoded.should match regex
+ expect(encoded).to match regex
end
end
@@ -135,10 +135,10 @@ def check_decoded(actual, expected)
mail.attachments['test.gif'] = File.open(fixture('attachments', 'test.gif'), 'rb', &:read)
mail.attachments['test.jpg'] = File.open(fixture('attachments', 'test.jpg'), 'rb', &:read)
mail.attachments['test.zip'] = File.open(fixture('attachments', 'test.zip'), 'rb', &:read)
- mail.attachments[0].filename.should eq 'test.pdf'
- mail.attachments[1].filename.should eq 'test.gif'
- mail.attachments[2].filename.should eq 'test.jpg'
- mail.attachments[3].filename.should eq 'test.zip'
+ expect(mail.attachments[0].filename).to eq 'test.pdf'
+ expect(mail.attachments[1].filename).to eq 'test.gif'
+ expect(mail.attachments[2].filename).to eq 'test.jpg'
+ expect(mail.attachments[3].filename).to eq 'test.zip'
end
end
@@ -148,21 +148,21 @@ def check_decoded(actual, expected)
it "should set the content_disposition to inline or attachment as appropriate" do
mail = Mail.new
mail.attachments['test.pdf'] = File.open(fixture('attachments', 'test.pdf'), 'rb', &:read)
- mail.attachments['test.pdf'].content_disposition.should eq 'attachment; filename=test.pdf'
+ expect(mail.attachments['test.pdf'].content_disposition).to eq 'attachment; filename=test.pdf'
mail.attachments.inline['test.png'] = File.open(fixture('attachments', 'test.png'), 'rb', &:read)
- mail.attachments.inline['test.png'].content_disposition.should eq 'inline; filename=test.png'
+ expect(mail.attachments.inline['test.png'].content_disposition).to eq 'inline; filename=test.png'
end
it "should return a cid" do
mail = Mail.new
mail.attachments.inline['test.png'] = @test_png
- mail.attachments['test.png'].url.should eq "cid:#{mail.attachments['test.png'].cid}"
+ expect(mail.attachments['test.png'].url).to eq "cid:#{mail.attachments['test.png'].cid}"
end
it "should respond true to inline?" do
mail = Mail.new
mail.attachments.inline['test.png'] = @test_png
- mail.attachments['test.png'].should be_inline
+ expect(mail.attachments['test.png']).to be_inline
end
end
@@ -174,17 +174,17 @@ def check_decoded(actual, expected)
end
it "should return a content-id for the attachment on creation if passed inline => true" do
- @cid.should_not be_nil
+ expect(@cid).not_to be_nil
end
it "should return a valid content-id on inline attachments" do
- Mail::ContentIdField.new(@cid).errors.should be_empty
+ expect(Mail::ContentIdField.new(@cid).errors).to be_empty
end
it "should provide a URL escaped content_id (without brackets) for use inside an email" do
@inline = @mail.attachments['test.gif'].cid
uri_parser = URI.const_defined?(:Parser) ? URI::Parser.new : URI
- @inline.should eq uri_parser.escape(@cid.gsub(/^</, '').gsub(/>$/, ''))
+ expect(@inline).to eq uri_parser.escape(@cid.gsub(/^</, '').gsub(/>$/, ''))
end
end
@@ -193,7 +193,7 @@ def check_decoded(actual, expected)
mail = Mail.new
mail.attachments['test.pdf'] = File.open(fixture('attachments', 'test.pdf'), 'rb', &:read)
mail.encoded
- mail.mime_type.should eq 'multipart/mixed'
+ expect(mail.mime_type).to eq 'multipart/mixed'
end
it "allows you to set the attachment before the content type" do
@@ -210,12 +210,12 @@ def check_decoded(actual, expected)
it "should not raise an exception with a filename that contains a non-7bit-character" do
filename = "f\u00f6\u00f6.b\u00e4r"
if RUBY_VERSION >= '1.9'
- filename.encoding.should eq Encoding::UTF_8
+ expect(filename.encoding).to eq Encoding::UTF_8
end
mail = Mail.new
- doing {
+ expect {
mail.attachments[filename] = File.open(fixture('attachments', 'test.pdf'), 'rb', &:read)
- }.should_not raise_error
+ }.not_to raise_error
end
end
@@ -226,48 +226,48 @@ def check_decoded(actual, expected)
it "should find the attachment using content location" do
mail = Mail.read(fixture(File.join('emails', 'attachment_emails', 'attachment_content_location.eml')))
- mail.attachments.length.should eq 1
+ expect(mail.attachments.length).to eq 1
end
it "should find an attachment defined with 'name' and Content-Disposition: attachment" do
mail = Mail.read(fixture(File.join('emails', 'attachment_emails', 'attachment_content_disposition.eml')))
- mail.attachments.length.should eq 1
+ expect(mail.attachments.length).to eq 1
end
it "should use the content-type filename or name over the content-disposition filename" do
mail = Mail.read(fixture(File.join('emails', 'attachment_emails', 'attachment_content_disposition.eml')))
- mail.attachments[0].filename.should eq 'hello.rb'
+ expect(mail.attachments[0].filename).to eq 'hello.rb'
end
it "should decode an attachment" do
mail = Mail.read(fixture(File.join('emails', 'attachment_emails', 'attachment_pdf.eml')))
- mail.attachments[0].decoded.length.should eq 1026
+ expect(mail.attachments[0].decoded.length).to eq 1026
end
it "should find an attachment that has an encoded name value" do
mail = Mail.read(fixture(File.join('emails', 'attachment_emails', 'attachment_with_encoded_name.eml')))
- mail.attachments.length.should eq 1
+ expect(mail.attachments.length).to eq 1
result = mail.attachments[0].filename
if RUBY_VERSION >= '1.9'
expected = "01 Quien Te Dij\212at. Pitbull.mp3".force_encoding(result.encoding)
else
expected = "01 Quien Te Dij\212at. Pitbull.mp3"
end
- result.should eq expected
+ expect(result).to eq expected
end
it "should find an attachment that has a name not surrounded by quotes" do
mail = Mail.read(fixture(File.join('emails', 'attachment_emails', "attachment_with_unquoted_name.eml")))
- mail.attachments.length.should eq 1
- mail.attachments.first.filename.should eq "This is a test.txt"
+ expect(mail.attachments.length).to eq 1
+ expect(mail.attachments.first.filename).to eq "This is a test.txt"
end
it "should find attachments inside parts with content-type message/rfc822" do
mail = Mail.read(fixture(File.join("emails",
"attachment_emails",
"attachment_message_rfc822.eml")))
- mail.attachments.length.should eq 1
- mail.attachments[0].decoded.length.should eq 1026
+ expect(mail.attachments.length).to eq 1
+ expect(mail.attachments[0].decoded.length).to eq 1026
end
it "attach filename decoding (issue 83)" do
@@ -302,7 +302,7 @@ def check_decoded(actual, expected)
limitMAIL
mail = Mail.new(data)
#~ puts Mail::Encodings.decode_encode(mail.attachments[0].filename, :decode)
- mail.attachments[0].filename.should eq "Foto0009.jpg"
+ expect(mail.attachments[0].filename).to eq "Foto0009.jpg"
end
end
@@ -325,16 +325,16 @@ def check_decoded(actual, expected)
mail.attachments['test.pdf'] = File.open(fixture('attachments', 'test.pdf'), 'rb', &:read)
mail.attachments['test.gif'] = File.open(fixture('attachments', 'test.gif'), 'rb', &:read)
mail.attachments['test.jpg'] = File.open(fixture('attachments', 'test.jpg'), 'rb', &:read)
- mail.attachments[0].filename.should eq 'test.zip'
- mail.attachments[1].filename.should eq 'test.pdf'
- mail.attachments[2].filename.should eq 'test.gif'
- mail.attachments[3].filename.should eq 'test.jpg'
+ expect(mail.attachments[0].filename).to eq 'test.zip'
+ expect(mail.attachments[1].filename).to eq 'test.pdf'
+ expect(mail.attachments[2].filename).to eq 'test.gif'
+ expect(mail.attachments[3].filename).to eq 'test.jpg'
mail2 = Mail.new(mail.encoded)
- mail2.attachments[0].filename.should eq 'test.zip'
- mail2.attachments[1].filename.should eq 'test.pdf'
- mail2.attachments[2].filename.should eq 'test.gif'
- mail2.attachments[3].filename.should eq 'test.jpg'
+ expect(mail2.attachments[0].filename).to eq 'test.zip'
+ expect(mail2.attachments[1].filename).to eq 'test.pdf'
+ expect(mail2.attachments[2].filename).to eq 'test.gif'
+ expect(mail2.attachments[3].filename).to eq 'test.jpg'
end
end
View
194 spec/mail/body_spec.rb
@@ -26,30 +26,30 @@
describe "initialization" do
it "should be instantiated" do
- doing { Mail::Body.new }.should_not raise_error
+ expect { Mail::Body.new }.not_to raise_error
end
it "should initialize on a nil value" do
- doing { Mail::Body.new(nil) }.should_not raise_error
+ expect { Mail::Body.new(nil) }.not_to raise_error
end
it "should accept text as raw source data" do
body = Mail::Body.new('this is some text')
- body.to_s.should eq 'this is some text'
+ expect(body.to_s).to eq 'this is some text'
end
it "should accept nil as a value and return an empty body" do
body = Mail::Body.new
- body.to_s.should eq ''
+ expect(body.to_s).to eq ''
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
+ expect { Mail::Body.new(["line one\n", "line two\n"]) }.not_to 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 eq "line one\r\nline two\r\n"
+ expect(body.encoded).to eq "line one\r\nline two\r\n"
end
end
@@ -58,29 +58,29 @@
it "should accept text as raw source data" do
body = Mail::Body.new('this is some text')
- body.encoded.should eq 'this is some text'
+ expect(body.encoded).to eq 'this is some text'
end
it "should set its own encoding to us_ascii if it is ascii only body" do
body = Mail::Body.new('This is some text')
- body.charset.should eq 'US-ASCII'
+ expect(body.charset).to eq 'US-ASCII'
end
it "should allow you to set its encoding" do
body = Mail::Body.new('')
body.charset = 'UTF-8'
- body.charset.should eq 'UTF-8'
+ expect(body.charset).to eq 'UTF-8'
end
it "should allow you to specify an encoding" do
body = Mail::Body.new('')
body.encoding = 'base64'
- body.encoding.should eq 'base64'
+ expect(body.encoding).to eq 'base64'
end
it "should convert all new lines to crlf" do
body = Mail::Body.new("This has \n various \r new \r\n lines")
- body.encoded.should eq "This has \r\n various \r\n new \r\n lines"
+ expect(body.encoded).to eq "This has \r\n various \r\n new \r\n lines"
end
end
@@ -89,30 +89,30 @@
it "should convert all new lines to crlf" do
body = Mail::Body.new("This has \n various \r new \r\n lines")
- body.decoded.should eq "This has \n various \n new \n lines"
+ expect(body.decoded).to eq "This has \n various \n new \n lines"
end
it "should not change a body on decode if not given an encoding type to decode" do
body = Mail::Body.new("The=3Dbody")
- body.decoded.should eq "The=3Dbody"
+ expect(body.decoded).to eq "The=3Dbody"
end
it "should change return the raw text if it does not recognise the encoding" do
body = Mail::Body.new("The=3Dbody")
body.encoding = '7bit'
- body.decoded.should eq "The=3Dbody"
+ expect(body.decoded).to eq "The=3Dbody"
end
it "should change a body on decode if given an encoding type to decode" do
body = Mail::Body.new("The=3Dbody")
body.encoding = 'quoted-printable'
- body.decoded.should eq "The=body"
+ expect(body.decoded).to eq "The=body"
end
it "should change a body on decode if given an encoding type to decode" do
body = Mail::Body.new("VGhlIGJvZHk=\n")
body.encoding = 'base64'
- body.decoded.should eq "The body"
+ expect(body.decoded).to eq "The body"
end
end
@@ -122,56 +122,56 @@
multipart_body = "this is some text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/plain; charset=ISO-8859-1\r\n\r\nThis is a plain text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/html\r\n\r\n<p>This is HTML</p>\r\n------=_Part_2192_32400445--\r\n"
body = Mail::Body.new(multipart_body)
body.split!('----=_Part_2192_32400445')
- body.boundary.should eq '----=_Part_2192_32400445'
+ expect(body.boundary).to eq '----=_Part_2192_32400445'
end
it "should split at the boundry string given returning two message bodies" do
multipart_body = "this is some text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/plain; charset=ISO-8859-1\r\n\r\nThis is a plain text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/html\r\n\r\n<p>This is HTML</p>\r\n------=_Part_2192_32400445--\r\n"
body = Mail::Body.new(multipart_body)
- body.split!('----=_Part_2192_32400445').parts.length.should eq 2
+ expect(body.split!('----=_Part_2192_32400445').parts.length).to eq 2
end
it "should keep the preamble text as its own preamble" do
multipart_body = "this is some text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/plain; charset=ISO-8859-1\r\n\r\nThis is a plain text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/html\r\n\r\n<p>This is HTML</p>\r\n------=_Part_2192_32400445--\r\n"
body = Mail::Body.new(multipart_body)
body.split!('----=_Part_2192_32400445')
- body.preamble.should eq "this is some text"
+ expect(body.preamble).to eq "this is some text"
end
it "should return the parts as their own messages" do
multipart_body = "this is some text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/plain; charset=ISO-8859-1\r\n\r\nThis is a plain text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/html\r\n\r\n<p>This is HTML</p>\r\n------=_Part_2192_32400445--\r\n"
body = Mail::Body.new(multipart_body)
body.split!('----=_Part_2192_32400445')
- body.parts[0].class.should eq Mail::Part
- body.parts[1].class.should eq Mail::Part
+ expect(body.parts[0].class).to eq Mail::Part
+ expect(body.parts[1].class).to eq Mail::Part
end
it "should return the first part as its own message" do
multipart_body = "this is some text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/plain; charset=ISO-8859-1\r\n\r\nThis is a plain text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/html\r\n\r\n<p>This is HTML</p>\r\n------=_Part_2192_32400445--\r\n"
body = Mail::Body.new(multipart_body)
body.split!('----=_Part_2192_32400445')
- body.parts[0].content_type.should eq "text/plain; charset=ISO-8859-1"
+ expect(body.parts[0].content_type).to eq "text/plain; charset=ISO-8859-1"
end
it "should return the first part as its own message" do
multipart_body = "this is some text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/plain; charset=ISO-8859-1\r\n\r\nThis is a plain text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/html\r\n\r\n<p>This is HTML</p>\r\n------=_Part_2192_32400445--\r\n"
body = Mail::Body.new(multipart_body)
body.split!('----=_Part_2192_32400445')
- body.parts[1].content_type.should eq "text/html"
+ expect(body.parts[1].content_type).to eq "text/html"
end
it "should separate out its parts" do
multipart_body = "this is some text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/plain; charset=ISO-8859-1\r\n\r\nThis is a plain text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/html\r\n\r\n<p>This is HTML</p>\r\n------=_Part_2192_32400445--\r\n"
body = Mail::Body.new(multipart_body)
body.split!('----=_Part_2192_32400445')
- body.should be_multipart
+ expect(body).to be_multipart
end
it "should keep track of its parts" do
multipart_body = "this is some text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/plain; charset=ISO-8859-1\r\n\r\nThis is a plain text\r\n\r\n------=_Part_2192_32400445\r\nContent-Type: text/html\r\n\r\n<p>This is HTML</p>\r\n------=_Part_2192_32400445--\r\n"
body = Mail::Body.new(multipart_body)
body.split!('----=_Part_2192_32400445')
- body.parts.length.should eq 2
+ expect(body.parts.length).to eq 2
end
it "should round trip its parts" do
@@ -182,11 +182,11 @@
body.epilogue = "And this is the end"
new_body = Mail::Body.new(body.encoded)
new_body.split!('----=_Part_2192_32400445')
- new_body.parts.length.should eq 2
- new_body.parts[0].decoded.should eq "This is a plain text\n"
- new_body.parts[1].decoded.should eq "<p>This is HTML</p>"
- new_body.preamble.should eq "Really! this is some text"
- new_body.epilogue.should eq "And this is the end"
+ expect(new_body.parts.length).to eq 2
+ expect(new_body.parts[0].decoded).to eq "This is a plain text\n"
+ expect(new_body.parts[1].decoded).to eq "<p>This is HTML</p>"
+ expect(new_body.preamble).to eq "Really! this is some text"
+ expect(new_body.epilogue).to eq "And this is the end"
end
it "should allow you to change the boundary" do
@@ -196,54 +196,54 @@
body.boundary = '------=_MIMEPART'
new_body = Mail::Body.new(body.encoded)
new_body.split!('------=_MIMEPART')
- new_body.parts.length.should eq 2
- new_body.preamble.should eq "this is some text"
+ expect(new_body.parts.length).to eq 2
+ expect(new_body.preamble).to eq "this is some text"
end
it "should split if boundary is not set" do
multipart_body = "\n\n--\nDate: Thu, 01 Aug 2013 15:14:20 +0100\nMime-Version: 1.0\nContent-Type: text/plain\nContent-Transfer-Encoding: 7bit\nContent-Disposition: attachment;\n filename=\"\"\nContent-ID: <51fa6d3cac796_d84e3fe5a58349e025683@local.mail>\n\n\n\n----"
body = Mail::Body.new(multipart_body)
- doing { body.split!(nil) }.should_not raise_error
+ expect { body.split!(nil) }.not_to raise_error
end
end
describe "detecting non ascii" do
it "should say an empty string is all ascii" do
body = Mail::Body.new
- body.should be_only_us_ascii
+ expect(body).to be_only_us_ascii
end
it "should say if a body is ascii" do
body = Mail::Body.new('This is ASCII')
- body.should be_only_us_ascii
+ expect(body).to be_only_us_ascii
end
it "should say if a body is not ascii" do
body = Mail::Body.new("This is NOT plain text ASCII − かきくけこ")
- body.should_not be_only_us_ascii
+ expect(body).not_to be_only_us_ascii
end
end
describe "adding parts" do
it "should allow you to add a part" do
body = Mail::Body.new('')
body << Mail::Part.new('')
- body.parts.length.should eq 1
- body.should be_multipart
+ expect(body.parts.length).to eq 1
+ expect(body).to be_multipart
end
it "should allow you to sort the parts" do
body = Mail::Body.new('')
body << Mail::Part.new("content-type: text/html\r\nsubject: HTML")
body << Mail::Part.new("content-type: text/plain\r\nsubject: Plain Text")
body << Mail::Part.new("content-type: text/enriched\r\nsubject: Enriched")
- body.parts.length.should eq 3
- body.should be_multipart
+ expect(body.parts.length).to eq 3
+ expect(body).to be_multipart
body.sort_parts!
- body.parts[0].content_type.should eq "text/plain"
- body.parts[1].content_type.should eq "text/enriched"
- body.parts[2].content_type.should eq "text/html"
+ expect(body.parts[0].content_type).to eq "text/plain"
+ expect(body.parts[1].content_type).to eq "text/enriched"
+ expect(body.parts[2].content_type).to eq "text/html"
end
it "should allow you to sort the parts with an arbitrary sort order" do
@@ -252,12 +252,12 @@
body << Mail::Part.new("content-type: text/html\r\nsubject: HTML")
body << Mail::Part.new("content-type: text/plain\r\nsubject: Plain Text")
body << Mail::Part.new("content-type: text/enriched\r\nsubject: Enriched")
- body.parts.length.should eq 3
- body.should be_multipart
+ expect(body.parts.length).to eq 3
+ expect(body).to be_multipart
body.sort_parts!
- body.parts[0].content_type.should eq "text/plain"
- body.parts[1].content_type.should eq "text/html"
- body.parts[2].content_type.should eq "text/enriched"
+ expect(body.parts[0].content_type).to eq "text/plain"
+ expect(body.parts[1].content_type).to eq "text/html"
+ expect(body.parts[2].content_type).to eq "text/enriched"
end
it "should allow you to sort the parts with an arbitrary sort order" do
@@ -266,38 +266,38 @@
body << Mail::Part.new("content-type: text/plain\r\nsubject: HTML")
body << Mail::Part.new("content-type: text/html\r\nsubject: Plain Text")
body << Mail::Part.new("content-type: application/x-yaml\r\nsubject: Enriched")
- body.parts.length.should eq 3
- body.should be_multipart
+ expect(body.parts.length).to eq 3
+ expect(body).to be_multipart
body.sort_parts!
- body.parts[0].content_type.should eq "application/x-yaml"
- body.parts[1].content_type.should eq "text/plain"
- body.parts[2].content_type.should eq "text/html"
+ expect(body.parts[0].content_type).to eq "application/x-yaml"
+ expect(body.parts[1].content_type).to eq "text/plain"
+ expect(body.parts[2].content_type).to eq "text/html"
end
it "should sort the parts on encode" do
body = Mail::Body.new('')
body << Mail::Part.new("content-type: text/html\r\nsubject: HTML")
body << Mail::Part.new("content-type: text/plain\r\nsubject: Plain Text")
body << Mail::Part.new("content-type: text/enriched\r\nsubject: Enriched")
- body.parts.length.should eq 3
- body.should be_multipart
+ expect(body.parts.length).to eq 3
+ expect(body).to be_multipart
body.encoded
- body.parts[0].content_type.should eq "text/plain"
- body.parts[1].content_type.should eq "text/enriched"
- body.parts[2].content_type.should eq "text/html"
+ expect(body.parts[0].content_type).to eq "text/plain"
+ expect(body.parts[1].content_type).to eq "text/enriched"
+ expect(body.parts[2].content_type).to eq "text/html"
end
it "should put the part types it doesn't know about at the end" do
body = Mail::Body.new('')
body << Mail::Part.new("content-type: text/html\r\nsubject: HTML")
body << Mail::Part.new("content-type: text/plain\r\nsubject: Plain Text")
body << Mail::Part.new("content-type: image/jpeg\r\n")
- body.parts.length.should eq 3
- body.should be_multipart
+ expect(body.parts.length).to eq 3
+ expect(body).to be_multipart
body.encoded
- body.parts[0].content_type.should eq "text/plain"
- body.parts[1].content_type.should eq "text/html"
- body.parts[2].content_type.should eq "image/jpeg"
+ expect(body.parts[0].content_type).to eq "text/plain"
+ expect(body.parts[1].content_type).to eq "text/html"
+ expect(body.parts[2].content_type).to eq "image/jpeg"
end
it "should allow you to sort the parts recursively" do
@@ -308,14 +308,14 @@
body = Mail::Body.new('')
body << part
body << Mail::Part.new("content-type: image/jpeg\r\nsubject: JPGEG\r\n\r\nsdkjskjdksjdkjsd")
- body.parts.length.should eq 2
- body.should be_multipart
+ expect(body.parts.length).to eq 2
+ expect(body).to be_multipart
body.sort_parts!
- body.parts[0].content_type.should match %r{\Amultipart/alternate(;|\Z)}
- body.parts[1].content_type.should eq "image/jpeg"
- body.parts[0].parts[0].content_type.should eq "text/plain"
- body.parts[0].parts[1].content_type.should eq "text/enriched"
- body.parts[0].parts[2].content_type.should eq "text/html"
+ expect(body.parts[0].content_type).to match %r{\Amultipart/alternate(;|\Z)}
+ expect(body.parts[1].content_type).to eq "image/jpeg"
+ expect(body.parts[0].parts[0].content_type).to eq "text/plain"
+ expect(body.parts[0].parts[1].content_type).to eq "text/enriched"
+ expect(body.parts[0].parts[2].content_type).to eq "text/html"
end
it "should allow you to sort the parts recursively" do
@@ -326,14 +326,14 @@
body = Mail::Body.new('')
body << part
body << Mail::Part.new("content-type: image/jpeg\r\nsubject: JPGEG\r\n\r\nsdkjskjdksjdkjsd")
- body.parts.length.should eq 2
- body.should be_multipart
+ expect(body.parts.length).to eq 2
+ expect(body).to be_multipart
body.sort_parts!
- body.parts[0].content_type.should match %r{\Amultipart/alternate(;|\Z)}
- body.parts[1].content_type.should eq "image/jpeg"
- body.parts[0].parts[0].content_type.should eq "text/plain"
- body.parts[0].parts[1].content_type.should eq "text/enriched"
- body.parts[0].parts[2].content_type.should eq "text/html"
+ expect(body.parts[0].content_type).to match %r{\Amultipart/alternate(;|\Z)}
+ expect(body.parts[1].content_type).to eq "image/jpeg"
+ expect(body.parts[0].parts[0].content_type).to eq "text/plain"
+ expect(body.parts[0].parts[1].content_type).to eq "text/enriched"
+ expect(body.parts[0].parts[2].content_type).to eq "text/html"
end
it "should maintain the relative order of the parts with the same content-type as they are added" do
@@ -346,69 +346,69 @@
body << Mail::Part.new("content-type: text/plain\r\nsubject: Plain Text_2")
body << Mail::Part.new("content-type: image/jpeg\r\nsubject: JPGEG_2\r\n\r\nsdkjskjdksjdkjsd")
body << Mail::Part.new("content-type: text/enriched\r\nsubject: Enriched_2")
- body.parts.length.should eq 8
- body.should be_multipart
+ expect(body.parts.length).to eq 8
+ expect(body).to be_multipart
body.sort_parts!
- body.parts[0].subject.should eq "Plain Text_1"
- body.parts[1].subject.should eq "Plain Text_2"
- body.parts[2].subject.should eq "Enriched_1"
- body.parts[3].subject.should eq "Enriched_2"
- body.parts[4].subject.should eq "HTML_1"
- body.parts[5].subject.should eq "HTML_2"
- body.parts[6].subject.should eq "JPGEG_1"
- body.parts[7].subject.should eq "JPGEG_2"
+ expect(body.parts[0].subject).to eq "Plain Text_1"
+ expect(body.parts[1].subject).to eq "Plain Text_2"
+ expect(body.parts[2].subject).to eq "Enriched_1"
+ expect(body.parts[3].subject).to eq "Enriched_2"
+ expect(body.parts[4].subject).to eq "HTML_1"
+ expect(body.parts[5].subject).to eq "HTML_2"
+ expect(body.parts[6].subject).to eq "JPGEG_1"
+ expect(body.parts[7].subject).to eq "JPGEG_2"
end
end
describe "matching" do
it "should still equal itself" do
body = Mail::Body.new('The body')
- body.should eq body
+ expect(body).to eq body
end
it "should match on the body part decoded if given a string to ==" do
body = Mail::Body.new('The body')
- (body == 'The body').should be_true
+ expect(body == 'The body').to be_truthy
end
it "should match on the body part decoded if given a string to ==" do
body = Mail::Body.new("VGhlIGJvZHk=\n")
body.encoding = 'base64'
- (body == "The body").should be_true
+ expect(body == "The body").to be_truthy
end
it "should match on the body part decoded if given a string to =~" do
body = Mail::Body.new('The body')
- (body =~ /The/).should eq 0
+ expect(body =~ /The/).to eq 0
end
it "should match on the body part decoded if given a string to ==" do
body = Mail::Body.new("VGhlIGJvZHk=\n")
body.encoding = 'base64'
- (body =~ /The/).should eq 0
+ expect(body =~ /The/).to eq 0
end
it "should match on the body part decoded if given a string to match" do
body = Mail::Body.new('The body')
- (body.match(/The/))[0].should eq 'The'
+ expect((body.match(/The/))[0]).to eq 'The'
end
it "should match on the body part decoded if given a string to match" do
body = Mail::Body.new("VGhlIGJvZHk=\n")
body.encoding = 'base64'
- (body.match(/The/))[0].should eq 'The'
+ expect((body.match(/The/))[0]).to eq 'The'
end
it "should match on the body part decoded if given a string to include?" do
body = Mail::Body.new('The Body')
- body.should include('The')
+ expect(body).to include('The')
end
it "should match on the body part decoded if given a string to include?" do
body = Mail::Body.new("VGhlIGJvZHk=\n")
body.encoding = 'base64'
- body.should include('The')
+ expect(body).to include('The')
end
end
@@ -417,7 +417,7 @@
body = Mail::Body.new("あいうえお\n")
body.charset = 'iso-2022-jp'
expect = (RUBY_VERSION < '1.9') ? "あいうえお\r\n" : "\e$B$\"$$$&$($*\e(B\r\n"
- body.encoded.should eq expect
+ expect(body.encoded).to eq expect
end
end
end
View
26 spec/mail/configuration_spec.rb
@@ -17,44 +17,44 @@ def initialize(values)
# will not clear it.
Mail::Configuration.instance.send(:initialize)
Mail.defaults { delivery_method nil, { :address => 'some.host' } }
- Mail.delivery_method.settings[:address].should eq 'some.host'
+ expect(Mail.delivery_method.settings[:address]).to eq 'some.host'
end
it "should be available from the Mail.defaults method" do
Mail.defaults { delivery_method :smtp, { :address => 'some.host' } }
- Mail.delivery_method.settings[:address].should eq 'some.host'
+ expect(Mail.delivery_method.settings[:address]).to eq 'some.host'
end
it "should configure sendmail" do
Mail.defaults { delivery_method :sendmail, :location => "/usr/bin/sendmail" }
- Mail.delivery_method.class.should eq Mail::Sendmail
- Mail.delivery_method.settings[:location].should eq "/usr/bin/sendmail"
+ expect(Mail.delivery_method.class).to eq Mail::Sendmail
+ expect(Mail.delivery_method.settings[:location]).to eq "/usr/bin/sendmail"
end
it "should configure sendmail using a string" do
Mail.defaults { delivery_method 'sendmail', :location => "/usr/bin/sendmail" }
- Mail.delivery_method.class.should eq Mail::Sendmail
- Mail.delivery_method.settings[:location].should eq "/usr/bin/sendmail"
+ expect(Mail.delivery_method.class).to eq Mail::Sendmail
+ expect(Mail.delivery_method.settings[:location]).to eq "/usr/bin/sendmail"
end
it "should configure exim" do
Mail.defaults { delivery_method :exim, :location => "/usr/bin/exim" }
- Mail.delivery_method.class.should eq Mail::Exim
- Mail.delivery_method.settings[:location].should eq "/usr/bin/exim"
+ expect(Mail.delivery_method.class).to eq Mail::Exim
+ expect(Mail.delivery_method.settings[:location]).to eq "/usr/bin/exim"
end
it "should configure an open SMTP connection" do
smtp = Net::SMTP.start('127.0.0.1', 25)
Mail.defaults { delivery_method :smtp_connection, {:connection => smtp} }
- Mail.delivery_method.class.should eq Mail::SMTPConnection
- Mail.delivery_method.smtp.should eq smtp
+ expect(Mail.delivery_method.class).to eq Mail::SMTPConnection
+ expect(Mail.delivery_method.smtp).to eq smtp
end
it "should accept a plug-in delivery method" do
Mail.defaults { delivery_method MyTestDeliveryMethod, { :option1 => "one", :option2 => "two" }}
- Mail.delivery_method.class.should eq MyTestDeliveryMethod
- Mail.delivery_method.settings[:option1].should eq "one"
- Mail.delivery_method.settings[:option2].should eq "two"
+ expect(Mail.delivery_method.class).to eq MyTestDeliveryMethod
+ expect(Mail.delivery_method.settings[:option1]).to eq "one"
+ expect(Mail.delivery_method.settings[:option2]).to eq "two"
end
end
View
28 spec/mail/core_extensions/string_spec.rb
@@ -6,63 +6,63 @@
describe "to_crlf" do
it "should change a single LF to CRLF" do
- "\n".to_crlf.should eq "\r\n"
+ expect("\n".to_crlf).to eq "\r\n"
end
it "should change multiple LF to CRLF" do
- "\n\n".to_crlf.should eq "\r\n\r\n"
+ expect("\n\n".to_crlf).to eq "\r\n\r\n"
end
it "should change a single CR to CRLF" do
- "\r".to_crlf.should eq "\r\n"
+ expect("\r".to_crlf).to eq "\r\n"
end
it "should not change CRLF" do
- "\r\n".to_crlf.should eq "\r\n"
+ expect("\r\n".to_crlf).to eq "\r\n"
end
it "should not change multiple CRLF" do
- "\r\n\r\n".to_crlf.should eq "\r\n\r\n"
+ expect("\r\n\r\n".to_crlf).to eq "\r\n\r\n"
end
it "should handle a mix" do
- "\r \n\r\n".to_crlf.should eq "\r\n \r\n\r\n"
+ expect("\r \n\r\n".to_crlf).to eq "\r\n \r\n\r\n"
end
end
describe "to_lf" do
it "should change a single CR to LF" do
- "\r".to_lf.should eq "\n"
+ expect("\r".to_lf).to eq "\n"
end
it "should change multiple LF to CRLF" do
- "\r\r".to_lf.should eq "\n\n"
+ expect("\r\r".to_lf).to eq "\n\n"
end
it "should change a single CRLF to LF" do
- "\r\n".to_lf.should eq "\n"
+ expect("\r\n".to_lf).to eq "\n"
end
it "should change multiple CR to LF" do
- "\r\n\r\n".to_lf.should eq "\n\n"
+ expect("\r\n\r\n".to_lf).to eq "\n\n"
end
it "should not change LF" do
- "\n".to_lf.should eq "\n"
+ expect("\n".to_lf).to eq "\n"
end
it "should not change multiple CRLF" do
- "\n\n".to_lf.should eq "\n\n"
+ expect("\n\n".to_lf).to eq "\n\n"
end
it "should handle a mix" do
- "\r \n\r\n".to_lf.should eq "\n \n\n"
+ expect("\r \n\r\n".to_lf).to eq "\n \n\n"
end
end
describe 'constantize' do
it 'should converts string to constant' do
- "Kernel".constantize.should eq Kernel
+ expect("Kernel".constantize).to eq Kernel
end
end
View
44 spec/mail/core_extensions_spec.rb
@@ -5,94 +5,94 @@
describe "blank method" do
it "should say nil is blank" do
- nil.should be_blank
+ expect(nil).to be_blank
end
it "should say false is blank" do
- false.should be_blank
+ expect(false).to be_blank
end
it "should say true is not blank" do
- true.should_not be_blank
+ expect(true).not_to be_blank
end
it "should say an empty array is blank" do
- [].should be_blank
+ expect([]).to be_blank
end
it "should say an empty hash is blank" do
- {}.should be_blank
+ expect({}).to be_blank
end
it "should say an empty string is blank" do
- ''.should be_blank
- " ".should be_blank
+ expect('').to be_blank
+ expect(" ").to be_blank
a = ''; 1000.times { a << ' ' }
- a.should be_blank
- "\t \n\n".should be_blank
+ expect(a).to be_blank
+ expect("\t \n\n").to be_blank
end
end
describe "not blank method" do
it "should say a number is not blank" do
- 1.should_not be_blank
+ expect(1).not_to be_blank
end
it "should say a valueless hash is not blank" do
- {:one => nil, :two => nil}.should_not be_blank
+ expect({:one => nil, :two => nil}).not_to be_blank
end
it "should say a hash containing an empty hash is not blank" do
- {:key => {}}.should_not be_blank
+ expect({:key => {}}).not_to be_blank
end
end
describe "to_lf method on String" do
it "should leave lf as lf" do
- "\n".to_lf.should eq "\n"
+ expect("\n".to_lf).to eq "\n"
end
it "should clean just cr to lf" do
- "\r".to_lf.should eq "\n"
+ expect("\r".to_lf).to eq "\n"
end
it "should leave crlf as lf" do
- "\r\n".to_lf.should eq "\n"
+ expect("\r\n".to_lf).to eq "\n"
end
it "should handle japanese characters" do
string = "\343\201\202\343\201\210\343\201\206\343\201\210\343\201\212\r\n\r\n\343\201\213\343\201\215\343\201\217\343\201\221\343\201\223\r\n\r\n\343\201\225\343\201\227\343\201\244\343\201\233\343\201\235\r\n\r\n"
- string.to_lf.should eq "\343\201\202\343\201\210\343\201\206\343\201\210\343\201\212\n\n\343\201\213\343\201\215\343\201\217\343\201\221\343\201\223\n\n\343\201\225\343\201\227\343\201\244\343\201\233\343\201\235\n\n"
+ expect(string.to_lf).to eq "\343\201\202\343\201\210\343\201\206\343\201\210\343\201\212\n\n\343\201\213\343\201\215\343\201\217\343\201\221\343\201\223\n\n\343\201\225\343\201\227\343\201\244\343\201\233\343\201\235\n\n"
end
end
describe "to_crlf method on String" do
it "should clean just lf to crlf" do
- "\n".to_crlf.should eq "\r\n"
+ expect("\n".to_crlf).to eq "\r\n"
end
it "should clean just cr to crlf" do
- "\r".to_crlf.should eq "\r\n"
+ expect("\r".to_crlf).to eq "\r\n"
end
it "should leave crlf as crlf" do
- "\r\n".to_crlf.should eq "\r\n"
+ expect("\r\n".to_crlf).to eq "\r\n"
end
it "should handle japanese characters" do
string = "\343\201\202\343\201\210\343\201\206\343\201\210\343\201\212\r\n\r\n\343\201\213\343\201\215\343\201\217\343\201\221\343\201\223\r\n\r\n\343\201\225\343\201\227\343\201\244\343\201\233\343\201\235\r\n\r\n"
- string.to_crlf.should eq "\343\201\202\343\201\210\343\201\206\343\201\210\343\201\212\r\n\r\n\343\201\213\343\201\215\343\201\217\343\201\221\343\201\223\r\n\r\n\343\201\225\343\201\227\343\201\244\343\201\233\343\201\235\r\n\r\n"
+ expect(string.to_crlf).to eq "\343\201\202\343\201\210\343\201\206\343\201\210\343\201\212\r\n\r\n\343\201\213\343\201\215\343\201\217\343\201\221\343\201\223\r\n\r\n\343\201\225\343\201\227\343\201\244\343\201\233\343\201\235\r\n\r\n"
end
end
describe "methods on NilClass" do
it "should return empty string on to_crlf" do
- nil.to_crlf.should eq ''
+ expect(nil.to_crlf).to eq ''
end
it "should return empty string on to_lf" do
- nil.to_lf.should eq ''
+ expect(nil.to_lf).to eq ''
end
end
View
42 spec/mail/elements/address_list_spec.rb
@@ -6,118 +6,118 @@
describe "parsing" do
it "should parse an address list" do
parse_text = 'test@lindsaar.net'
- doing { Mail::AddressList.new(parse_text) }.should_not raise_error
+ expect { Mail::AddressList.new(parse_text) }.not_to raise_error
end
it "should raise an error if the input is useless" do
parse_text = '@@@@@@'
- doing { Mail::AddressList.new(parse_text) }.should raise_error
+ expect { Mail::AddressList.new(parse_text) }.to raise_error
end
it "should not raise an error if the input is just blank" do
parse_text = nil
- doing { Mail::AddressList.new(parse_text) }.should_not raise_error
+ expect { Mail::AddressList.new(parse_text) }.not_to raise_error
end
it "should raise an error if the input is useless" do
parse_text = "This ( is an invalid address!"
- doing { Mail::AddressList.new(parse_text) }.should raise_error
+ expect { Mail::AddressList.new(parse_text) }.to raise_error
end
it "should give the address passed in" do
parse_text = 'test@lindsaar.net'
result = 'test@lindsaar.net'
a = Mail::AddressList.new(parse_text)
- a.addresses.first.to_s.should eq result
+ expect(a.addresses.first.to_s).to eq result
end
it "should give the addresses passed in" do
parse_text = 'test@lindsaar.net, test2@lindsaar.net'
result = ['test@lindsaar.net', 'test2@lindsaar.net']
a = Mail::AddressList.new(parse_text)
- a.addresses.map {|addr| addr.to_s }.should eq result
+ expect(a.addresses.map {|addr| addr.to_s }).to eq result
end
it "should preserve the display name" do
parse_text = '"Mikel Lindsaar" <mikel@test.lindsaar.net>'
result = 'Mikel Lindsaar <mikel@test.lindsaar.net>'
a = Mail::AddressList.new(parse_text)
- a.addresses.first.format.should eq result
- a.addresses.first.display_name.should eq 'Mikel Lindsaar'
+ expect(a.addresses.first.format).to eq result
+ expect(a.addresses.first.display_name).to eq 'Mikel Lindsaar'
end
it "should handle and ignore nil addresses" do
parse_text = ' , user-example@aol.com, e-s-a-s-2200@app.ar.com'
result = ['user-example@aol.com', 'e-s-a-s-2200@app.ar.com']
a = Mail::AddressList.new(parse_text)
- a.addresses.map {|addr| addr.to_s }.should eq result
+ expect(a.addresses.map {|addr| addr.to_s }).to eq result
end
it "should handle truly horrific combinations of commas, spaces, and addresses" do
parse_text = ' ,, foo@example.com, , ,,, bar@example.com ,,'
result = ['foo@example.com', 'bar@example.com']
a = Mail::AddressList.new(parse_text)
- a.addresses.map {|addr| addr.to_s }.should eq result
+ expect(a.addresses.map {|addr| addr.to_s }).to eq result
end
it "should handle folding whitespace" do
parse_text = "foo@example.com,\r\n\tbar@example.com"
result = ['foo@example.com', 'bar@example.com']
a = Mail::AddressList.new(parse_text)
- a.addresses.map {|addr| addr.to_s }.should eq result
+ expect(a.addresses.map {|addr| addr.to_s }).to eq result
end
it "should handle malformed folding whitespace" do
- pending
+ skip
parse_text = "leads@sg.dc.com,\n\t sag@leads.gs.ry.com,\n\t sn@example-hotmail.com,\n\t e-s-a-g-8718@app.ar.com,\n\t jp@t-exmaple.com,\n\t\n\t cc@c-l-example.com"
result = %w(leads@sg.dc.com sag@leads.gs.ry.com sn@example-hotmail.com e-s-a-g-8718@app.ar.com jp@t-exmaple.com cc@c-l-example.com)
a = Mail::AddressList.new(parse_text)
- a.addresses.map {|addr| addr.to_s }.should eq result
+ expect(a.addresses.map {|addr| addr.to_s }).to eq result
end
it "should extract comments in addreses which are part of a group" do
parse_text = "group: jimmy <jimmy@(comment)example.com>;";
result = ["comment"]
a = Mail::AddressList.new(parse_text)
- a.addresses.first.comments.should eq result
+ expect(a.addresses.first.comments).to eq result
end
end
describe "functionality" do
it "should give all the groups when asked" do
list = Mail::AddressList.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
- list.addresses_grouped_by_group.length.should eq 1
+ expect(list.addresses_grouped_by_group.length).to eq 1
end
it "should ask the group for all its addresses" do
list = Mail::AddressList.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
- list.addresses_grouped_by_group.values.first.length.should eq 2
+ expect(list.addresses_grouped_by_group.values.first.length).to eq 2
end
it "should give all the addresses when asked" do
list = Mail::AddressList.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
- list.addresses.length.should eq 3
+ expect(list.addresses.length).to eq 3
end
it "should handle a really nasty obsolete address list" do
- pending
+ skip
psycho_obsolete = "Mary Smith <@machine.tld:mary@example.net>, , jdoe@test . example"
list = Mail::AddressList.new(psycho_obsolete)
- list.addresses.length.should eq 2
+ expect(list.addresses.length).to eq 2
end
it "should create an address instance for each address returned" do
list = Mail::AddressList.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
list.addresses.each do |address|
- address.class.should eq Mail::Address
+ expect(address.class).to eq Mail::Address
end
end
it "should provide a list of group names" do
list = Mail::AddressList.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
- list.group_names.should eq ["my_group"]
+ expect(list.group_names).to eq ["my_group"]
end
end
View
140 spec/mail/elements/address_spec.rb
@@ -6,141 +6,141 @@
describe "functionality" do
it "should allow us to instantiate an empty address object and call inspect" do
- doing {
+ expect {
Mail::Address.new.inspect
- }.should_not raise_error
+ }.not_to raise_error
end
it "should allow us to instantiate an empty address object and call to_s" do
- Mail::Address.new.to_s.should eq ''
+ expect(Mail::Address.new.to_s).to eq ''
end
it "should allow us to instantiate an empty address object and call format" do
- Mail::Address.new.format.should eq ''
+ expect(Mail::Address.new.format).to eq ''
end
it "should allow us to instantiate an empty address object and call address" do
[nil, '', ' '].each do |input|
- Mail::Address.new(input).address.should eq nil
+ expect(Mail::Address.new(input).address).to eq nil
end
end
it "should allow us to instantiate an empty address object and call local" do
[nil, '', ' '].each do |input|
- Mail::Address.new(input).local.should eq nil
+ expect(Mail::Address.new(input).local).to eq nil
end
end
it "should allow us to instantiate an empty address object and call domain" do
[nil, '', ' '].each do |input|
- Mail::Address.new(input).domain.should eq nil
+ expect(Mail::Address.new(input).domain).to eq nil
end
end
['"-Earnings...Notification-" <vodacom.co.rs>', '<56253817>'].each do |spammy_address|
it "should ignore funky local-only spammy addresses in angle brackets #{spammy_address}" do
- Mail::Address.new(spammy_address).address.should eq nil
+ expect(Mail::Address.new(spammy_address).address).to eq nil
end
end
it "should give its address back on :to_s if there is no display name" do
parse_text = 'test@lindsaar.net'
result = 'test@lindsaar.net'
- Mail::Address.new(parse_text).to_s.should eq result
+ expect(Mail::Address.new(parse_text).to_s).to eq result
end
it "should give its format back on :to_s if there is a display name" do
parse_text = 'Mikel Lindsaar <test@lindsaar.net>'
result = 'Mikel Lindsaar <test@lindsaar.net>'
- Mail::Address.new(parse_text).to_s.should eq result
+ expect(Mail::Address.new(parse_text).to_s).to eq result
end
it "should give back the display name" do
parse_text = 'Mikel Lindsaar <test@lindsaar.net>'
result = 'Mikel Lindsaar'
a = Mail::Address.new(parse_text)
- a.display_name.should eq result
+ expect(a.display_name).to eq result
end
it "should preserve the display name passed in" do
parse_text = '"Mikel Lindsaar" <mikel@test.lindsaar.net>'
result = 'Mikel Lindsaar'
a = Mail::Address.new(parse_text)
- a.display_name.should eq result
+ expect(a.display_name).to eq result
end
it "should preserve the display name passed in with token unsafe chars" do
parse_text = '"Mikel@@@Lindsaar" <mikel@test.lindsaar.net>'
result = 'Mikel@@@Lindsaar'
a = Mail::Address.new(parse_text)
- a.display_name.should eq result
+ expect(a.display_name).to eq result
end
it "should decode the display name without calling #decoded first" do
encoded = '=?ISO-8859-1?Q?Jan_Kr=FCtisch?= <jan@krutisch.de>'
- Mail::Address.new(encoded).display_name.should eq 'Jan Krütisch'
+ expect(Mail::Address.new(encoded).display_name).to eq 'Jan Krütisch'
end
it "should give back the local part" do
parse_text = 'Mikel Lindsaar <test@lindsaar.net>'
result = 'test'
a = Mail::Address.new(parse_text)
- a.local.should eq result
+ expect(a.local).to eq result
end
it "should give back the domain" do
parse_text = 'Mikel Lindsaar <test@lindsaar.net>'
result = 'lindsaar.net'
a = Mail::Address.new(parse_text)
- a.domain.should eq result
+ expect(a.domain).to eq result
end
it "should give back the formated address" do
parse_text = 'Mikel Lindsaar <test@lindsaar.net>'
result = 'Mikel Lindsaar <test@lindsaar.net>'
a = Mail::Address.new(parse_text)
- a.format.should eq result
+ expect(a.format).to eq result
end
it "should handle an address without a domain" do
parse_text = 'test'
result = 'test'
a = Mail::Address.new(parse_text)
- a.address.should eq result
+ expect(a.address).to eq result
end
it "should handle comments" do
parse_text = "Mikel Lindsaar (author) <test@lindsaar.net>"
result = ['author']
a = Mail::Address.new(parse_text)
- a.comments.should eq result
+ expect(a.comments).to eq result
end
it "should handle multiple comments" do
parse_text = "Mikel (first name) Lindsaar (author) <test@lindsaar.net>"
result = ['first name', 'author']
a = Mail::Address.new(parse_text)
- a.comments.should eq result
+ expect(a.comments).to eq result
end
it "should handle nested comments" do
parse_text = "bob@example.com (hello (nested) yeah)"
result = ["hello \(nested\) yeah"]
a = Mail::Address.new(parse_text)
- a.comments.should eq result
+ expect(a.comments).to eq result
end
it "should give back the raw value" do
parse_text = "Mikel (first name) Lindsaar (author) <test@lindsaar.net>"
result = "Mikel (first name) Lindsaar (author) <test@lindsaar.net>"
a = Mail::Address.new(parse_text)
- a.raw.should eq result
+ expect(a.raw).to eq result
end
it "should format junk addresses as raw text" do
junk = '<"somename@gmail.com">'
- Mail::Address.new(junk).format.should eq junk
+ expect(Mail::Address.new(junk).format).to eq junk
end
end
@@ -149,27 +149,27 @@
it "should allow you to assign an address" do
a = Mail::Address.new
a.address = 'mikel@test.lindsaar.net'
- a.address.should eq 'mikel@test.lindsaar.net'
- a.format.should eq 'mikel@test.lindsaar.net'
+ expect(a.address).to eq 'mikel@test.lindsaar.net'
+ expect(a.format).to eq 'mikel@test.lindsaar.net'
end
it "should allow you to assign a display name" do
a = Mail::Address.new
a.display_name = 'Mikel Lindsaar'
- a.display_name.should eq 'Mikel Lindsaar'
+ expect(a.display_name).to eq 'Mikel Lindsaar'
end
it "should return an empty format a display name and no address defined" do
a = Mail::Address.new
a.display_name = 'Mikel Lindsaar'
- a.format.should eq ''
+ expect(a.format).to eq ''
end
it "should allow you to assign an address and a display name" do
a = Mail::Address.new
a.address = 'mikel@test.lindsaar.net'
a.display_name = 'Mikel Lindsaar'
- a.format.should eq 'Mikel Lindsaar <mikel@test.lindsaar.net>'
+ expect(a.format).to eq 'Mikel Lindsaar <mikel@test.lindsaar.net>'
end
end
@@ -184,7 +184,7 @@
].each do |(words, ok)|
a = Mail::Address.new(words)
- a.local.should eq ok
+ expect(a.local).to eq ok
end
end
@@ -197,15 +197,15 @@
].each do |(words, ok)|
a = Mail::Address.new(%Q|me@#{words}|)
- a.domain.should eq ok
+ expect(a.domain).to eq ok
end
end
end
describe "email addresses from the wild" do
it "should handle |aamine@loveruby.net|" do
address = Mail::Address.new('aamine@loveruby.net')
- address.should break_down_to({
+ expect(address).to break_down_to({
:display_name => nil,
:address => 'aamine@loveruby.net',
:local => 'aamine',
@@ -217,7 +217,7 @@
it "should handle |Minero Aoki <aamine@loveruby.net>|" do
address = Mail::Address.new('Minero Aoki <aamine@loveruby.net>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:display_name => 'Minero Aoki',
:address => 'aamine@loveruby.net',
:local => 'aamine',
@@ -229,7 +229,7 @@
it "should handle |Minero Aoki<aamine@loveruby.net>|" do
address = Mail::Address.new('Minero Aoki<aamine@loveruby.net>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:display_name => 'Minero Aoki',
:address => 'aamine@loveruby.net',
:local => 'aamine',
@@ -241,7 +241,7 @@
it 'should handle |"Minero Aoki" <aamine@loveruby.net>|' do
address = Mail::Address.new('"Minero Aoki" <aamine@loveruby.net>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:display_name => 'Minero Aoki',
:address => 'aamine@loveruby.net',
:local => 'aamine',
@@ -253,7 +253,7 @@
it "should handle |Minero Aoki<aamine@0246.loveruby.net>|" do
address = Mail::Address.new('Minero Aoki<aamine@0246.loveruby.net>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:display_name => 'Minero Aoki',
:address => 'aamine@0246.loveruby.net',
:local => 'aamine',
@@ -267,7 +267,7 @@
1.upto(10) do |times|
dots = "." * times
address = Mail::Address.new("hoge#{dots}test@docomo.ne.jp")
- address.should break_down_to({
+ expect(address).to break_down_to({
:display_name => nil,
:address => "hoge#{dots}test@docomo.ne.jp",
:local => "hoge#{dots}test",
@@ -282,7 +282,7 @@
1.upto(10) do |times|
dots = "." * times
address = Mail::Address.new("hogetest#{dots}@docomo.ne.jp")
- address.should break_down_to({
+ expect(address).to break_down_to({
:display_name => nil,
:address => "hogetest#{dots}@docomo.ne.jp",
:local => "hogetest#{dots}",
@@ -295,7 +295,7 @@
it 'should handle |"Joe & J. Harvey" <ddd @Org>|' do
address = Mail::Address.new('"Joe & J. Harvey" <ddd @Org>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'Joe & J. Harvey',
:display_name => 'Joe & J. Harvey',
:address => 'ddd@Org',
@@ -308,7 +308,7 @@
it 'should handle |"spickett@tiac.net" <Sean.Pickett@zork.tiac.net>|' do
address = Mail::Address.new('"spickett@tiac.net" <Sean.Pickett@zork.tiac.net>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'spickett@tiac.net',
:display_name => 'spickett@tiac.net',
:address => 'Sean.Pickett@zork.tiac.net',
@@ -321,7 +321,7 @@
it "should handle |rls@intgp8.ih.att.com (-Schieve,R.L.)|" do
address = Mail::Address.new('rls@intgp8.ih.att.com (-Schieve,R.L.)')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => '-Schieve,R.L.',
:display_name => nil,
:address => 'rls@intgp8.ih.att.com',
@@ -334,7 +334,7 @@
it "should handle |jrh%cup.portal.com@portal.unix.portal.com|" do
address = Mail::Address.new('jrh%cup.portal.com@portal.unix.portal.com')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => nil,
:display_name => nil,
:address => 'jrh%cup.portal.com@portal.unix.portal.com',
@@ -347,7 +347,7 @@
it "should handle |astrachan@austlcm.sps.mot.com ('paul astrachan/xvt3')|" do
address = Mail::Address.new("astrachan@austlcm.sps.mot.com ('paul astrachan/xvt3')")
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => "'paul astrachan/xvt3'",
:display_name => nil,
:address => 'astrachan@austlcm.sps.mot.com',
@@ -360,7 +360,7 @@
it "should handle 'TWINE57%SDELVB.decnet@SNYBUF.CS.SNYBUF.EDU (JAMES R. TWINE - THE NERD)'" do
address = Mail::Address.new('TWINE57%SDELVB.decnet@SNYBUF.CS.SNYBUF.EDU (JAMES R. TWINE - THE NERD)')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'JAMES R. TWINE - THE NERD',
:display_name => nil,
:address => 'TWINE57%SDELVB.decnet@SNYBUF.CS.SNYBUF.EDU',
@@ -373,7 +373,7 @@
it "should be able to handle 'David Apfelbaum <da0g+@andrew.cmu.edu>'" do
address = Mail::Address.new('David Apfelbaum <da0g+@andrew.cmu.edu>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'David Apfelbaum',
:display_name => 'David Apfelbaum',
:address => 'da0g+@andrew.cmu.edu',
@@ -386,7 +386,7 @@
it 'should handle |"JAMES R. TWINE - THE NERD" <TWINE57%SDELVB%SNYDELVA.bitnet@CUNYVM.CUNY.EDU>|' do
address = Mail::Address.new('"JAMES R. TWINE - THE NERD" <TWINE57%SDELVB%SNYDELVA.bitnet@CUNYVM.CUNY.EDU>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'JAMES R. TWINE - THE NERD',
:display_name => 'JAMES R. TWINE - THE NERD',
:address => 'TWINE57%SDELVB%SNYDELVA.bitnet@CUNYVM.CUNY.EDU',
@@ -399,7 +399,7 @@
it "should handle '/G=Owen/S=Smith/O=SJ-Research/ADMD=INTERSPAN/C=GB/@mhs-relay.ac.uk'" do
address = Mail::Address.new('/G=Owen/S=Smith/O=SJ-Research/ADMD=INTERSPAN/C=GB/@mhs-relay.ac.uk')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => nil,
:display_name => nil,
:address => '/G=Owen/S=Smith/O=SJ-Research/ADMD=INTERSPAN/C=GB/@mhs-relay.ac.uk',
@@ -412,7 +412,7 @@
it 'should handle |"Stephen Burke, Liverpool" <BURKE@vxdsya.desy.de>|' do
address = Mail::Address.new('"Stephen Burke, Liverpool" <BURKE@vxdsya.desy.de>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'Stephen Burke, Liverpool',
:display_name => 'Stephen Burke, Liverpool',
:address => 'BURKE@vxdsya.desy.de',
@@ -425,7 +425,7 @@
it "should handle 'The Newcastle Info-Server <info-admin@newcastle.ac.uk>'" do
address = Mail::Address.new('The Newcastle Info-Server <info-admin@newcastle.ac.uk>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'The Newcastle Info-Server',
:display_name => 'The Newcastle Info-Server',
:address => 'info-admin@newcastle.ac.uk',
@@ -438,7 +438,7 @@
it "should handle 'Suba.Peddada@eng.sun.com (Suba Peddada [CONTRACTOR])'" do
address = Mail::Address.new('Suba.Peddada@eng.sun.com (Suba Peddada [CONTRACTOR])')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'Suba Peddada [CONTRACTOR]',
:display_name => nil,
:address => 'Suba.Peddada@eng.sun.com',
@@ -451,7 +451,7 @@
it "should handle 'Paul Manser (0032 memo) <a906187@tiuk.ti.com>'" do
address = Mail::Address.new('Paul Manser (0032 memo) <a906187@tiuk.ti.com>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'Paul Manser',
:display_name => 'Paul Manser',
:address => 'a906187@tiuk.ti.com',
@@ -464,7 +464,7 @@
it 'should handle |"gregg (g.) woodcock" <woodcock@bnr.ca>|' do
address = Mail::Address.new('"gregg (g.) woodcock" <woodcock@bnr.ca>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'gregg (g.) woodcock',
:display_name => 'gregg (g.) woodcock',
:address => 'woodcock@bnr.ca',
@@ -477,7 +477,7 @@
it 'should handle |Graham.Barr@tiuk.ti.com|' do
address = Mail::Address.new('Graham.Barr@tiuk.ti.com')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => nil,
:display_name => nil,
:address => 'Graham.Barr@tiuk.ti.com',
@@ -490,7 +490,7 @@
it "should handle |a909937 (Graham Barr (0004 bodg))|" do
address = Mail::Address.new('a909937 (Graham Barr (0004 bodg))')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'Graham Barr (0004 bodg)',
:display_name => nil,
:address => 'a909937',
@@ -503,7 +503,7 @@
it "should handle |david d `zoo' zuhn <zoo@aggregate.com>|" do
address = Mail::Address.new("david d `zoo' zuhn <zoo@aggregate.com>")
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => "david d `zoo' zuhn",
:display_name => "david d `zoo' zuhn",
:address => 'zoo@aggregate.com',
@@ -516,7 +516,7 @@
it "should handle |(foo@bar.com (foobar), ned@foo.com (nedfoo) ) <kevin@goess.org>|" do
address = Mail::Address.new('(foo@bar.com (foobar), ned@foo.com (nedfoo) ) <kevin@goess.org>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'foo@bar.com \(foobar\), ned@foo.com \(nedfoo\) ',
:display_name => '(foo@bar.com \(foobar\), ned@foo.com \(nedfoo\) )',
:address => 'kevin@goess.org',
@@ -529,7 +529,7 @@
it "should handle |Pete(A wonderful ) chap) <pete(his account)@silly.test(his host)>|" do
address = Mail::Address.new('Pete(A wonderful \) chap) <pete(his account)@silly.test(his host)>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'Pete',
:display_name => 'Pete',
:address => 'pete(his account)@silly.test',
@@ -542,7 +542,7 @@
it "should handle |Joe Q. Public <john.q.public@example.com>|" do
address = Mail::Address.new('Joe Q. Public <john.q.public@example.com>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'Joe Q. Public',
:display_name => 'Joe Q. Public',
:address => 'john.q.public@example.com',
@@ -555,7 +555,7 @@
it "should handle |Mary Smith <@machine.tld:mary@example.net>|" do
address = Mail::Address.new('Mary Smith <@machine.tld:mary@example.net>')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'Mary Smith',
:display_name => 'Mary Smith',
:address => '@machine.tld:mary@example.net',
@@ -567,9 +567,9 @@
end
it "should handle |jdoe@test . example|" do
- pending
+ skip
address = Mail::Address.new('jdoe@test . example')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => 'jdoe@test.example',
:display_name => 'jdoe@test.example',
:address => 'jdoe@test.example',
@@ -582,7 +582,7 @@
it "should handle |groupname+domain.com@example.com|" do
address = Mail::Address.new('groupname+domain.com@example.com')
- address.should break_down_to({
+ expect(address).to break_down_to({
:name => nil,
:display_name => nil,
:address => 'groupname+domain.com@example.com',