summaryrefslogtreecommitdiff
path: root/test/net/smtp/test_smtp.rb
blob: ba2943db563e2faafd4bf83a4abe6d4027c78d9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'net/smtp'
require 'minitest/autorun'

module Net
  class TestSMTP < MiniTest::Unit::TestCase
    def test_critical
      smtp = Net::SMTP.new 'localhost', 25

      assert_raises RuntimeError do
        smtp.send :critical do
          raise 'fail on purpose'
        end
      end

      assert_kind_of Net::SMTP::Response, smtp.send(:critical),
                     '[Bug #9125]'
    end

    def test_esmtp
      smtp = Net::SMTP.new 'localhost', 25
      assert smtp.esmtp
      assert smtp.esmtp?

      smtp.esmtp = 'omg'
      assert_equal 'omg', smtp.esmtp
      assert_equal 'omg', smtp.esmtp?
    end
  end
end