From 15d7cac282e29f0a8e7b38dade07abb32d97a991 Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Thu, 12 Nov 2009 16:08:50 +1100 Subject: Starting again on actionmailer integration with mail --- actionmailer/test/url_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionmailer/test/url_test.rb') diff --git a/actionmailer/test/url_test.rb b/actionmailer/test/url_test.rb index 2224f6321c..f654b2a3ae 100644 --- a/actionmailer/test/url_test.rb +++ b/actionmailer/test/url_test.rb @@ -31,7 +31,7 @@ class ActionMailerUrlTest < Test::Unit::TestCase end def new_mail( charset="utf-8" ) - mail = TMail::Mail.new + mail = Mail.new mail.mime_version = "1.0" if charset mail.set_content_type "text", "plain", { "charset" => charset } -- cgit v1.2.3 From 539d9b355f40b1668b4ad4e8fe628e0a3d9760b8 Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Fri, 20 Nov 2009 14:10:57 +1100 Subject: More updates... 45 errors left to get it working with Mail gem --- actionmailer/test/url_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionmailer/test/url_test.rb') diff --git a/actionmailer/test/url_test.rb b/actionmailer/test/url_test.rb index f654b2a3ae..427833b36c 100644 --- a/actionmailer/test/url_test.rb +++ b/actionmailer/test/url_test.rb @@ -34,7 +34,7 @@ class ActionMailerUrlTest < Test::Unit::TestCase mail = Mail.new mail.mime_version = "1.0" if charset - mail.set_content_type "text", "plain", { "charset" => charset } + mail.content_type ["text", "plain", { "charset" => charset }] end mail end -- cgit v1.2.3 From 6ac32a83283f46b55675ddf4ecab6c91f6f8abde Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sun, 29 Nov 2009 18:28:45 -0600 Subject: Define a welcome controller in mailer tests --- actionmailer/test/url_test.rb | 44 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'actionmailer/test/url_test.rb') 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\"Somelogo\"" - 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\"Somelogo\"" + 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 -- cgit v1.2.3 From 418639b4cfe477d7309fa53e8b8e2472b44bda80 Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Thu, 17 Dec 2009 12:00:32 +1100 Subject: Fixes for working with 1.9.1-head --- actionmailer/test/url_test.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'actionmailer/test/url_test.rb') diff --git a/actionmailer/test/url_test.rb b/actionmailer/test/url_test.rb index 0e565b95e8..6334466a92 100644 --- a/actionmailer/test/url_test.rb +++ b/actionmailer/test/url_test.rb @@ -69,10 +69,16 @@ class ActionMailerUrlTest < Test::Unit::TestCase created = nil assert_nothing_raised { created = TestMailer.create_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 { TestMailer.deliver_signed_up_with_url(@recipient) } assert_not_nil ActionMailer::Base.deliveries.first - assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded + delivered = ActionMailer::Base.deliveries.first + + delivered.message_id = '<123@456>' + assert_equal expected.encoded, delivered.encoded end end -- cgit v1.2.3 From 4964d3b02cd5c87d821ab7d41d243154c727185d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 22 Dec 2009 20:17:27 +0100 Subject: Make ActionMailer::Base inherit from AbstractController::Base Signed-off-by: Yehuda Katz --- actionmailer/test/url_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionmailer/test/url_test.rb') diff --git a/actionmailer/test/url_test.rb b/actionmailer/test/url_test.rb index 18eb355e7d..1140613132 100644 --- a/actionmailer/test/url_test.rb +++ b/actionmailer/test/url_test.rb @@ -12,8 +12,8 @@ class TestMailer < ActionMailer::Base @from = "system@loudthinking.com" @sent_on = Time.local(2004, 12, 12) - @body["recipient"] = recipient - @body["welcome_url"] = url_for :host => "example.com", :controller => "welcome", :action => "greeting" + @recipient = recipient + @welcome_url = url_for :host => "example.com", :controller => "welcome", :action => "greeting" end class <