From b95d6e84b00bd926b1118f6a820eca7a870b8c35 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sat, 14 Aug 2010 02:13:00 -0300 Subject: Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) --- actionmailer/CHANGELOG | 8 +++--- actionmailer/README.rdoc | 22 +++++++-------- actionmailer/lib/action_mailer/base.rb | 22 +++++++-------- actionmailer/lib/action_mailer/delivery_methods.rb | 4 +-- actionmailer/lib/action_mailer/mail_helper.rb | 4 +-- actionmailer/lib/action_mailer/old_api.rb | 32 +++++++++++----------- actionmailer/lib/action_mailer/tmail_compat.rb | 6 ++-- actionmailer/test/base_test.rb | 16 +++++------ actionmailer/test/delivery_methods_test.rb | 6 ++-- actionmailer/test/fixtures/raw_email10 | 2 +- actionmailer/test/fixtures/raw_email2 | 2 +- actionmailer/test/fixtures/raw_email3 | 2 +- actionmailer/test/fixtures/raw_email5 | 2 +- actionmailer/test/fixtures/raw_email6 | 2 +- actionmailer/test/fixtures/raw_email8 | 2 +- actionmailer/test/fixtures/raw_email9 | 10 +++---- actionmailer/test/fixtures/templates/signed_up.erb | 2 +- .../custom_templating_extension.html.haml | 4 +-- .../custom_templating_extension.text.haml | 4 +-- .../test/fixtures/test_mailer/signed_up.html.erb | 2 +- .../url_test_mailer/signed_up_with_url.erb | 2 +- actionmailer/test/mailers/proc_mailer.rb | 6 ++-- actionmailer/test/old_base/mail_service_test.rb | 30 ++++++++++---------- actionmailer/test/old_base/tmail_compat_test.rb | 2 +- actionmailer/test/old_base/url_test.rb | 2 +- actionmailer/test/test_helper_test.rb | 24 ++++++++-------- 26 files changed, 110 insertions(+), 110 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG index 76eab935e5..d2cc70fc85 100644 --- a/actionmailer/CHANGELOG +++ b/actionmailer/CHANGELOG @@ -181,7 +181,7 @@ * ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Marcel Molina Jr.] -* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.] +* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.] * Replace Ruby's deprecated append_features in favor of included. [Marcel Molina Jr.] @@ -327,7 +327,7 @@ * Added that deliver_* will now return the email that was sent -* Added that quoting to UTF-8 only happens if the characters used are in that range #955 [Jamis Buck] +* Added that quoting to UTF-8 only happens if the characters used are in that range #955 [Jamis Buck] * Fixed quoting for all address headers, not just to #955 [Jamis Buck] @@ -366,7 +366,7 @@ @body = "Nothing to see here." @charset = "iso-8859-1" end - + def unencoded_subject(recipient) @recipients = recipient @subject = "testing unencoded subject" @@ -375,7 +375,7 @@ @encode_subject = false @charset = "iso-8859-1" end - + *0.6.1* (January 18th, 2005) diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc index 602326eef7..dfb696eb55 100644 --- a/actionmailer/README.rdoc +++ b/actionmailer/README.rdoc @@ -5,7 +5,7 @@ are used to consolidate code for sending out forgotten passwords, welcome wishes on signup, invoices for billing, and any other use case that requires a written notification to either a person or another system. -Action Mailer is in essence a wrapper around Action Controller and the +Action Mailer is in essence a wrapper around Action Controller and the Mail gem. It provides a way to make emails using templates in the same way that Action Controller renders views using templates. @@ -23,7 +23,7 @@ This can be as simple as: class Notifier < ActionMailer::Base delivers_from 'system@loudthinking.com' - + def welcome(recipient) @recipient = recipient mail(:to => recipient, @@ -36,13 +36,13 @@ ERb) that has the instance variables that are declared in the mailer action. So the corresponding body template for the method above could look like this: - Hello there, + Hello there, Mr. <%= @recipient %> Thank you for signing up! - -And if the recipient was given as "david@loudthinking.com", the email + +And if the recipient was given as "david@loudthinking.com", the email generated would look like this: Date: Mon, 25 Jan 2010 22:48:09 +1100 @@ -55,7 +55,7 @@ generated would look like this: charset="US-ASCII"; Content-Transfer-Encoding: 7bit - Hello there, + Hello there, Mr. david@loudthinking.com @@ -75,7 +75,7 @@ Or you can just chain the methods together like: == Receiving emails To receive emails, you need to implement a public instance method called receive that takes a -tmail object as its single parameter. The Action Mailer framework has a corresponding class method, +tmail object as its single parameter. The Action Mailer framework has a corresponding class method, which is also called receive, that accepts a raw, unprocessed email as a string, which it then turns into the tmail object and calls the receive instance method. @@ -90,7 +90,7 @@ Example: if email.has_attachments? for attachment in email.attachments - page.attachments.create({ + page.attachments.create({ :file => attachment, :description => email.subject }) end @@ -98,13 +98,13 @@ Example: end end -This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the +This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the trivial case like this: rails runner 'Mailman.receive(STDIN.read)' -However, invoking Rails in the runner for each mail to be received is very resource intensive. A single -instance of Rails should be run within a daemon if it is going to be utilized to process more than just +However, invoking Rails in the runner for each mail to be received is very resource intensive. A single +instance of Rails should be run within a daemon if it is going to be utilized to process more than just a limited number of email. == Configuration diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index f742f982f2..8fe5868d52 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -187,31 +187,31 @@ module ActionMailer #:nodoc: # with the filename +free_book.pdf+. # # = Inline Attachments - # - # You can also specify that a file should be displayed inline with other HTML. This is useful + # + # You can also specify that a file should be displayed inline with other HTML. This is useful # if you want to display a corporate logo or a photo. - # + # # class ApplicationMailer < ActionMailer::Base # def welcome(recipient) # attachments.inline['photo.png'] = File.read('path/to/photo.png') # mail(:to => recipient, :subject => "Here is what we look like") # end # end - # + # # And then to reference the image in the view, you create a welcome.html.erb file and - # make a call to +image_tag+ passing in the attachment you want to display and then call + # make a call to +image_tag+ passing in the attachment you want to display and then call # +url+ on the attachment to get the relative content id path for the image source: - # + # #

Please Don't Cringe

- # + # # <%= image_tag attachments['photo.png'].url -%> - # + # # As we are using Action View's +image_tag+ method, you can pass in any other options you want: - # + # #

Please Don't Cringe

- # + # # <%= image_tag attachments['photo.png'].url, :alt => 'Our Photo', :class => 'photo' -%> - # + # # = Observing and Intercepting Mails # # Action Mailer provides hooks into the Mail observer and interceptor methods. These allow you to diff --git a/actionmailer/lib/action_mailer/delivery_methods.rb b/actionmailer/lib/action_mailer/delivery_methods.rb index 043794bb12..b324ba790d 100644 --- a/actionmailer/lib/action_mailer/delivery_methods.rb +++ b/actionmailer/lib/action_mailer/delivery_methods.rb @@ -46,11 +46,11 @@ module ActionMailer # as alias and the default options supplied: # # Example: - # + # # add_delivery_method :sendmail, Mail::Sendmail, # :location => '/usr/sbin/sendmail', # :arguments => '-i -t' - # + # def add_delivery_method(symbol, klass, default_options={}) class_attribute(:"#{symbol}_settings") unless respond_to?(:"#{symbol}_settings") send(:"#{symbol}_settings=", default_options) diff --git a/actionmailer/lib/action_mailer/mail_helper.rb b/actionmailer/lib/action_mailer/mail_helper.rb index b708881edf..80ffc9b7ee 100644 --- a/actionmailer/lib/action_mailer/mail_helper.rb +++ b/actionmailer/lib/action_mailer/mail_helper.rb @@ -15,11 +15,11 @@ module ActionMailer :columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph ).format }.join("\n") - + # Make list points stand on their own line formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" } formatted.gsub!(/[ ]*([#]+) ([^#]*)/) { |s| " #{$1} #{$2.strip}\n" } - + formatted end diff --git a/actionmailer/lib/action_mailer/old_api.rb b/actionmailer/lib/action_mailer/old_api.rb index 79d024a350..2a6289c22d 100644 --- a/actionmailer/lib/action_mailer/old_api.rb +++ b/actionmailer/lib/action_mailer/old_api.rb @@ -116,36 +116,36 @@ module ActionMailer def normalize_nonfile_hash(params) content_disposition = "attachment;" - + mime_type = params.delete(:mime_type) - + if content_type = params.delete(:content_type) content_type = "#{mime_type || content_type};" end params[:body] = params.delete(:data) if params[:data] - + { :content_type => content_type, :content_disposition => content_disposition }.merge(params) end - + def normalize_file_hash(params) filename = File.basename(params.delete(:filename)) content_disposition = "attachment; filename=\"#{File.basename(filename)}\"" - + mime_type = params.delete(:mime_type) - + if (content_type = params.delete(:content_type)) && (content_type !~ /filename=/) content_type = "#{mime_type || content_type}; filename=\"#{filename}\"" end - + params[:body] = params.delete(:data) if params[:data] - + { :content_type => content_type, :content_disposition => content_disposition }.merge(params) end - def create_mail + def create_mail m = @_message set_fields!({:subject => subject, :to => recipients, :from => from, @@ -178,14 +178,14 @@ module ActionMailer wrap_delivery_behavior! m.content_transfer_encoding = '8bit' unless m.body.only_us_ascii? - + @_message end - + # Set up the default values for the various instance variables of this # mailer. Subclasses may override this method to provide different # defaults. - def initialize_defaults(method_name) + def initialize_defaults(method_name) @charset ||= self.class.default[:charset].try(:dup) @content_type ||= self.class.default[:content_type].try(:dup) @implicit_parts_order ||= self.class.default[:parts_order].try(:dup) @@ -201,7 +201,7 @@ module ActionMailer @body ||= {} end - def create_parts + def create_parts if String === @body @parts.unshift create_inline_part(@body) elsif @parts.empty? || @parts.all? { |p| p.content_disposition =~ /^attachment/ } @@ -220,7 +220,7 @@ module ActionMailer end end - def create_inline_part(body, mime_type=nil) + def create_inline_part(body, mime_type=nil) ct = mime_type || "text/plain" main_type, sub_type = split_content_type(ct.to_s) @@ -242,11 +242,11 @@ module ActionMailer m.reply_to ||= headers.delete(:reply_to) if headers[:reply_to] end - def split_content_type(ct) + def split_content_type(ct) ct.to_s.split("/") end - def parse_content_type(defaults=nil) + def parse_content_type(defaults=nil) if @content_type.blank? [ nil, {} ] else diff --git a/actionmailer/lib/action_mailer/tmail_compat.rb b/actionmailer/lib/action_mailer/tmail_compat.rb index 26962f972f..26cc474e91 100644 --- a/actionmailer/lib/action_mailer/tmail_compat.rb +++ b/actionmailer/lib/action_mailer/tmail_compat.rb @@ -1,12 +1,12 @@ module Mail class Message - + def set_content_type(*args) ActiveSupport::Deprecation.warn('Message#set_content_type is deprecated, please just call ' << 'Message#content_type with the same arguments', caller[0,2]) content_type(*args) end - + alias :old_transfer_encoding :transfer_encoding def transfer_encoding(value = nil) if value @@ -29,6 +29,6 @@ module Mail 'please call Message#filename', caller[0,2]) filename end - + end end \ No newline at end of file diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index fec0ecf477..fb42ccb8aa 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -148,7 +148,7 @@ class BaseTest < ActiveSupport::TestCase assert_equal("application/pdf", email.parts[1].mime_type) assert_equal("VGhpcyBpcyB0ZXN0IEZpbGUgY29udGVudA==\r\n", email.parts[1].body.encoded) end - + test "can embed an inline attachment" do email = BaseMailer.inline_attachment # Need to call #encoded to force the JIT sort on parts @@ -413,7 +413,7 @@ class BaseTest < ActiveSupport::TestCase BaseMailer.welcome.deliver assert_equal(1, BaseMailer.deliveries.length) end - + test "calling deliver, ActionMailer should yield back to mail to let it call :do_delivery on itself" do mail = Mail::Message.new mail.expects(:do_delivery).once @@ -447,7 +447,7 @@ class BaseTest < ActiveSupport::TestCase mail = BaseMailer.welcome_from_another_path(['unknown/invalid', 'another.path/base_mailer']).deliver assert_equal("Welcome from another path", mail.body.encoded) end - + test "assets tags should use ActionMailer's asset_host settings" do ActionMailer::Base.config.asset_host = "http://global.com" ActionMailer::Base.config.assets_dir = "global/" @@ -456,7 +456,7 @@ class BaseTest < ActiveSupport::TestCase assert_equal(%{Dummy}, mail.body.to_s.strip) end - + test "assets tags should use a Mailer's asset_host settings when available" do ActionMailer::Base.config.asset_host = "global.com" ActionMailer::Base.config.assets_dir = "global/" @@ -469,12 +469,12 @@ class BaseTest < ActiveSupport::TestCase end # Before and After hooks - + class MyObserver def self.delivered_email(mail) end end - + test "you can register an observer to the mail object that gets informed on email delivery" do ActionMailer::Base.register_observer(MyObserver) mail = BaseMailer.welcome @@ -493,7 +493,7 @@ class BaseTest < ActiveSupport::TestCase MyInterceptor.expects(:delivering_email).with(mail) mail.deliver end - + test "being able to put proc's into the defaults hash and they get evaluated on mail sending" do mail1 = ProcMailer.welcome yesterday = 1.day.ago @@ -501,7 +501,7 @@ class BaseTest < ActiveSupport::TestCase mail2 = ProcMailer.welcome assert(mail1['X-Proc-Method'].to_s.to_i > mail2['X-Proc-Method'].to_s.to_i) end - + test "we can call other defined methods on the class as needed" do mail = ProcMailer.welcome assert_equal("Thanks for signing up this afternoon", mail.subject) diff --git a/actionmailer/test/delivery_methods_test.rb b/actionmailer/test/delivery_methods_test.rb index 22a7d19bc2..08f84dbf3b 100644 --- a/actionmailer/test/delivery_methods_test.rb +++ b/actionmailer/test/delivery_methods_test.rb @@ -128,7 +128,7 @@ class MailDeliveryTest < ActiveSupport::TestCase Mail::Message.any_instance.expects(:deliver!).never DeliveryMailer.welcome.deliver end - + test "does not append the deliveries collection if told not to perform the delivery" do DeliveryMailer.perform_deliveries = false DeliveryMailer.deliveries.clear @@ -160,7 +160,7 @@ class MailDeliveryTest < ActiveSupport::TestCase DeliveryMailer.welcome.deliver end end - + test "does not increment the deliveries collection on bogus deliveries" do DeliveryMailer.delivery_method = BogusDelivery DeliveryMailer.raise_delivery_errors = false @@ -168,5 +168,5 @@ class MailDeliveryTest < ActiveSupport::TestCase DeliveryMailer.welcome.deliver assert_equal(0, DeliveryMailer.deliveries.length) end - + end diff --git a/actionmailer/test/fixtures/raw_email10 b/actionmailer/test/fixtures/raw_email10 index b1fc2b2617..edad5ccff1 100644 --- a/actionmailer/test/fixtures/raw_email10 +++ b/actionmailer/test/fixtures/raw_email10 @@ -15,6 +15,6 @@ Content-Type: text/plain; charset=X-UNKNOWN Test test. Hi. Waving. m ---------------------------------------------------------------- -Sent via Bell Mobility's Text Messaging service. +Sent via Bell Mobility's Text Messaging service. Envoyé par le service de messagerie texte de Bell Mobilité. ---------------------------------------------------------------- diff --git a/actionmailer/test/fixtures/raw_email2 b/actionmailer/test/fixtures/raw_email2 index 3999fcc877..9f87bb2a98 100644 --- a/actionmailer/test/fixtures/raw_email2 +++ b/actionmailer/test/fixtures/raw_email2 @@ -32,7 +32,7 @@ To: xxxxx xxxx Subject: Fwd: Signed email causes file attachments In-Reply-To: Mime-Version: 1.0 -Content-Type: multipart/mixed; +Content-Type: multipart/mixed; boundary="----=_Part_5028_7368284.1115579351471" References: diff --git a/actionmailer/test/fixtures/raw_email3 b/actionmailer/test/fixtures/raw_email3 index 771a96350d..3a0927490a 100644 --- a/actionmailer/test/fixtures/raw_email3 +++ b/actionmailer/test/fixtures/raw_email3 @@ -31,7 +31,7 @@ Reply-To: Test Tester To: xxxx@xxxx.com, xxxx@xxxx.com Subject: Another PDF Mime-Version: 1.0 -Content-Type: multipart/mixed; +Content-Type: multipart/mixed; boundary="----=_Part_2192_32400445.1115745999735" X-Virus-Scanned: amavisd-new at textdrive.com diff --git a/actionmailer/test/fixtures/raw_email5 b/actionmailer/test/fixtures/raw_email5 index 151c631471..bbe31bcdc5 100644 --- a/actionmailer/test/fixtures/raw_email5 +++ b/actionmailer/test/fixtures/raw_email5 @@ -14,6 +14,6 @@ Importance: normal Test test. Hi. Waving. m ---------------------------------------------------------------- -Sent via Bell Mobility's Text Messaging service. +Sent via Bell Mobility's Text Messaging service. Envoyé par le service de messagerie texte de Bell Mobilité. ---------------------------------------------------------------- diff --git a/actionmailer/test/fixtures/raw_email6 b/actionmailer/test/fixtures/raw_email6 index 93289c4f92..8e37bd7392 100644 --- a/actionmailer/test/fixtures/raw_email6 +++ b/actionmailer/test/fixtures/raw_email6 @@ -15,6 +15,6 @@ Content-Type: text/plain; charset=us-ascii Test test. Hi. Waving. m ---------------------------------------------------------------- -Sent via Bell Mobility's Text Messaging service. +Sent via Bell Mobility's Text Messaging service. Envoyé par le service de messagerie texte de Bell Mobilité. ---------------------------------------------------------------- diff --git a/actionmailer/test/fixtures/raw_email8 b/actionmailer/test/fixtures/raw_email8 index 2382dfdf34..79996365b3 100644 --- a/actionmailer/test/fixtures/raw_email8 +++ b/actionmailer/test/fixtures/raw_email8 @@ -8,7 +8,7 @@ To: xxxxx xxxx Subject: Fwd: Signed email causes file attachments In-Reply-To: Mime-Version: 1.0 -Content-Type: multipart/mixed; +Content-Type: multipart/mixed; boundary="----=_Part_5028_7368284.1115579351471" References: diff --git a/actionmailer/test/fixtures/raw_email9 b/actionmailer/test/fixtures/raw_email9 index 8b9b1eaa04..02ea0b05c5 100644 --- a/actionmailer/test/fixtures/raw_email9 +++ b/actionmailer/test/fixtures/raw_email9 @@ -10,19 +10,19 @@ Date: Wed, 23 Feb 2005 18:20:17 -0400 From: "xxx xxx" Message-ID: <4D6AA7EB.6490534@xxx.xxx> To: xxx@xxx.com -Subject: Stop adware/spyware once and for all. +Subject: Stop adware/spyware once and for all. X-Scanned-By: MIMEDefang 2.11 (www dot roaringpenguin dot com slash mimedefang) -You are infected with: +You are infected with: Ad Ware and Spy Ware -Get your free scan and removal download now, -before it gets any worse. +Get your free scan and removal download now, +before it gets any worse. http://xxx.xxx.info?aid=3D13&?stat=3D4327kdzt -no more? (you will still be infected) +no more? (you will still be infected) http://xxx.xxx.info/discon/?xxx@xxx.com diff --git a/actionmailer/test/fixtures/templates/signed_up.erb b/actionmailer/test/fixtures/templates/signed_up.erb index a85d5fa442..7afe1f651c 100644 --- a/actionmailer/test/fixtures/templates/signed_up.erb +++ b/actionmailer/test/fixtures/templates/signed_up.erb @@ -1,3 +1,3 @@ -Hello there, +Hello there, Mr. <%= @recipient %> \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml b/actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml index 847d065c37..8dcf9746cc 100644 --- a/actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml +++ b/actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml @@ -1,6 +1,6 @@ -%p Hello there, +%p Hello there, -%p +%p Mr. = @recipient from haml \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml b/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml index 847d065c37..8dcf9746cc 100644 --- a/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml +++ b/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml @@ -1,6 +1,6 @@ -%p Hello there, +%p Hello there, -%p +%p Mr. = @recipient from haml \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/signed_up.html.erb b/actionmailer/test/fixtures/test_mailer/signed_up.html.erb index a85d5fa442..7afe1f651c 100644 --- a/actionmailer/test/fixtures/test_mailer/signed_up.html.erb +++ b/actionmailer/test/fixtures/test_mailer/signed_up.html.erb @@ -1,3 +1,3 @@ -Hello there, +Hello there, Mr. <%= @recipient %> \ No newline at end of file diff --git a/actionmailer/test/fixtures/url_test_mailer/signed_up_with_url.erb b/actionmailer/test/fixtures/url_test_mailer/signed_up_with_url.erb index 4c5806d30d..6e7875cff5 100644 --- a/actionmailer/test/fixtures/url_test_mailer/signed_up_with_url.erb +++ b/actionmailer/test/fixtures/url_test_mailer/signed_up_with_url.erb @@ -1,4 +1,4 @@ -Hello there, +Hello there, Mr. <%= @recipient %>. Please see our greeting at <%= @welcome_url %> <%= welcome_url %> diff --git a/actionmailer/test/mailers/proc_mailer.rb b/actionmailer/test/mailers/proc_mailer.rb index 6a79cd71fc..43916e1421 100644 --- a/actionmailer/test/mailers/proc_mailer.rb +++ b/actionmailer/test/mailers/proc_mailer.rb @@ -6,11 +6,11 @@ class ProcMailer < ActionMailer::Base def welcome mail end - + private - + def give_a_greeting "Thanks for signing up this afternoon" end - + end diff --git a/actionmailer/test/old_base/mail_service_test.rb b/actionmailer/test/old_base/mail_service_test.rb index 831adf3e32..4c93eb63e2 100644 --- a/actionmailer/test/old_base/mail_service_test.rb +++ b/actionmailer/test/old_base/mail_service_test.rb @@ -106,7 +106,7 @@ class TestMailer < ActionMailer::Base cc "Foo áëô îü " bcc "Foo áëô îü " charset "UTF-8" - + body "åœö blah" end @@ -359,7 +359,7 @@ class ActionMailerTest < Test::Unit::TestCase assert_equal "text/plain", created.parts[0].parts[0].mime_type assert_equal "text/html", created.parts[0].parts[1].mime_type assert_equal "application/octet-stream", created.parts[1].mime_type - + end def test_nested_parts_with_body @@ -399,7 +399,7 @@ class ActionMailerTest < Test::Unit::TestCase created = nil assert_nothing_raised { created = TestMailer.signed_up(@recipient) } assert_not_nil created - + expected.message_id = '<123@456>' created.message_id = '<123@456>' @@ -503,7 +503,7 @@ class ActionMailerTest < Test::Unit::TestCase delivered = ActionMailer::Base.deliveries.first expected.message_id = '<123@456>' delivered.message_id = '<123@456>' - + assert_equal expected.encoded, delivered.encoded end @@ -546,10 +546,10 @@ class ActionMailerTest < Test::Unit::TestCase created = TestMailer.different_reply_to @recipient end assert_not_nil created - + expected.message_id = '<123@456>' created.message_id = '<123@456>' - + assert_equal expected.encoded, created.encoded assert_nothing_raised do @@ -558,10 +558,10 @@ class ActionMailerTest < Test::Unit::TestCase delivered = ActionMailer::Base.deliveries.first assert_not_nil delivered - + expected.message_id = '<123@456>' delivered.message_id = '<123@456>' - + assert_equal expected.encoded, delivered.encoded end @@ -581,7 +581,7 @@ class ActionMailerTest < Test::Unit::TestCase created = TestMailer.iso_charset @recipient end assert_not_nil created - + expected.message_id = '<123@456>' created.message_id = '<123@456>' @@ -596,7 +596,7 @@ class ActionMailerTest < Test::Unit::TestCase expected.message_id = '<123@456>' delivered.message_id = '<123@456>' - + assert_equal expected.encoded, delivered.encoded end @@ -631,7 +631,7 @@ class ActionMailerTest < Test::Unit::TestCase expected.message_id = '<123@456>' delivered.message_id = '<123@456>' - + assert_equal expected.encoded, delivered.encoded end @@ -761,10 +761,10 @@ EOF delivered = ActionMailer::Base.deliveries.first assert_not_nil delivered - + expected.message_id = '<123@456>' delivered.message_id = '<123@456>' - + assert_equal expected.encoded, delivered.encoded end @@ -887,7 +887,7 @@ EOF assert_equal "iso-8859-1", mail.parts[1].charset assert_equal "image/jpeg", mail.parts[2].mime_type - + assert_equal "attachment", mail.parts[2][:content_disposition].disposition_type assert_equal "foo.jpg", mail.parts[2][:content_disposition].filename assert_equal "foo.jpg", mail.parts[2][:content_type].filename @@ -1005,7 +1005,7 @@ EOF attachment = mail.attachments.last expected = "01 Quien Te Dij\212at. Pitbull.mp3" - + if expected.respond_to?(:force_encoding) result = attachment.filename.dup expected.force_encoding(Encoding::ASCII_8BIT) diff --git a/actionmailer/test/old_base/tmail_compat_test.rb b/actionmailer/test/old_base/tmail_compat_test.rb index 255205de84..23706e99ff 100644 --- a/actionmailer/test/old_base/tmail_compat_test.rb +++ b/actionmailer/test/old_base/tmail_compat_test.rb @@ -31,5 +31,5 @@ class TmailCompatTest < ActiveSupport::TestCase end assert_equal mail.content_transfer_encoding, "base64" end - + end diff --git a/actionmailer/test/old_base/url_test.rb b/actionmailer/test/old_base/url_test.rb index b6496bfe1b..b4be7dfe32 100644 --- a/actionmailer/test/old_base/url_test.rb +++ b/actionmailer/test/old_base/url_test.rb @@ -83,7 +83,7 @@ class ActionMailerUrlTest < ActionMailer::TestCase 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 diff --git a/actionmailer/test/test_helper_test.rb b/actionmailer/test/test_helper_test.rb index 8ff604c2c7..5a101e852f 100644 --- a/actionmailer/test/test_helper_test.rb +++ b/actionmailer/test/test_helper_test.rb @@ -32,7 +32,7 @@ class TestHelperMailerTest < ActionMailer::TestCase self.class.determine_default_mailer("NotAMailerTest") end end - + def test_charset_is_utf_8 assert_equal "UTF-8", charset end @@ -44,14 +44,14 @@ class TestHelperMailerTest < ActionMailer::TestCase end end end - + def test_repeated_assert_emails_calls assert_nothing_raised do assert_emails 1 do TestHelperMailer.test.deliver end end - + assert_nothing_raised do assert_emails 2 do TestHelperMailer.test.deliver @@ -59,20 +59,20 @@ class TestHelperMailerTest < ActionMailer::TestCase end end end - + def test_assert_emails_with_no_block assert_nothing_raised do TestHelperMailer.test.deliver assert_emails 1 end - + assert_nothing_raised do TestHelperMailer.test.deliver TestHelperMailer.test.deliver assert_emails 3 end end - + def test_assert_no_emails assert_nothing_raised do assert_no_emails do @@ -80,17 +80,17 @@ class TestHelperMailerTest < ActionMailer::TestCase end end end - + def test_assert_emails_too_few_sent error = assert_raise ActiveSupport::TestCase::Assertion do assert_emails 2 do TestHelperMailer.test.deliver end end - + assert_match(/2 .* but 1/, error.message) end - + def test_assert_emails_too_many_sent error = assert_raise ActiveSupport::TestCase::Assertion do assert_emails 1 do @@ -98,17 +98,17 @@ class TestHelperMailerTest < ActionMailer::TestCase TestHelperMailer.test.deliver end end - + assert_match(/1 .* but 2/, error.message) end - + def test_assert_no_emails_failure error = assert_raise ActiveSupport::TestCase::Assertion do assert_no_emails do TestHelperMailer.test.deliver end end - + assert_match(/0 .* but 1/, error.message) end end -- cgit v1.2.3