[rubygems/rubygems] Switch inject to use shorthand hash syntax

https://github.com/rubygems/rubygems/commit/ba5a62fd04
This commit is contained in:
Sean Collins 2025-03-03 20:52:13 -07:00 committed by Hiroshi SHIBATA
parent 8acf0d7bcc
commit 71e340881f
Notes: git 2025-03-10 03:43:59 +00:00
2 changed files with 5 additions and 5 deletions

View File

@ -35,8 +35,8 @@ module Bundler
Bundler.ui.confirm(added.map do |d|
name = "'#{d.name}'"
requirement = ", '#{d.requirement}'"
group = ", :group => #{d.groups.inspect}" if d.groups != Array(:default)
source = ", :source => '#{d.source}'" unless d.source.nil?
group = ", group: #{d.groups.inspect}" if d.groups != Array(:default)
source = ", source: '#{d.source}'" unless d.source.nil?
%(gem #{name}#{requirement}#{group}#{source})
end.join("\n"))
else

View File

@ -55,7 +55,7 @@ Usage: "bundle inject GEM VERSION"
it "add gem with source option in gemfile" do
bundle "inject 'foo' '>0' --source https://gem.repo1"
gemfile = bundled_app_gemfile.read
str = "gem \"foo\", \"> 0\", :source => \"https://gem.repo1\""
str = "gem \"foo\", \"> 0\", source: \"https://gem.repo1\""
expect(gemfile).to include str
end
end
@ -64,14 +64,14 @@ Usage: "bundle inject GEM VERSION"
it "add gem with group option in gemfile" do
bundle "inject 'myrack-obama' '>0' --group=development"
gemfile = bundled_app_gemfile.read
str = "gem \"myrack-obama\", \"> 0\", :group => :development"
str = "gem \"myrack-obama\", \"> 0\", group: :development"
expect(gemfile).to include str
end
it "add gem with multiple groups in gemfile" do
bundle "inject 'myrack-obama' '>0' --group=development,test"
gemfile = bundled_app_gemfile.read
str = "gem \"myrack-obama\", \"> 0\", :groups => [:development, :test]"
str = "gem \"myrack-obama\", \"> 0\", groups: [:development, :test]"
expect(gemfile).to include str
end
end