test/eno_test.rb in openwferu-0.9.15 vs test/eno_test.rb in openwferu-0.9.16

- old
+ new

@@ -5,17 +5,22 @@ # John Mettraux at openwfe.org # # Tue Jan 2 13:14:37 JST 2007 # +require 'test/unit' + require 'openwfe/workitem' require 'openwfe/engine/engine' require 'openwfe/expressions/raw_prog' require 'openwfe/participants/participants' require 'openwfe/participants/enoparticipants' -require 'flowtestbase' +#require 'flowtestbase' +require 'rubygems' +require 'mailtrap' + include OpenWFE class EnoTest < Test::Unit::TestCase @@ -33,34 +38,42 @@ email_notification_participant end def test_eno - puts " TARGET is #{ENV['TARGET']}" + mailfile = "work/mailtrap.txt" + FileUtils.mkdir "work" unless File.exist?("work") + FileUtils.rm mailfile if File.exist?(mailfile) + Thread.new do + Mailtrap.new 'localhost', 2525, true, "work/mailtrap.txt" + end + engine = Engine.new eno = MailParticipant.new( - :smtp_server => "mail.google.com" + :smtp_server => "localhost", + :smtp_port => 2525, :from_address => "eno@outoftheblue.co.jp" ) do s = "" - s << "Subject: test 0\n\n" - + s << "Subject: test 0\n" + s << "\n" s << "konnichiwa. #{Time.now.to_s}\n\n" s end engine.register_participant("email_notification_participant", eno) - li = LaunchItem.new(TestDefinition0) + li = LaunchItem.new TestDefinition0 - li.email_target = ENV["TARGET"] + li.email_target = 'john@localhost' - fei = engine.launch(li) - + fei = engine.launch li engine.wait_for fei + + assert_equal 1, OpenWFE.grep("konnichiwa", mailfile).size end end