aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test/url_test.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-11-29 18:28:45 -0600
committerJoshua Peek <josh@joshpeek.com>2009-11-29 18:28:45 -0600
commit6ac32a83283f46b55675ddf4ecab6c91f6f8abde (patch)
treeb375de84add24ee4c4551deec533b0667512bf34 /actionmailer/test/url_test.rb
parent075f50d62cd02c2cc14b145cdb34bc9ee85cc83c (diff)
downloadrails-6ac32a83283f46b55675ddf4ecab6c91f6f8abde.tar.gz
rails-6ac32a83283f46b55675ddf4ecab6c91f6f8abde.tar.bz2
rails-6ac32a83283f46b55675ddf4ecab6c91f6f8abde.zip
Define a welcome controller in mailer tests
Diffstat (limited to 'actionmailer/test/url_test.rb')
-rw-r--r--actionmailer/test/url_test.rb44
1 files changed, 22 insertions, 22 deletions
diff --git a/actionmailer/test/url_test.rb b/actionmailer/test/url_test.rb
index 2224f6321c..18eb355e7d 100644
--- a/actionmailer/test/url_test.rb
+++ b/actionmailer/test/url_test.rb
@@ -1,7 +1,9 @@
require 'abstract_unit'
-class TestMailer < ActionMailer::Base
+class WelcomeController < ActionController::Base
+end
+class TestMailer < ActionMailer::Base
default_url_options[:host] = 'www.basecamphq.com'
def signed_up_with_url(recipient)
@@ -52,27 +54,25 @@ class ActionMailerUrlTest < Test::Unit::TestCase
end
def test_signed_up_with_url
- ActionController::Routing.use_controllers! ['welcome'] do
- ActionController::Routing::Routes.draw do |map|
- map.connect ':controller/:action/:id'
- map.welcome 'welcome', :controller=>"foo", :action=>"bar"
- 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 = TestMailer.create_signed_up_with_url(@recipient) }
- assert_not_nil created
- assert_equal expected.encoded, created.encoded
-
- assert_nothing_raised { TestMailer.deliver_signed_up_with_url(@recipient) }
- assert_not_nil ActionMailer::Base.deliveries.first
- assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
+ ActionController::Routing::Routes.draw do |map|
+ map.connect ':controller/:action/:id'
+ map.welcome 'welcome', :controller=>"foo", :action=>"bar"
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 = TestMailer.create_signed_up_with_url(@recipient) }
+ assert_not_nil created
+ assert_equal expected.encoded, created.encoded
+
+ assert_nothing_raised { TestMailer.deliver_signed_up_with_url(@recipient) }
+ assert_not_nil ActionMailer::Base.deliveries.first
+ assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
end
end