summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Burkholder <pburkholder@chef.io>2015-03-24 09:54:43 -0400
committerBryan McLellan <btm@chef.io>2015-03-27 13:35:42 -0700
commit36f040b73d99f0b5aae5bdab716ffa1aac060266 (patch)
tree3c4a7c6f05cd737518412f7e1350222a0fee388f
parent3f100678176cf81be8f40a6721b6bd4b44135c76 (diff)
downloadchef-36f040b73d99f0b5aae5bdab716ffa1aac060266.tar.gz
Test for current behavior
-rw-r--r--lib/chef/provider/package/rubygems.rb6
-rw-r--r--spec/unit/provider/package/rubygems_spec.rb9
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb
index 1dcd9d23ea..d152db1926 100644
--- a/lib/chef/provider/package/rubygems.rb
+++ b/lib/chef/provider/package/rubygems.rb
@@ -538,10 +538,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 }