diff options
author | shekharrajak <shekharstudy@ymail.com> | 2017-02-21 11:06:23 +0530 |
---|---|---|
committer | shekharrajak <shekharstudy@ymail.com> | 2017-02-21 14:01:33 +0530 |
commit | 67ee37f4bf17c0c27b112ef650b0a514ae04dd2f (patch) | |
tree | c1b321376e9030680bd44627daf90ccc5ad61852 | |
parent | 069cce3d4bddb4248ba0e6a1de675cd7c2e3f048 (diff) | |
download | bundler-67ee37f4bf17c0c27b112ef650b0a514ae04dd2f.tar.gz |
test cases added
-rw-r--r-- | lib/bundler/cli/inject.rb | 3 | ||||
-rw-r--r-- | spec/commands/inject_spec.rb | 23 |
2 files changed, 24 insertions, 2 deletions
diff --git a/lib/bundler/cli/inject.rb b/lib/bundler/cli/inject.rb index 8f0a26f910..a515a69258 100644 --- a/lib/bundler/cli/inject.rb +++ b/lib/bundler/cli/inject.rb @@ -31,8 +31,7 @@ module Bundler if added.any? Bundler.ui.confirm "Added to Gemfile:" - Bundler.ui.confirm added.map {|g| " #{g}, group => #{g.groups.inspect}, - :source => '#{g.source}'" }.join("\n") + Bundler.ui.confirm added.map {|g| " #{g}, group => #{g.groups.inspect}, :source => '#{g.source}'" }.join("\n") else Bundler.ui.confirm "All gems were already present in the Gemfile" end diff --git a/spec/commands/inject_spec.rb b/spec/commands/inject_spec.rb index dd5e22498b..2a5e8880f0 100644 --- a/spec/commands/inject_spec.rb +++ b/spec/commands/inject_spec.rb @@ -52,6 +52,29 @@ Usage: "bundle inject GEM VERSION" end end + context "use source and group options" do + it "add gem with source in gemfile" do + bundle "inject 'bootstrap' '>0' --source=https://rubygems.org" + gemfile = bundled_app("Gemfile").read + str = "gem 'bootstrap', '> 0', :source => 'https://rubygems.org'" + expect(gemfile).to match(/str/) + end + + it "add gem with group in gemfile" do + bundle "inject 'rack-obama' '>0' --group=development" + gemfile = bundled_app("Gemfile").read + str = "gem 'rack-obama', '> 0', :group => [:development]" + expect(gemfile).to match(/str/) + end + + it "add gem with source and group in gemfile" do + bundle "inject 'rails' '>0' --source=https://rubygems.org --group=development" + gemfile = bundled_app("Gemfile").read + str = "gem 'rails', '> 0', :group => [:development], :source => 'https://rubygems.org'" + expect(gemfile).to match(/str/) + end + end + context "when frozen" do before do bundle "install" |