提交 7a47690a 编写于 作者: G Guo Xiang Tan

Generate mailer layouts even if no action is given.

上级 35628a44
...@@ -9,7 +9,10 @@ def copy_view_files ...@@ -9,7 +9,10 @@ def copy_view_files
view_base_path = File.join("app/views", class_path, file_name) view_base_path = File.join("app/views", class_path, file_name)
empty_directory view_base_path empty_directory view_base_path
layout_base_path = "app/views/layouts" formats.each do |format|
layout_path = File.join("app/views/layouts", filename_with_extensions("mailer", format))
template filename_with_extensions(:layout, format), layout_path
end
actions.each do |action| actions.each do |action|
@action = action @action = action
...@@ -17,9 +20,6 @@ def copy_view_files ...@@ -17,9 +20,6 @@ def copy_view_files
formats.each do |format| formats.each do |format|
@path = File.join(view_base_path, filename_with_extensions(action, format)) @path = File.join(view_base_path, filename_with_extensions(action, format))
template filename_with_extensions(:view, format), @path template filename_with_extensions(:view, format), @path
layout_path = File.join(layout_base_path, filename_with_extensions("mailer", format))
template filename_with_extensions(:layout, format), layout_path
end end
end end
end end
......
...@@ -113,6 +113,8 @@ def test_invokes_default_html_template_engine ...@@ -113,6 +113,8 @@ def test_invokes_default_html_template_engine
def test_invokes_default_template_engine_even_with_no_action def test_invokes_default_template_engine_even_with_no_action
run_generator ["notifier"] run_generator ["notifier"]
assert_file "app/views/notifier" assert_file "app/views/notifier"
assert_file "app/views/layouts/mailer.text.erb"
assert_file "app/views/layouts/mailer.html.erb"
end end
def test_logs_if_the_template_engine_cannot_be_found def test_logs_if_the_template_engine_cannot_be_found
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册