diff options
author | Peter Burkholder <pburkholder@chef.io> | 2015-03-24 09:54:43 -0400 |
---|---|---|
committer | Peter Burkholder <pburkholder@chef.io> | 2015-03-24 09:54:43 -0400 |
commit | b87b474f2cf669b616d2ce037428b101eaae4ffa (patch) | |
tree | c1f8468cc8f9d380ee6210174fba3a9f24062046 | |
parent | 52d059aff7b2cb4178ad8091bb6f1ce9fe093355 (diff) | |
download | chef-b87b474f2cf669b616d2ce037428b101eaae4ffa.tar.gz |
Test for current behavior
-rw-r--r-- | lib/chef/provider/package/rubygems.rb | 6 | ||||
-rw-r--r-- | spec/unit/provider/package/rubygems_spec.rb | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb index 85d666be03..6db32c6d53 100644 --- a/lib/chef/provider/package/rubygems.rb +++ b/lib/chef/provider/package/rubygems.rb @@ -533,10 +533,10 @@ class Chef def install_via_gem_command(name, version) if @new_resource.source =~ /\.gem$/i name = @new_resource.source - elsif source_is_remote? - src = @new_resource.source && " --source=#{@new_resource.source}" +# elsif source_is_remote? +# src = @new_resource.source && " --source=#{@new_resource.source}" else - src = @new_resource.source && " --source=#{@new_resource.source} --source=https://rubygems.org" + src = @new_resource.source && " --source=#{@new_resource.source} --source=https://rubygems.org" end if !version.nil? && version.length > 0 shell_out!("#{gem_binary_path} install #{name} -q --no-rdoc --no-ri -v \"#{version}\"#{src}#{opts}", :env=>nil) diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb index b17c216ddd..b2ec482541 100644 --- a/spec/unit/provider/package/rubygems_spec.rb +++ b/spec/unit/provider/package/rubygems_spec.rb @@ -547,6 +547,15 @@ describe Chef::Provider::Package::Rubygems do expect(@new_resource).to be_updated_by_last_action end + it "installs the gem with rubygems.org as an added source" do + @new_resource.gem_binary('/foo/bar') + @new_resource.source('http://mirror.ops.rhcloud.com/mirror/ruby') + expected ="/foo/bar install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\" --source=#{@new_resource.source} --source=https://rubygems.org" + expect(@provider).to receive(:shell_out!).with(expected, :env => nil) + @provider.run_action(:install) + expect(@new_resource).to be_updated_by_last_action + end + context "when no version is given" do let(:target_version) { nil } |