aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/CHANGELOG.md54
-rw-r--r--actionmailer/README.rdoc2
-rwxr-xr-xactionmailer/Rakefile1
-rw-r--r--actionmailer/actionmailer.gemspec2
-rw-r--r--actionmailer/lib/action_mailer/base.rb11
-rw-r--r--actionmailer/lib/action_mailer/collector.rb4
-rw-r--r--actionmailer/lib/action_mailer/mail_helper.rb9
-rw-r--r--actionmailer/lib/action_mailer/test_helper.rb2
-rw-r--r--actionmailer/test/mail_helper_test.rb44
9 files changed, 110 insertions, 19 deletions
diff --git a/actionmailer/CHANGELOG.md b/actionmailer/CHANGELOG.md
index 57af4ee6a4..da5d5c4086 100644
--- a/actionmailer/CHANGELOG.md
+++ b/actionmailer/CHANGELOG.md
@@ -1,14 +1,66 @@
+## Rails 4.0.0 (unreleased) ##
+
+* No changes
+
+
+## Rails 3.2.1 (January 26, 2012) ##
+
+* No changes.
+
+
+## Rails 3.2.0 (January 20, 2012) ##
+
+* Upgrade mail version to 2.4.0 *ML*
+
+* Remove Old ActionMailer API *Josh Kalderimis*
+
+
+## Rails 3.1.3 (November 20, 2011) ##
+
+* No changes
+
+
+## Rails 3.1.2 (November 18, 2011) ##
+
+* No changes
+
+
+## Rails 3.1.1 (October 7, 2011) ##
+
+* No changes
+
+
## Rails 3.1.0 (August 30, 2011) ##
* No changes
+## Rails 3.0.11 (November 18, 2011) ##
+
+* No changes.
+
+
+## Rails 3.0.10 (August 16, 2011) ##
+
+* No changes.
+
+
+## Rails 3.0.9 (June 16, 2011) ##
+
+* No changes.
+
+
+## Rails 3.0.8 (June 7, 2011) ##
+
+* Mail dependency increased to 2.2.19
+
+
## Rails 3.0.7 (April 18, 2011) ##
* remove AM delegating register_observer and register_interceptor to Mail *Josh Kalderimis*
-* Rails 3.0.6 (April 5, 2011)
+## Rails 3.0.6 (April 5, 2011) ##
* Don't allow i18n to change the minor version, version now set to ~> 0.5.0 *Santiago Pastorino*
diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc
index 4c2516db59..755717cfba 100644
--- a/actionmailer/README.rdoc
+++ b/actionmailer/README.rdoc
@@ -82,7 +82,7 @@ Note that every value you set with this method will get over written if you use
Example:
- class Authenticationmailer < ActionMailer::Base
+ class AuthenticationMailer < ActionMailer::Base
default :from => "awesome@application.com", :subject => Proc.new { "E-mail was generated at #{Time.now}" }
.....
end
diff --git a/actionmailer/Rakefile b/actionmailer/Rakefile
index e7d8ee299d..8f5aeb9603 100755
--- a/actionmailer/Rakefile
+++ b/actionmailer/Rakefile
@@ -11,6 +11,7 @@ Rake::TestTask.new { |t|
t.libs << "test"
t.pattern = 'test/**/*_test.rb'
t.warning = true
+ t.verbose = true
}
namespace :test do
diff --git a/actionmailer/actionmailer.gemspec b/actionmailer/actionmailer.gemspec
index b506f8804c..c605f1ff04 100644
--- a/actionmailer/actionmailer.gemspec
+++ b/actionmailer/actionmailer.gemspec
@@ -17,5 +17,5 @@ Gem::Specification.new do |s|
s.requirements << 'none'
s.add_dependency('actionpack', version)
- s.add_dependency('mail', '~> 2.3.0')
+ s.add_dependency('mail', '~> 2.4.1')
end
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 7d8852f961..1800ff5839 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -1,7 +1,6 @@
require 'mail'
require 'action_mailer/collector'
require 'active_support/core_ext/object/blank'
-require 'active_support/core_ext/proc'
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/hash/except'
require 'action_mailer/log_subscriber'
@@ -409,7 +408,7 @@ module ActionMailer #:nodoc:
# and passing a Mail::Message will do nothing except tell the logger you sent the email.
def deliver_mail(mail) #:nodoc:
ActiveSupport::Notifications.instrument("deliver.action_mailer") do |payload|
- self.set_payload_for_mail(payload, mail)
+ set_payload_for_mail(payload, mail)
yield # Let Mail do the delivery actions
end
end
@@ -602,9 +601,6 @@ module ActionMailer #:nodoc:
# end
#
def mail(headers={}, &block)
- # Guard flag to prevent both the old and the new API from firing
- # Should be removed when old API is removed
- @mail_was_called = true
m = @_message
# At the beginning, do not consider class default for parts order neither content_type
@@ -612,8 +608,9 @@ module ActionMailer #:nodoc:
parts_order = headers[:parts_order]
# Call all the procs (if any)
- default_values = self.class.default.merge(self.class.default) do |k,v|
- v.respond_to?(:call) ? v.bind(self).call : v
+ class_default = self.class.default
+ default_values = class_default.merge(class_default) do |k,v|
+ v.respond_to?(:to_proc) ? instance_eval(&v) : v
end
# Handle defaults
diff --git a/actionmailer/lib/action_mailer/collector.rb b/actionmailer/lib/action_mailer/collector.rb
index d03e085e83..17b22aea2a 100644
--- a/actionmailer/lib/action_mailer/collector.rb
+++ b/actionmailer/lib/action_mailer/collector.rb
@@ -22,9 +22,9 @@ module ActionMailer #:nodoc:
def custom(mime, options={})
options.reverse_merge!(:content_type => mime.to_s)
- @context.freeze_formats([mime.to_sym])
+ @context.formats = [mime.to_sym]
options[:body] = block_given? ? yield : @default_render.call
@responses << options
end
end
-end \ No newline at end of file
+end
diff --git a/actionmailer/lib/action_mailer/mail_helper.rb b/actionmailer/lib/action_mailer/mail_helper.rb
index 6f22adc479..2036883b22 100644
--- a/actionmailer/lib/action_mailer/mail_helper.rb
+++ b/actionmailer/lib/action_mailer/mail_helper.rb
@@ -1,11 +1,10 @@
module ActionMailer
module MailHelper
- # Uses Text::Format to take the text and format it, indented two spaces for
- # each line, and wrapped at 72 columns.
+ # Take the text and format it, indented two spaces for each line, and wrapped at 72 columns.
def block_format(text)
- formatted = text.split(/\n\r\n/).collect { |paragraph|
+ formatted = text.split(/\n\r?\n/).collect { |paragraph|
format_paragraph(paragraph)
- }.join("\n")
+ }.join("\n\n")
# Make list points stand on their own line
formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" }
@@ -41,7 +40,7 @@ module ActionMailer
sentences = [[]]
text.split.each do |word|
- if (sentences.last + [word]).join(' ').length > len
+ if sentences.first.present? && (sentences.last + [word]).join(' ').length > len
sentences << [word]
else
sentences.last << word
diff --git a/actionmailer/lib/action_mailer/test_helper.rb b/actionmailer/lib/action_mailer/test_helper.rb
index 5beab87ad2..7204822395 100644
--- a/actionmailer/lib/action_mailer/test_helper.rb
+++ b/actionmailer/lib/action_mailer/test_helper.rb
@@ -1,7 +1,5 @@
module ActionMailer
module TestHelper
- extend ActiveSupport::Concern
-
# Asserts that the number of emails sent matches the given number.
#
# def test_emails
diff --git a/actionmailer/test/mail_helper_test.rb b/actionmailer/test/mail_helper_test.rb
index 17e9c82045..d8a73e6c46 100644
--- a/actionmailer/test/mail_helper_test.rb
+++ b/actionmailer/test/mail_helper_test.rb
@@ -22,6 +22,14 @@ class HelperMailer < ActionMailer::Base
end
end
+ def use_format_paragraph_with_long_first_word
+ @text = "Antidisestablishmentarianism is very long."
+
+ mail_with_defaults do |format|
+ format.html { render(:inline => "<%= format_paragraph @text, 10, 1 %>") }
+ end
+ end
+
def use_mailer
mail_with_defaults do |format|
format.html { render(:inline => "<%= mailer.message.subject %>") }
@@ -34,6 +42,23 @@ class HelperMailer < ActionMailer::Base
end
end
+ def use_block_format
+ @text = <<-TEXT
+This is the
+first paragraph.
+
+The second
+ paragraph.
+
+* item1 * item2
+ * item3
+ TEXT
+
+ mail_with_defaults do |format|
+ format.html { render(:inline => "<%= block_format @text %>") }
+ end
+ end
+
protected
def mail_with_defaults(&block)
@@ -63,5 +88,24 @@ class MailerHelperTest < ActionMailer::TestCase
mail = HelperMailer.use_format_paragraph
assert_match " But soft! What\r\n light through\r\n yonder window\r\n breaks?", mail.body.encoded
end
+
+ def test_use_format_paragraph_with_long_first_word
+ mail = HelperMailer.use_format_paragraph_with_long_first_word
+ assert_equal " Antidisestablishmentarianism\r\n is very\r\n long.", mail.body.encoded
+ end
+
+ def test_use_block_format
+ mail = HelperMailer.use_block_format
+ expected = <<-TEXT
+ This is the first paragraph.
+
+ The second paragraph.
+
+ * item1
+ * item2
+ * item3
+ TEXT
+ assert_equal expected.gsub("\n", "\r\n"), mail.body.encoded
+ end
end