Permalink
Browse files

Merge pull request #5902 from avakhov/generator-no-indent-blank-lines

Don't indent blank lines in named base generators
  • Loading branch information...
2 parents cd65682 + 6ac9e49 commit 33d80919ff9549c64ef7fc657d70012fd6e22fb0 @josevalim josevalim committed Apr 25, 2012
@@ -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

0 comments on commit 33d8091

Please sign in to comment.