Sha256: b17eef264a22649585c908da0ee4d63f27c1008e7d2ebeaf443ad170f805cd9b

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

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

class TestEmail < Minitest::Test
  def setup
    God::Contacts::Email.to_email = 'dev@example.com'
    God::Contacts::Email.from_email = 'god@example.com'
    @email = God::Contacts::Email.new
  end

  def test_validity_delivery
    @email.delivery_method = :brainwaves
    assert_equal false, @email.valid?
  end

  def test_smtp_delivery_method_for_notify
    @email.delivery_method = :smtp

    God::Contacts::Email.any_instance.expects(:notify_sendmail).never
    God::Contacts::Email.any_instance.expects(:notify_smtp).once.returns(nil)

    @email.notify('msg', Time.now, 'prio', 'cat', 'host')
    assert_equal "sent email to dev@example.com via smtp", @email.info
  end

  def test_sendmail_delivery_method_for_notify
    @email.delivery_method = :sendmail

    God::Contacts::Email.any_instance.expects(:notify_smtp).never
    God::Contacts::Email.any_instance.expects(:notify_sendmail).once.returns(nil)

    @email.notify('msg', Time.now, 'prio', 'cat', 'host')
    assert_equal "sent email to dev@example.com via sendmail", @email.info
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
resurrected_god-0.14.0 test/test_email.rb
mcproc-2016.2.20 test/test_email.rb
god-0.13.7 test/test_email.rb
god-0.13.6 test/test_email.rb
god-0.13.5 test/test_email.rb