aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test/old_base/url_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-08-29 20:42:09 -0300
committerJosé Valim <jose.valim@gmail.com>2010-08-29 20:42:13 -0300
commit972efa11fd3339117e9f874beb4e85b146212c29 (patch)
treeaebc8436ebdc97179d307c77ce264356904d4448 /actionmailer/test/old_base/url_test.rb
parentf5a43138d44455c3da728599af3143950e5fa2a1 (diff)
downloadrails-972efa11fd3339117e9f874beb4e85b146212c29.tar.gz
rails-972efa11fd3339117e9f874beb4e85b146212c29.tar.bz2
rails-972efa11fd3339117e9f874beb4e85b146212c29.zip
Deprecate the old mailer API that was not deprecated yet.
Diffstat (limited to 'actionmailer/test/old_base/url_test.rb')
-rw-r--r--actionmailer/test/old_base/url_test.rb90
1 files changed, 0 insertions, 90 deletions
diff --git a/actionmailer/test/old_base/url_test.rb b/actionmailer/test/old_base/url_test.rb
deleted file mode 100644
index 573186dbee..0000000000
--- a/actionmailer/test/old_base/url_test.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-require 'abstract_unit'
-require 'action_controller'
-
-class WelcomeController < ActionController::Base
-end
-
-AppRoutes = ActionDispatch::Routing::RouteSet.new
-
-class ActionMailer::Base
- include AppRoutes.url_helpers
-end
-
-class UrlTestMailer < ActionMailer::Base
- default_url_options[:host] = 'www.basecamphq.com'
-
- configure do |c|
- c.assets_dir = '' # To get the tests to pass
- end
-
- def signed_up_with_url(recipient)
- @recipients = recipient
- @subject = "[Signed up] Welcome #{recipient}"
- @from = "system@loudthinking.com"
- @sent_on = Time.local(2004, 12, 12)
-
- @recipient = recipient
- @welcome_url = url_for :host => "example.com", :controller => "welcome", :action => "greeting"
- end
-end
-
-class ActionMailerUrlTest < ActionMailer::TestCase
-
- def encode( text, charset="UTF-8" )
- quoted_printable( text, charset )
- end
-
- 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
-
- def setup
- set_delivery_method :test
- ActionMailer::Base.perform_deliveries = true
- ActionMailer::Base.deliveries.clear
-
- @recipient = 'test@localhost'
- end
-
- def teardown
- restore_delivery_method
- end
-
- def test_signed_up_with_url
- UrlTestMailer.delivery_method = :test
-
- assert_deprecated do
- AppRoutes.draw do |map|
- map.connect ':controller/:action/:id'
- map.welcome 'welcome', :controller=>"foo", :action=>"bar"
- end
- 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)
-
- 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
-end