diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2017-05-29 20:37:35 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2017-05-29 20:37:35 +0200 |
commit | e1758b5e8c8d49fdf931b0b3f8009810880113a6 (patch) | |
tree | 97181998af56fff415827af679253b1472aa0006 /actionmailer | |
parent | 61413b592dbbd6d7adbcb16fb95f760b0656cd9b (diff) | |
parent | e7a33a5ed74cc0987544396f0742110fa5a5e228 (diff) | |
download | rails-e1758b5e8c8d49fdf931b0b3f8009810880113a6.tar.gz rails-e1758b5e8c8d49fdf931b0b3f8009810880113a6.tar.bz2 rails-e1758b5e8c8d49fdf931b0b3f8009810880113a6.zip |
Merge branch 'master' into unlock-minitest
Diffstat (limited to 'actionmailer')
-rw-r--r-- | actionmailer/actionmailer.gemspec | 2 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer.rb | 1 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 3 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/delivery_methods.rb | 6 | ||||
-rw-r--r-- | actionmailer/lib/rails/generators/mailer/mailer_generator.rb | 2 | ||||
-rw-r--r-- | actionmailer/test/abstract_unit.rb | 4 | ||||
-rw-r--r-- | actionmailer/test/caching_test.rb | 12 | ||||
-rw-r--r-- | actionmailer/test/log_subscriber_test.rb | 4 |
8 files changed, 14 insertions, 20 deletions
diff --git a/actionmailer/actionmailer.gemspec b/actionmailer/actionmailer.gemspec index e75dae6cf9..5eadd01407 100644 --- a/actionmailer/actionmailer.gemspec +++ b/actionmailer/actionmailer.gemspec @@ -1,4 +1,4 @@ -version = File.read(File.expand_path("../../RAILS_VERSION", __FILE__)).strip +version = File.read(File.expand_path("../RAILS_VERSION", __dir__)).strip Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb index 211190560a..8e59f033d0 100644 --- a/actionmailer/lib/action_mailer.rb +++ b/actionmailer/lib/action_mailer.rb @@ -25,6 +25,7 @@ require "abstract_controller" require "action_mailer/version" # Common Active Support usage in Action Mailer +require "active_support" require "active_support/rails" require "active_support/core_ext/class" require "active_support/core_ext/module/attr_internal" diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 6849f5c0f9..7133670b65 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -459,8 +459,7 @@ module ActionMailer helper ActionMailer::MailHelper - class_attribute :default_params - self.default_params = { + class_attribute :default_params, default: { mime_version: "1.0", charset: "UTF-8", content_type: "text/plain", diff --git a/actionmailer/lib/action_mailer/delivery_methods.rb b/actionmailer/lib/action_mailer/delivery_methods.rb index bcc4ef03cf..afdc28aa2a 100644 --- a/actionmailer/lib/action_mailer/delivery_methods.rb +++ b/actionmailer/lib/action_mailer/delivery_methods.rb @@ -7,8 +7,6 @@ module ActionMailer extend ActiveSupport::Concern included do - class_attribute :delivery_methods, :delivery_method - # Do not make this inheritable, because we always want it to propagate cattr_accessor :raise_delivery_errors self.raise_delivery_errors = true @@ -19,8 +17,8 @@ module ActionMailer cattr_accessor :deliver_later_queue_name self.deliver_later_queue_name = :mailers - self.delivery_methods = {}.freeze - self.delivery_method = :smtp + class_attribute :delivery_methods, default: {}.freeze + class_attribute :delivery_method, default: :smtp add_delivery_method :smtp, Mail::SMTP, address: "localhost", diff --git a/actionmailer/lib/rails/generators/mailer/mailer_generator.rb b/actionmailer/lib/rails/generators/mailer/mailer_generator.rb index 99fe4544f1..bc21b07109 100644 --- a/actionmailer/lib/rails/generators/mailer/mailer_generator.rb +++ b/actionmailer/lib/rails/generators/mailer/mailer_generator.rb @@ -1,7 +1,7 @@ module Rails module Generators class MailerGenerator < NamedBase - source_root File.expand_path("../templates", __FILE__) + source_root File.expand_path("templates", __dir__) argument :actions, type: :array, default: [], banner: "method method" diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index a646cbd581..dbfdb07e6e 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -9,7 +9,7 @@ end module Rails def self.root - File.expand_path("../", File.dirname(__FILE__)) + File.expand_path("..", __dir__) end end @@ -28,7 +28,7 @@ ActiveSupport::Deprecation.debug = true # Disable available locale checks to avoid warnings running the test suite. I18n.enforce_available_locales = false -FIXTURE_LOAD_PATH = File.expand_path("fixtures", File.dirname(__FILE__)) +FIXTURE_LOAD_PATH = File.expand_path("fixtures", __dir__) ActionMailer::Base.view_paths = FIXTURE_LOAD_PATH class ActiveSupport::TestCase diff --git a/actionmailer/test/caching_test.rb b/actionmailer/test/caching_test.rb index cff49c8894..e76466439e 100644 --- a/actionmailer/test/caching_test.rb +++ b/actionmailer/test/caching_test.rb @@ -5,7 +5,7 @@ require "mailers/caching_mailer" CACHE_DIR = "test_cache" # Don't change '/../temp/' cavalierly or you might hose something you don't want hosed -FILE_STORE_PATH = File.join(File.dirname(__FILE__), "/../temp/", CACHE_DIR) +FILE_STORE_PATH = File.join(__dir__, "/../temp/", CACHE_DIR) class FragmentCachingMailer < ActionMailer::Base abstract! @@ -21,10 +21,6 @@ class BaseCachingTest < ActiveSupport::TestCase @mailer.perform_caching = true @mailer.cache_store = @store end - - def test_fragment_cache_key - assert_equal "views/what a key", @mailer.fragment_cache_key("what a key") - end end class FragmentCachingTest < BaseCachingTest @@ -126,7 +122,7 @@ class FunctionalFragmentCachingTest < BaseCachingTest assert_match expected_body, email.body.encoded assert_match expected_body, - @store.read("views/caching/#{template_digest("caching_mailer/fragment_cache")}") + @store.read("views/caching_mailer/fragment_cache:#{template_digest("caching_mailer/fragment_cache")}/caching") end def test_fragment_caching_in_partials @@ -135,7 +131,7 @@ class FunctionalFragmentCachingTest < BaseCachingTest assert_match(expected_body, email.body.encoded) assert_match(expected_body, - @store.read("views/caching/#{template_digest("caching_mailer/_partial")}")) + @store.read("views/caching_mailer/_partial:#{template_digest("caching_mailer/_partial")}/caching")) end def test_skip_fragment_cache_digesting @@ -185,7 +181,7 @@ class FunctionalFragmentCachingTest < BaseCachingTest end assert_equal "caching_mailer", payload[:mailer] - assert_equal "views/caching/#{template_digest("caching_mailer/fragment_cache")}", payload[:key] + assert_equal [ :views, "caching_mailer/fragment_cache:#{template_digest("caching_mailer/fragment_cache")}", :caching ], payload[:key] ensure @mailer.enable_fragment_cache_logging = true end diff --git a/actionmailer/test/log_subscriber_test.rb b/actionmailer/test/log_subscriber_test.rb index d864c3acca..799c6144d7 100644 --- a/actionmailer/test/log_subscriber_test.rb +++ b/actionmailer/test/log_subscriber_test.rb @@ -26,7 +26,7 @@ class AMLogSubscriberTest < ActionMailer::TestCase wait assert_equal(1, @logger.logged(:info).size) - assert_match(/Sent mail to system@test.lindsaar.net/, @logger.logged(:info).first) + assert_match(/Sent mail to system@test\.lindsaar\.net/, @logger.logged(:info).first) assert_equal(2, @logger.logged(:debug).size) assert_match(/BaseMailer#welcome: processed outbound mail in [\d.]+ms/, @logger.logged(:debug).first) @@ -36,7 +36,7 @@ class AMLogSubscriberTest < ActionMailer::TestCase end def test_receive_is_notified - fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email") + fixture = File.read(File.expand_path("fixtures/raw_email", __dir__)) TestMailer.receive(fixture) wait assert_equal(1, @logger.logged(:info).size) |