Sha256: 172929c75d56a5021ad3842db429bf1517e9bc4dad5e18498a126a19b07afdd7

Contents?: true

Size: 782 Bytes

Versions: 1

Compression:

Stored size: 782 Bytes

Contents

require 'tmail'
require 'test/unit'
require 'test_helper'

class TestAttachments < Test::Unit::TestCase

  def test_attachment
    mail = TMail::Mail.new
    mail.mime_version = "1.0"
    mail.set_content_type 'multipart', 'mixed', {'boundary' => 'Apple-Mail-13-196941151'}
    mail.body =<<HERE
--Apple-Mail-13-196941151
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=ISO-8859-1;
	delsp=yes;
	format=flowed

This is the first part.

--Apple-Mail-13-196941151
Content-Type: text/x-ruby-script; name="hello.rb"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="api.rb"

puts "Hello, world!"
gets

--Apple-Mail-13-196941151--
HERE
    assert_equal(true, mail.multipart?)
    assert_equal(1, mail.attachments.length)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tmail-1.1.1 test/test_attachments.rb