Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 56 lines (48 sloc) 1.252 kb
40f1335 @phiggins Test cleanup.
phiggins authored
1 require 'em_test_helper'
9d5b7ca migrated version_0 to trunk
blackhedd authored
2
3 class TestSmtpClient < Test::Unit::TestCase
4
f56ec55 @raggi Cleanup tests
raggi authored
5 Localhost = "127.0.0.1"
6 Localport = 9801
9d5b7ca migrated version_0 to trunk
blackhedd authored
7
f56ec55 @raggi Cleanup tests
raggi authored
8 def setup
9 end
9d5b7ca migrated version_0 to trunk
blackhedd authored
10
f56ec55 @raggi Cleanup tests
raggi authored
11 def teardown
12 end
9d5b7ca migrated version_0 to trunk
blackhedd authored
13
f56ec55 @raggi Cleanup tests
raggi authored
14 def test_a
15 # No real tests until we have a server implementation to test against.
16 # This is what the call looks like, though:
17 err = nil
18 EM.run {
19 d = EM::Protocols::SmtpClient.send :domain=>"example.com",
20 :host=>Localhost,
21 :port=>Localport, # optional, defaults 25
22 :starttls=>true,
23 :from=>"sender@example.com",
24 :to=> ["to_1@example.com", "to_2@example.com"],
25 :header=> {"Subject" => "This is a subject line"},
26 :body=> "This is the body of the email",
27 :verbose=>true
28 d.errback {|e|
29 err = e
30 EM.stop
31 }
32 }
33 assert(err)
34 end
9d5b7ca migrated version_0 to trunk
blackhedd authored
35
f56ec55 @raggi Cleanup tests
raggi authored
36 def test_content
37 err = nil
38 EM.run {
39 d = EM::Protocols::SmtpClient.send :domain=>"example.com",
40 :host=>Localhost,
41 :port=>Localport, # optional, defaults 25
42 :starttls=>true,
43 :from=>"sender@example.com",
44 :to=> ["to_1@example.com", "to_2@example.com"],
45 :content => ["Subject: xxx\r\n\r\ndata\r\n.\r\n"],
46 :verbose=>true
47 d.errback {|e|
48 err = e
49 EM.stop
50 }
51 }
52 assert(err)
53 end
9d5b7ca migrated version_0 to trunk
blackhedd authored
54
55 end
Something went wrong with that request. Please try again.