提交 fe7038ea 编写于 作者: A Alexey Vakhov

Use new hash syntax for generators gem method

The Gemfile of new application uses ruby 1.9 hashes. Gem method of
generators should use them too. It prevents from mixing two kinds of
syntax in one file.
上级 0638e6bb
......@@ -27,7 +27,7 @@ def gem(*args)
log :gemfile, message
options.each do |option, value|
parts << ":#{option} => #{value.inspect}"
parts << "#{option}: #{value.inspect}"
end
in_root do
......
......@@ -139,7 +139,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 = "gem '#{name}', path: '#{relative_path}'"
append_file gemfile_in_app_path, entry
end
end
......
......@@ -67,6 +67,14 @@ def test_gem_should_insert_on_separate_lines
assert_file 'Gemfile', /^gem "rspec-rails"$/
end
def test_gem_should_include_options
run_generator
action :gem, 'rspec', github: 'dchelimsky/rspec', tag: '1.2.9.rc1'
assert_file 'Gemfile', /gem "rspec", github: "dchelimsky\/rspec", tag: "1\.2\.9\.rc1"/
end
def test_gem_group_should_wrap_gems_in_a_group
run_generator
......
......@@ -279,7 +279,7 @@ def test_creating_plugin_in_app_directory_adds_gemfile_entry
run_generator [destination_root]
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
......@@ -294,7 +294,7 @@ def test_skipping_gemfile_entry
run_generator [destination_root, "--skip-gemfile-entry"]
assert_file gemfile_path do |contents|
assert_no_match(/gem 'bukkits', :path => 'tmp\/bukkits'/, contents)
assert_no_match(/gem 'bukkits', path: 'tmp\/bukkits'/, contents)
end
ensure
Object.send(:remove_const, 'APP_PATH')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册