summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPrajakta Purohit <prajakta@opscode.com>2016-04-19 12:37:05 -0700
committerPrajakta Purohit <prajakta@opscode.com>2016-04-21 10:23:35 -0700
commit87c6582638a2357af39e100da8d41aa77d00f083 (patch)
tree4463dd69e7fc9bff74b37cde40a8d0d072557365 /spec
parentb37b683c624ce598643669167dfcbb56086c14ed (diff)
downloadchef-87c6582638a2357af39e100da8d41aa77d00f083.tar.gz
Update rubygems provider to support local install of gems if so specifiedksubrama+praj/FLOW-298/local_gem
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/provider/package/rubygems_spec.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb
index 141e2bd383..6e77e7c112 100644
--- a/spec/unit/provider/package/rubygems_spec.rb
+++ b/spec/unit/provider/package/rubygems_spec.rb
@@ -562,9 +562,10 @@ describe Chef::Provider::Package::Rubygems do
context "when source is a path" do
let(:source) { CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem" }
+ let(:domain) { { domain: :local } }
it "installs the gem from file via the gems api" do
- expect(provider.gem_env).to receive(:install).with(source)
+ expect(provider.gem_env).to receive(:install).with(source, domain)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -572,10 +573,11 @@ describe Chef::Provider::Package::Rubygems do
context "when the gem name is a file path and source is nil" do
let(:gem_name) { CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem" }
+ let(:domain) { { domain: :local } }
it "installs the gem from file via the gems api" do
expect(new_resource.source).to eq(gem_name)
- expect(provider.gem_env).to receive(:install).with(gem_name)
+ expect(provider.gem_env).to receive(:install).with(gem_name, domain)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -693,9 +695,10 @@ describe Chef::Provider::Package::Rubygems do
context "when source is a path" do
let(:source) { CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem" }
let(:target_version) { ">= 0" }
+ let(:domain) { " --local" }
it "installs the gem by shelling out to gem install" do
- expect(provider).to receive(:shell_out!).with("#{gem_binary} install #{source} -q --no-rdoc --no-ri -v \"#{target_version}\"", env: nil, timeout: 900)
+ expect(provider).to receive(:shell_out!).with("#{gem_binary} install #{source} -q --no-rdoc --no-ri -v \"#{target_version}\"#{domain}", env: nil, timeout: 900)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -704,10 +707,11 @@ describe Chef::Provider::Package::Rubygems do
context "when the package is a path and source is nil" do
let(:gem_name) { CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem" }
let(:target_version) { ">= 0" }
+ let(:domain) { " --local" }
it "installs the gem from file by shelling out to gem install when the package is a path and the source is nil" do
expect(new_resource.source).to eq(gem_name)
- expect(provider).to receive(:shell_out!).with("#{gem_binary} install #{gem_name} -q --no-rdoc --no-ri -v \"#{target_version}\"", env: nil, timeout: 900)
+ expect(provider).to receive(:shell_out!).with("#{gem_binary} install #{gem_name} -q --no-rdoc --no-ri -v \"#{target_version}\"#{domain}", env: nil, timeout: 900)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end