aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-12-12 13:46:05 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-12-12 13:46:16 -0800
commitb04e2d86df388098c12d2067ac6997e11b9479ad (patch)
tree3f3a9615746142d754e9f846448f9d00481abbf0
parentede647a505fbba459d4e8529646b1f5cb59c1d43 (diff)
downloadrails-b04e2d86df388098c12d2067ac6997e11b9479ad.tar.gz
rails-b04e2d86df388098c12d2067ac6997e11b9479ad.tar.bz2
rails-b04e2d86df388098c12d2067ac6997e11b9479ad.zip
strip whitespace errors from the generated Gemfile
-rw-r--r--railties/lib/rails/generators/app_base.rb2
-rw-r--r--railties/test/generators/app_generator_test.rb10
2 files changed, 11 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index e3d22e81fb..0bd39cb2cd 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -194,7 +194,7 @@ module Rails
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
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index ef9f2b22a7..30fbe74e83 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -124,6 +124,16 @@ class AppGeneratorTest < Rails::Generators::TestCase
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/