Skip to content

Commit

Permalink
Test for current behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Burkholder authored and btm committed Mar 27, 2015
1 parent 3f10067 commit 36f040b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/chef/provider/package/rubygems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,10 @@ def gem_binary_path
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)
Expand Down
9 changes: 9 additions & 0 deletions spec/unit/provider/package/rubygems_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,15 @@ def gemspec(name, version)
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 }

Expand Down

0 comments on commit 36f040b

Please sign in to comment.