Sha256: e2923578065034d8f203f7358eefbe32b7257f5599cbc3ab09f2badbe8f26a37

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'test_helper'

class UserMailerTest < ActionController::TestCase
  context "UserMailer" do
    should "has sendgrid header" do
      assert UserMailer.sendgrid_config.to_hash["X-SMTPAPI"].present?
    end

    should "send to safe mail address" do
      MailEngine::Base.current_config["replacement_email"] = "xxx@xxx.com"
      UserMailer.notify("x@x.com").deliver
      assert UserMailer.sendgrid_config.to_hash["X-SMTPAPI"].include?("[\"xxx@xxx.com\"]")
    end

    should "only send mail to the receiver" do
      UserMailer.notify("x@x.com").deliver
      assert UserMailer.sendgrid_config.to_hash["X-SMTPAPI"].include?("[\"x@x.com\"]")

      UserMailer.notify("y@y.com").deliver
      assert UserMailer.sendgrid_config.to_hash["X-SMTPAPI"].include?("[\"y@y.com\"]")
    end

    should "override subject by db tempate.subject" do
      @template = FactoryGirl.build(:system_mail_template_with_footer, :format => "html")
      assert_equal "subject in mailer", UserMailer.notify("x@x.com").subject
      @template.save
      assert_equal @template.subject, UserMailer.notify("x@x.com").subject
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mail_engine-0.1.7 test/functional/user_mailer_test.rb