Sha256: e550c1064ded6330a094de3a245a530cb4c871e751edce3a59c01d616d54980a

Contents?: true

Size: 1.44 KB

Versions: 52

Compression:

Stored size: 1.44 KB

Contents

require File.dirname(__FILE__) + '/helper'

class TestEmail < Test::Unit::TestCase
  def test_exists
    God::Contacts::Email
  end

  def test_unknown_delivery_method_for_notify
    assert_nothing_raised do
      God::Contacts::Email.any_instance.expects(:notify_smtp).never
      God::Contacts::Email.any_instance.expects(:notify_sendmail).never
      God::Contacts::Email.delivery_method = :foo_protocol
      LOG.expects(:log).times(2)
 
      g = God::Contacts::Email.new
      g.notify(:a, :b, :c, :d, :e)
      assert_nil g.info
    end
  end

  def test_smtp_delivery_method_for_notify
    assert_nothing_raised do
      God::Contacts::Email.any_instance.expects(:notify_sendmail).never
      God::Contacts::Email.any_instance.expects(:notify_smtp).once.returns(nil)
      God::Contacts::Email.delivery_method = :smtp
      g = God::Contacts::Email.new
      g.email = 'joe@example.com'
      g.notify(:a, :b, :c, :d, :e)
      assert_equal "sent email to joe@example.com", g.info
    end
  end
  
  def test_sendmail_delivery_method_for_notify
    assert_nothing_raised do
      God::Contacts::Email.any_instance.expects(:notify_smtp).never
      God::Contacts::Email.any_instance.expects(:notify_sendmail).once.returns(nil)
      God::Contacts::Email.delivery_method = :sendmail
      g = God::Contacts::Email.new
      g.email = 'joe@example.com'
      g.notify(:a, :b, :c, :d, :e)
      assert_equal "sent email to joe@example.com", g.info
    end
  end
  
end

Version data entries

52 entries across 52 versions & 16 rubygems

Version Path
dguettler-god-0.7.13.2 test/test_email.rb
dguettler-god-0.7.13.3 test/test_email.rb
dunedain289-god-0.7.12.1 test/test_email.rb
eric-god-0.7.10 test/test_email.rb
eric-god-0.7.11 test/test_email.rb
eric-god-0.7.12 test/test_email.rb
eric-god-0.7.14 test/test_email.rb
fotonauts-god-0.7.10 test/test_email.rb
fotonauts-god-0.7.12 test/test_email.rb
gordoncww-god-0.7.11.1 test/test_email.rb
jreynolds-god-0.7.13 test/test_email.rb
mathieuravaux-god-0.7.11 test/test_email.rb
mojombo-god-0.7.10 test/test_email.rb
mojombo-god-0.7.11 test/test_email.rb
mojombo-god-0.7.12 test/test_email.rb
mojombo-god-0.7.13 test/test_email.rb
mojombo-god-0.7.14 test/test_email.rb
mojombo-god-0.7.15 test/test_email.rb
mojombo-god-0.7.16 test/test_email.rb
mojombo-god-0.7.20 test/test_email.rb