Sha256: 09d9d219b2577b6f2f58d10e78e2a1e75de19a7024c1e5d1c70552c36a07f556

Contents?: true

Size: 1.69 KB

Versions: 1

Compression:

Stored size: 1.69 KB

Contents

require_relative './test_helper'

class ActiveMailerTest < ActiveSupport::TestCase
  include Wrong
  test "removes nil from recipients list automatically" do
    email = nil
    assert_nothing_raised do
      email = InvitationEmail.new(:sender => "spammy@example.com",
                                  :recipients => ["takesit@upemail.com", nil],
                                  :subject => "YOU GUYS!"
                                  )
    end
    assert { email.save }
    deny   { email.recipients.length == 2 }
  end

  test "sends with correct subject" do
    email = InvitationEmail.new(:sender => "spammy@example.com",
                                :recipients => ["takesit@upemail.com", nil],
                                :subject => "YOU GUYS!"
                                )
    assert { email.send! }
    assert { email.mailer.subject == email.subject }
  end

  test "sends with correct layout" do
    InvitationEmail.layout "email"
    email = InvitationEmail.new(:sender => "spammy@example.com",
                                :recipients => ["takesit@upemail.com", nil],
                                :subject => "YOU GUYS!"
                                )
    assert { email.send! }
    actual_layout = ActiveMailer::Base::DefaultActionMailer.instance_variable_get("@_layout")
    assert { "email" == actual_layout  }
  end

  test "sends headers" do
    email = InvitationEmail.new(:sender => "spammy@example.com",
                                :recipients => ["takesit@upemail.com", nil],
                                :subject => "YOU GUYS!")
    email.headers = {"SOMETHING" => "else"}
    assert { email.send! }
    assert { email.mailer.header["SOMETHING"].to_s == "else" }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_mailer-0.0.10 test/active_mailer_test.rb