Methods
E
N
S
T
Instance Public methods
encode( text, charset="UTF-8" )
# File actionmailer/test/url_test.rb, line 30
def encode( text, charset="UTF-8" )
  quoted_printable( text, charset )
end
new_mail( charset="UTF-8" )
# File actionmailer/test/url_test.rb, line 34
def new_mail( charset="UTF-8" )
  mail = Mail.new
  mail.mime_version = "1.0"
  if charset
    mail.content_type ["text", "plain", { "charset" => charset }]
  end
  mail
end
setup()
# File actionmailer/test/url_test.rb, line 43
def setup
  set_delivery_method :test
  ActionMailer::Base.perform_deliveries = true
  ActionMailer::Base.deliveries.clear
  ActiveSupport::Deprecation.silenced = false

  @recipient = 'test@localhost'
end
teardown()
# File actionmailer/test/url_test.rb, line 52
def teardown
  restore_delivery_method
end
test_signed_up_with_url()
# File actionmailer/test/url_test.rb, line 56
def test_signed_up_with_url
  UrlTestMailer.delivery_method = :test

  AppRoutes.draw do
    match ':controller(/:action(/:id))'
    match '/welcome' => "foo#bar", :as => "welcome"
  end

  expected = new_mail
  expected.to      = @recipient
  expected.subject = "[Signed up] Welcome #{@recipient}"
  expected.body    = "Hello there,\n\nMr. #{@recipient}. Please see our greeting at http://example.com/welcome/greeting http://www.basecamphq.com/welcome\n\n<img alt=\"Somelogo\" src=\"/images/somelogo.png\" />"
  expected.from    = "system@loudthinking.com"
  expected.date    = Time.local(2004, 12, 12)
  expected.content_type = "text/html"

  created = nil
  assert_nothing_raised { created = UrlTestMailer.signed_up_with_url(@recipient) }
  assert_not_nil created

  expected.message_id = '<123@456>'
  created.message_id = '<123@456>'
  assert_equal expected.encoded, created.encoded

  assert_nothing_raised { UrlTestMailer.signed_up_with_url(@recipient).deliver }
  assert_not_nil ActionMailer::Base.deliveries.first
  delivered = ActionMailer::Base.deliveries.first

  delivered.message_id = '<123@456>'
  assert_equal expected.encoded, delivered.encoded
end