提交 6ac9e493 编写于 作者: A Alexey Vakhov

Don't indent blank lines in named base generators

上级 cd556c93
......@@ -40,7 +40,7 @@ def module_namespacing(&block)
def indent(content, multiplier = 2)
spaces = " " * multiplier
content = content.each_line.map {|line| "#{spaces}#{line}" }.join
content = content.each_line.map {|line| line.blank? ? line : "#{spaces}#{line}" }.join
end
def wrap_with_namespace(content)
......
......@@ -61,6 +61,14 @@ def test_invokes_default_template_engine_even_with_no_action
run_generator ["account"]
assert_file "app/views/test_app/account"
end
def test_namespaced_controller_dont_indent_blank_lines
run_generator
assert_file "app/controllers/test_app/account_controller.rb"
File.readlines(File.expand_path("app/controllers/test_app/account_controller.rb", destination_root)).each do |line|
assert_no_match line.chomp, /^\s+$/, "Don't indent blank lines"
end
end
end
class NamespacedModelGeneratorTest < NamespacedGeneratorTestCase
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册