class TestMailGenerate

Public Instance Methods

test_all() click to toggle source
# File vendor/qwik/lib/qwik/mail-parse.rb, line 83
    def test_all
      str = 'Date: Mon, 3 Feb 2001 12:34:56 +0900
From: "Test User" <user@e.com>
To: "Test Mailing List" <test@example.com>
Subject: Re: [test:1] Test Mail

This is a test.
'
      # test_read
      mail = QuickML::Mail.new
      mail.read(str)

      # test_bare
      ok_eq(str, mail.bare)

      # test_body
      ok_eq("This is a test.\n", mail.body)

      # test_charset
      ok_eq(nil, mail.charset)

      # test_content_type
      ok_eq(nil, mail.content_type)

      # test_from
      ok_eq('user@e.com', mail.from)

      # test_header
      header = nil
      mail.instance_eval {
        header = @header
      }
      ok_eq([['Date', 'Mon, 3 Feb 2001 12:34:56 +0900'],
              ['From', "\"Test User\" <user@e.com>"],
              ['To', "\"Test Mailing List\" <test@example.com>"],
              ['Subject', 'Re: [test:1] Test Mail']],
            header)
    end
test_create() click to toggle source
# File vendor/qwik/lib/qwik/mail-parse.rb, line 122
    def test_create
      str = 'Date: Mon, 3 Feb 2001 12:34:56 +0900
From: "Test User" <user@e.com>
To: "Test Mailing List" <test@example.com>
Subject: Re: [test:1] Test Mail

あ
'
      mail = QuickML::Mail.create { str }
      ok_eq("\202\240\n", mail.body)
    end
test_generate() click to toggle source
# File vendor/qwik/lib/qwik/mail-parse.rb, line 134
    def test_generate
      str = 'Date: Mon, 3 Feb 2001 12:34:56 +0900
From: "Test User" <user@e.com>
To: "Test Mailing List" <test@example.com>
Subject: Re: [test:1] Test Mail

あ
'
      mail = QuickML::Mail.generate { str }
      ok_eq("\e$B$\"\e(B\n", mail.body)
    end