Sha256: 7adc1a68b1ac6380277d4e6bb99f0bba1bfef545ff094ea6ddb1d3af844880a7
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
require "test_helper" class ServerTest < MiniTest::Unit::TestCase include SpawnHelper def setup spawn_server end def teardown kill_server end def test_server_run assert alive?, "Server not alive." end def test_server_bind_port assert wait_bind, "Server doesn't bind." end def test_server_helo wait_bind bye, helo = nil Socket.tcp('127.0.0.1', 2525) do |socket| helo = socket.readline socket.print "EHLO localhost.localdomain\r\n" socket.readpartial(65536) socket.print "QUIT\r\n" bye = socket.readline socket.close_write socket.close_read end assert_match /^220 .*/, helo assert_match /^221 .*/, bye end def test_server_auth wait_bind user = 'app_user' password = 'KnesSGaF9TQ9wOOdXd2m' @message = File.read(File.expand_path("../../fixtures/message.txt", __FILE__)) smtp = Net::SMTP.new('localhost', 2525) smtp.start do |smtp| smtp.auth_plain(user, password) smtp.send_message @message, 'me@fromdomain.com', 'test@todomain.com' end assert alive? end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mail_sandbox-0.1.2 | test/integration/spawn_test.rb |
mail_sandbox-0.1.1 | test/integration/spawn_test.rb |
mail_sandbox-0.1.0 | test/integration/spawn_test.rb |