summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit')
-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