提交 11fdcf88 编写于 作者: S Sam Granieri 提交者: Joshua Peek

Check for ActionMailer and ActionController before attempting to eager load their view paths

Signed-off-by: NJoshua Peek <josh@joshpeek.com>
上级 a87462af
......@@ -341,8 +341,8 @@ def load_observers
def load_view_paths
ActionView::PathSet::Path.eager_load_templates! if configuration.cache_classes
ActionMailer::Base.template_root.load
ActionController::Base.view_paths.load
ActionMailer::Base.template_root.load if configuration.frameworks.include?(:action_mailer)
ActionController::Base.view_paths.load if configuration.frameworks.include?(:action_controller)
end
# Eager load application classes
......
......@@ -136,8 +136,27 @@ def test_unknown_framework_raises_error
end
end
protected
def test_action_mailer_load_paths_set_only_if_action_mailer_in_use
@config.frameworks = [:action_controller]
initializer = Rails::Initializer.new @config
initializer.send :require_frameworks
assert_nothing_raised NameError do
initializer.send :load_view_paths
end
end
def test_action_controller_load_paths_set_only_if_action_controller_in_use
@config.frameworks = []
initializer = Rails::Initializer.new @config
initializer.send :require_frameworks
assert_nothing_raised NameError do
initializer.send :load_view_paths
end
end
protected
def assert_framework_path(path)
assert @config.framework_paths.include?(path),
"<#{path.inspect}> not found among <#{@config.framework_paths.inspect}>"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册