Skip to content
Browse files

strip whitespace errors from the generated Gemfile

  • Loading branch information...
1 parent ede647a commit b04e2d86df388098c12d2067ac6997e11b9479ad @tenderlove tenderlove committed Dec 12, 2011
Showing with 11 additions and 1 deletion.
  1. +1 −1 railties/lib/rails/generators/app_base.rb
  2. +10 −0 railties/test/generators/app_generator_test.rb
View
2 railties/lib/rails/generators/app_base.rb
@@ -194,7 +194,7 @@ def ruby_debugger_gemfile_entry
def assets_gemfile_entry
return if options[:skip_sprockets]
- <<-GEMFILE.strip_heredoc
+ <<-GEMFILE.strip_heredoc.gsub(/^[ \t]*$/, '')
# Gems used only for assets and not required
# in production environments by default.
group :assets do
View
10 railties/test/generators/app_generator_test.rb
@@ -124,6 +124,16 @@ def test_application_names_are_not_singularized
assert_file "hats/config/environment.rb", /Hats::Application\.initialize!/
end
+ def test_gemfile_has_no_whitespace_errors
+ run_generator
+ absolute = File.expand_path("Gemfile", destination_root)
+ File.open(absolute, 'r') do |f|
+ f.each_line do |line|
+ assert_no_match /^[ \t]+$/, line
+ end
+ end
+ end
+
def test_config_database_is_added_by_default
run_generator
assert_file "config/database.yml", /sqlite3/

0 comments on commit b04e2d8

Please sign in to comment.
Something went wrong with that request. Please try again.