diff options
-rw-r--r-- | lib/bundler/injector.rb | 5 | ||||
-rw-r--r-- | spec/commands/add_spec.rb | 6 | ||||
-rw-r--r-- | spec/commands/inject_spec.rb | 6 |
3 files changed, 9 insertions, 8 deletions
diff --git a/lib/bundler/injector.rb b/lib/bundler/injector.rb index 11b9fefd76..82474013a2 100644 --- a/lib/bundler/injector.rb +++ b/lib/bundler/injector.rb @@ -76,8 +76,9 @@ module Bundler ", :groups => #{d.groups.inspect}" end end - - source = ", :source => '#{d.source}'" unless d.source.nil? + + source = ", :source => \"#{d.source}\"" unless d.source.nil? + %(gem #{name}#{requirement}#{group}#{source}) end.join("\n") end diff --git a/spec/commands/add_spec.rb b/spec/commands/add_spec.rb index 12a8155ac1..f06c759f81 100644 --- a/spec/commands/add_spec.rb +++ b/spec/commands/add_spec.rb @@ -67,7 +67,7 @@ RSpec.describe "bundle add" do it "adds dependency to more than one group" do bundle "add 'foo' --group='development, test'" - expect(bundled_app("Gemfile").read).to match(/gem "foo", "~> 2.0", :group => \[:development, :test\]/) + expect(bundled_app("Gemfile").read).to match(/gem "foo", "~> 2.0", :groups => \[:development, :test\]/) expect(the_bundle).to include_gems "foo 2.0" end end @@ -75,14 +75,14 @@ RSpec.describe "bundle add" do describe "with --source" do it "adds dependency with specified source" do bundle "add 'foo' --source='file://#{gem_repo2}'" - expect(bundled_app("Gemfile").read).to match(%r{gem "foo", "~> 2.0", :source => 'file:\/\/#{gem_repo2}'}) + expect(bundled_app("Gemfile").read).to match(%r{gem "foo", "~> 2.0", :source => "file:\/\/#{gem_repo2}"}) expect(the_bundle).to include_gems "foo 2.0" end end it "using combination of short form options works like long form" do bundle "add 'foo' -s='file://#{gem_repo2}' -g='development' -v='~>1.0'" - expect(bundled_app("Gemfile").read).to match(%r{gem "foo", "~> 1.0", :group => \[:development\], :source => 'file:\/\/#{gem_repo2}'}) + expect(bundled_app("Gemfile").read).to match(%r{gem "foo", "~> 1.0", :group => \[:development\], :source => "file:\/\/#{gem_repo2}"}) expect(the_bundle).to include_gems "foo 1.1" end diff --git a/spec/commands/inject_spec.rb b/spec/commands/inject_spec.rb index 5c711b32a0..dd0f1348cc 100644 --- a/spec/commands/inject_spec.rb +++ b/spec/commands/inject_spec.rb @@ -56,7 +56,7 @@ Usage: "bundle inject GEM VERSION" it "add gem with source option in gemfile" do bundle "inject 'foo' '>0' --source file://#{gem_repo1}" gemfile = bundled_app("Gemfile").read - str = "gem 'foo', '> 0', :source => 'file://#{gem_repo1}'" + str = "gem \"foo\", \"> 0\", :source => \"file://#{gem_repo1}\"" expect(gemfile).to include str end end @@ -65,14 +65,14 @@ Usage: "bundle inject GEM VERSION" it "add gem with group option in gemfile" do bundle "inject 'rack-obama' '>0' --group=development" gemfile = bundled_app("Gemfile").read - str = "gem 'rack-obama', '> 0', :group => [:development]" + str = "gem \"rack-obama\", \"> 0\", :group => [:development]" expect(gemfile).to include str end it "add gem with multiple groups in gemfile" do bundle "inject 'rack-obama' '>0' --group=development,test" gemfile = bundled_app("Gemfile").read - str = "gem 'rack-obama', '> 0', :groups => [:development, :test]" + str = "gem \"rack-obama\", \"> 0\", :groups => [:development, :test]" expect(gemfile).to include str end end |