From 932cbfb56f5719a93907ff12b4bddf177e4c8b7a Mon Sep 17 00:00:00 2001 From: Lucas Efe Date: Thu, 4 Feb 2010 11:16:28 -0300 Subject: [PATCH] Fixing missing newlines after gem and add_source actions. --- railties/lib/rails/generators/actions.rb | 4 ++-- railties/test/generators/actions_test.rb | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index f95b15a..625e683 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -81,7 +81,7 @@ module Rails end in_root do - append_file "Gemfile", "gem #{parts.join(", ")}", :verbose => false + append_file "Gemfile", "gem #{parts.join(", ")}\n", :verbose => false end end @@ -94,7 +94,7 @@ module Rails log :source, source in_root do - prepend_file "Gemfile", "source #{source.inspect}", :verbose => false + prepend_file "Gemfile", "source #{source.inspect}\n", :verbose => false end end diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index cb1fa96..f8837a6 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -75,13 +75,23 @@ class ActionsTest < Rails::Generators::TestCase action :add_source, 'http://gems.github.com' assert_file 'Gemfile', /source "http:\/\/gems\.github\.com"/ end - + def test_add_source_should_append_new_line_character_in_gemfile + run_generator + action :add_source, 'http://gems.github.com' + assert_file 'Gemfile', /source "http:\/\/gems\.github\.com"\n/ + end def test_gem_should_put_gem_dependency_in_gemfile run_generator action :gem, 'will-paginate' assert_file 'Gemfile', /gem "will\-paginate"/ end - + + def test_gem_should_new_line_character_in_gemfile + run_generator + action :gem, 'will-paginate' + assert_file 'Gemfile', /gem "will\-paginate"\Z/ + end + def test_gem_with_options_should_include_all_options_in_gemfile run_generator -- 1.6.4