提交 5345b61f 编写于 作者: N Nikita Penzin 提交者: Lisa Ugray

Ensure plugin_generator adds to new line in Gemfile

Ensure plugin_generator adds to new line in Gemfile, even if the Gemfile
does not end with an empty line.

[Lisa Ugray, Nikita Penzin]
上级 090eaa7e
......@@ -167,7 +167,7 @@ def gemfile_entry
gemfile_in_app_path = File.join(rails_app_path, "Gemfile")
if File.exist? gemfile_in_app_path
entry = "gem '#{name}', path: '#{relative_path}'"
entry = "\ngem '#{name}', path: '#{relative_path}'"
append_file gemfile_in_app_path, entry
end
end
......
......@@ -530,10 +530,11 @@ def test_creating_plugin_in_app_directory_adds_gemfile_entry
gemfile_path = "#{Rails.root}/Gemfile"
Object.const_set("APP_PATH", Rails.root)
FileUtils.touch gemfile_path
File.write(gemfile_path, "#foo")
run_generator
assert_file gemfile_path, /gem 'bukkits', path: 'tmp\/bukkits'/
assert_file gemfile_path, /^gem 'bukkits', path: 'tmp\/bukkits'/
ensure
Object.send(:remove_const, "APP_PATH")
FileUtils.rm gemfile_path
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册