1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Load AV::Layout to AM::Base in railties

This commit is contained in:
Łukasz Strzałkowski 2013-07-17 15:13:16 +02:00
parent 2a25c4ce6d
commit d1760253f5
5 changed files with 16 additions and 2 deletions

View file

@ -368,8 +368,6 @@ module ActionMailer
include AbstractController::Rendering
include ActionView::Layouts
include AbstractController::Logger
include AbstractController::Helpers
include AbstractController::Translation

View file

@ -13,6 +13,9 @@ require 'action_mailer'
require 'action_mailer/test_case'
require 'mail'
# Emulate AV railtie
ActionMailer::Base.send(:include, ActionView::Layouts)
# Show backtraces for deprecated behavior for quicker cleanup.
ActiveSupport::Deprecation.debug = true

View file

@ -1,4 +1,5 @@
require 'abstract_unit'
require 'action_view'
require 'action_controller'
class I18nTestMailer < ActionMailer::Base
@ -14,6 +15,9 @@ class I18nTestMailer < ActionMailer::Base
end
end
# Emulate AV railtie
ActionController::Base.superclass.send(:include, ActionView::Layouts)
class TestController < ActionController::Base
def send_mail
I18nTestMailer.mail_with_i18n_subject("test@localhost").deliver

View file

@ -8,6 +8,9 @@ require 'abstract_unit'
require 'controller/fake_controllers'
require 'action_mailer'
require 'action_view'
ActionMailer::Base.send(:include, ActionView::Layouts)
ActionMailer::Base.view_paths = FIXTURE_LOAD_PATH
class AssertSelectTest < ActionController::TestCase

View file

@ -41,5 +41,11 @@ module ActionView
ActionController::Base.superclass.send(:include, ActionView::Layouts)
end
end
initializer "action_view.setup_action_mailer" do |app|
ActiveSupport.on_load(:action_mailer) do
ActionMailer::Base.send(:include, ActionView::Layouts)
end
end
end
end