aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-04-02 02:13:22 +0900
committerGitHub <noreply@github.com>2019-04-02 02:13:22 +0900
commit8901400b2f0d191ff1c8d66821f36081f3c1c7a0 (patch)
treea31d58a4a8f57f6b1d258c34235de7ffb6f78ca6
parente0a9e0259c56700fc83b3e886cdf7c04f6a83495 (diff)
parentdb4c6f5ecbdc2851fe5947fa36725f43cce52280 (diff)
downloadrails-8901400b2f0d191ff1c8d66821f36081f3c1c7a0.tar.gz
rails-8901400b2f0d191ff1c8d66821f36081f3c1c7a0.tar.bz2
rails-8901400b2f0d191ff1c8d66821f36081f3c1c7a0.zip
Merge pull request #35819 from orhantoy/ruby-version-with-final-newline
Include final newline in generated .ruby-version
-rw-r--r--railties/lib/rails/generators/rails/app/templates/ruby-version.tt2
-rw-r--r--railties/test/generators/app_generator_test.rb2
2 files changed, 3 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/ruby-version.tt b/railties/lib/rails/generators/rails/app/templates/ruby-version.tt
index bac1339923..096cfd36a8 100644
--- a/railties/lib/rails/generators/rails/app/templates/ruby-version.tt
+++ b/railties/lib/rails/generators/rails/app/templates/ruby-version.tt
@@ -1 +1 @@
-<%= ENV["RBENV_VERSION"] || ENV["rvm_ruby_string"] || "#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}" -%>
+<%= ENV["RBENV_VERSION"] || ENV["rvm_ruby_string"] || "#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}" %>
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index d5a3599f67..d30cd9e718 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -968,6 +968,8 @@ class AppGeneratorTest < Rails::Generators::TestCase
else
assert_match(/#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}/, content)
end
+
+ assert content.end_with?("\n"), "expected .ruby-version to end with newline"
end
end