summaryrefslogtreecommitdiff
path: root/spec/unit/provider/package
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/provider/package')
-rw-r--r--spec/unit/provider/package/aix_spec.rb6
-rw-r--r--spec/unit/provider/package/apt_spec.rb44
-rw-r--r--spec/unit/provider/package/chocolatey_spec.rb48
-rw-r--r--spec/unit/provider/package/dpkg_spec.rb6
-rw-r--r--spec/unit/provider/package/freebsd/pkg_spec.rb10
-rw-r--r--spec/unit/provider/package/freebsd/pkgng_spec.rb9
-rw-r--r--spec/unit/provider/package/freebsd/port_spec.rb15
-rw-r--r--spec/unit/provider/package/homebrew_spec.rb2
-rw-r--r--spec/unit/provider/package/ips_spec.rb11
-rw-r--r--spec/unit/provider/package/macports_spec.rb2
-rw-r--r--spec/unit/provider/package/openbsd_spec.rb22
-rw-r--r--spec/unit/provider/package/pacman_spec.rb12
-rw-r--r--spec/unit/provider/package/paludis_spec.rb13
-rw-r--r--spec/unit/provider/package/rpm_spec.rb4
-rw-r--r--spec/unit/provider/package/rubygems_spec.rb28
-rw-r--r--spec/unit/provider/package/smartos_spec.rb10
-rw-r--r--spec/unit/provider/package/solaris_spec.rb4
-rw-r--r--spec/unit/provider/package/windows/msi_spec.rb6
-rw-r--r--spec/unit/provider/package/windows_spec.rb10
-rw-r--r--spec/unit/provider/package/yum_spec.rb66
-rw-r--r--spec/unit/provider/package/zypper_spec.rb22
21 files changed, 160 insertions, 190 deletions
diff --git a/spec/unit/provider/package/aix_spec.rb b/spec/unit/provider/package/aix_spec.rb
index b319d87929..6940874a43 100644
--- a/spec/unit/provider/package/aix_spec.rb
+++ b/spec/unit/provider/package/aix_spec.rb
@@ -33,10 +33,10 @@ describe Chef::Provider::Package::Aix do
describe "assessing the current package status" do
before do
- @bffinfo ="/usr/lib/objrepos:samba.base:3.3.12.0::COMMITTED:I:Samba for AIX:
- /etc/objrepos:samba.base:3.3.12.0::COMMITTED:I:Samba for AIX:"
+ @bffinfo = "/usr/lib/objrepos:samba.base:3.3.12.0::COMMITTED:I:Samba for AIX:
+ /etc/objrepos:samba.base:3.3.12.0::COMMITTED:I:Samba for AIX:"
- @empty_status = double("Status", :stdout => "", :exitstatus => 0)
+ @empty_status = double("Status", :stdout => "", :exitstatus => 0)
end
it "should create a current resource with the name of new_resource" do
diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb
index abf128d086..f87c1e86bc 100644
--- a/spec/unit/provider/package/apt_spec.rb
+++ b/spec/unit/provider/package/apt_spec.rb
@@ -34,7 +34,7 @@ describe Chef::Provider::Package::Apt do
@status = double("Status", :exitstatus => 0)
@provider = Chef::Provider::Package::Apt.new(@new_resource, @run_context)
@stdin = StringIO.new
- @stdout =<<-PKG_STATUS
+ @stdout = <<-PKG_STATUS
irssi:
Installed: (none)
Candidate: 0.8.14-1ubuntu4
@@ -43,7 +43,7 @@ irssi:
500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages
PKG_STATUS
@stderr = ""
- @shell_out = OpenStruct.new(:stdout => @stdout,:stdin => @stdin,:stderr => @stderr,:status => @status,:exitstatus => 0)
+ @shell_out = OpenStruct.new(:stdout => @stdout, :stdin => @stdin, :stderr => @stderr, :status => @status, :exitstatus => 0)
@timeout = 900
end
@@ -86,18 +86,18 @@ sudo:
# list of virtual packages: http://www.debian.org/doc/packaging-manuals/virtual-package-names-list.txt
it "should not install the virtual package there is a single provider package and it is installed" do
@new_resource.package_name("libmysqlclient15-dev")
- virtual_package_out=<<-VPKG_STDOUT
+ virtual_package_out = <<-VPKG_STDOUT
libmysqlclient15-dev:
Installed: (none)
Candidate: (none)
Version table:
VPKG_STDOUT
- virtual_package = double(:stdout => virtual_package_out,:exitstatus => 0)
+ virtual_package = double(:stdout => virtual_package_out, :exitstatus => 0)
expect(@provider).to receive(:shell_out!).with(
"apt-cache policy libmysqlclient15-dev",
:timeout => @timeout,
).and_return(virtual_package)
- showpkg_out =<<-SHOWPKG_STDOUT
+ showpkg_out = <<-SHOWPKG_STDOUT
Package: libmysqlclient15-dev
Versions:
@@ -115,12 +115,12 @@ libmysqlclient-dev 5.1.41-3ubuntu12.7
libmysqlclient-dev 5.1.41-3ubuntu12.10
libmysqlclient-dev 5.1.41-3ubuntu12
SHOWPKG_STDOUT
- showpkg = double(:stdout => showpkg_out,:exitstatus => 0)
+ showpkg = double(:stdout => showpkg_out, :exitstatus => 0)
expect(@provider).to receive(:shell_out!).with(
"apt-cache showpkg libmysqlclient15-dev",
:timeout => @timeout,
).and_return(showpkg)
- real_package_out=<<-RPKG_STDOUT
+ real_package_out = <<-RPKG_STDOUT
libmysqlclient-dev:
Installed: 5.1.41-3ubuntu12.10
Candidate: 5.1.41-3ubuntu12.10
@@ -133,7 +133,7 @@ libmysqlclient-dev:
5.1.41-3ubuntu12 0
500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages
RPKG_STDOUT
- real_package = double(:stdout => real_package_out,:exitstatus => 0)
+ real_package = double(:stdout => real_package_out, :exitstatus => 0)
expect(@provider).to receive(:shell_out!).with(
"apt-cache policy libmysqlclient-dev",
:timeout => @timeout,
@@ -143,18 +143,18 @@ libmysqlclient-dev:
it "should raise an exception if you specify a virtual package with multiple provider packages" do
@new_resource.package_name("mp3-decoder")
- virtual_package_out=<<-VPKG_STDOUT
+ virtual_package_out = <<-VPKG_STDOUT
mp3-decoder:
Installed: (none)
Candidate: (none)
Version table:
VPKG_STDOUT
- virtual_package = double(:stdout => virtual_package_out,:exitstatus => 0)
+ virtual_package = double(:stdout => virtual_package_out, :exitstatus => 0)
expect(@provider).to receive(:shell_out!).with(
"apt-cache policy mp3-decoder",
:timeout => @timeout,
).and_return(virtual_package)
- showpkg_out=<<-SHOWPKG_STDOUT
+ showpkg_out = <<-SHOWPKG_STDOUT
Package: mp3-decoder
Versions:
@@ -175,7 +175,7 @@ opencubicplayer 1:0.1.17-2
mpg321 0.2.10.6
mpg123 1.12.1-0ubuntu1
SHOWPKG_STDOUT
- showpkg = double(:stdout => showpkg_out,:exitstatus => 0)
+ showpkg = double(:stdout => showpkg_out, :exitstatus => 0)
expect(@provider).to receive(:shell_out!).with(
"apt-cache showpkg mp3-decoder",
:timeout => @timeout,
@@ -204,7 +204,7 @@ mpg123 1.12.1-0ubuntu1
).and_return(@shell_out)
@provider.load_current_resource
@provider.define_resource_requirements
- expect(@provider).to receive(:shell_out!).with("apt-cache policy irssi", {:timeout=>900}).and_return(@shell_out)
+ expect(@provider).to receive(:shell_out!).with("apt-cache policy irssi", { :timeout => 900 }).and_return(@shell_out)
expect { @provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
end
end
@@ -219,7 +219,7 @@ mpg123 1.12.1-0ubuntu1
it "should run apt-get install with the package name and version" do
expect(@provider).to receive(:shell_out!). with(
"apt-get -q -y install irssi=0.8.12-7",
- :env => { "DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil},
+ :env => { "DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
:timeout => @timeout,
)
@provider.install_package("irssi", "0.8.12-7")
@@ -228,7 +228,7 @@ mpg123 1.12.1-0ubuntu1
it "should run apt-get install with the package name and version and options if specified" do
expect(@provider).to receive(:shell_out!).with(
"apt-get -q -y --force-yes install irssi=0.8.12-7",
- :env => {"DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
+ :env => { "DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
:timeout => @timeout,
)
@new_resource.options("--force-yes")
@@ -244,7 +244,7 @@ mpg123 1.12.1-0ubuntu1
expect(@provider).to receive(:shell_out!).with(
"apt-get -q -y -o APT::Default-Release=lenny-backports install irssi=0.8.12-7",
- :env => {"DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
+ :env => { "DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
:timeout => @timeout,
)
@@ -265,7 +265,7 @@ mpg123 1.12.1-0ubuntu1
it "should run apt-get remove with the package name" do
expect(@provider).to receive(:shell_out!).with(
"apt-get -q -y remove irssi",
- :env => {"DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil},
+ :env => { "DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
:timeout => @timeout,
)
@provider.remove_package("irssi", "0.8.12-7")
@@ -316,7 +316,7 @@ mpg123 1.12.1-0ubuntu1
expect(@provider).to receive(:shell_out!).with(
"debconf-set-selections /tmp/irssi-0.8.12-7.seed",
- :env => {"DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil},
+ :env => { "DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
:timeout => @timeout,
)
@@ -326,7 +326,7 @@ mpg123 1.12.1-0ubuntu1
it "should run debconf-set-selections on the preseed file if it has changed" do
expect(@provider).to receive(:shell_out!).with(
"debconf-set-selections /tmp/irssi-0.8.12-7.seed",
- :env => {"DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil},
+ :env => { "DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
:timeout => @timeout,
)
file = @provider.get_preseed_file("irssi", "0.8.12-7")
@@ -347,7 +347,7 @@ mpg123 1.12.1-0ubuntu1
it "should run dpkg-reconfigure package" do
expect(@provider).to receive(:shell_out!).with(
"dpkg-reconfigure irssi",
- :env => {"DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
+ :env => { "DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
:timeout => @timeout,
)
@provider.reconfig_package("irssi", "0.8.12-7")
@@ -359,7 +359,7 @@ mpg123 1.12.1-0ubuntu1
@provider.is_virtual_package["libmysqlclient-dev"] = true
expect(@provider).to receive(:shell_out!).with(
"apt-get -q -y install libmysqlclient-dev",
- :env => {"DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
+ :env => { "DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
:timeout => @timeout,
)
@provider.install_package("libmysqlclient-dev", "not_a_real_version")
@@ -373,7 +373,7 @@ mpg123 1.12.1-0ubuntu1
@provider.is_virtual_package["irssi"] = false
expect(@provider).to receive(:shell_out!).with(
"apt-get -q -y install libmysqlclient-dev irssi=0.8.12-7",
- :env => {"DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
+ :env => { "DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
:timeout => @timeout,
)
@provider.install_package(["libmysqlclient-dev", "irssi"], ["not_a_real_version", "0.8.12-7"])
diff --git a/spec/unit/provider/package/chocolatey_spec.rb b/spec/unit/provider/package/chocolatey_spec.rb
index d550e55445..aeb420fa7a 100644
--- a/spec/unit/provider/package/chocolatey_spec.rb
+++ b/spec/unit/provider/package/chocolatey_spec.rb
@@ -45,7 +45,7 @@ ConEmu|15.10.25.0
allow(provider).to receive(:choco_install_path).and_return(choco_install_path)
allow(provider).to receive(:choco_exe).and_return(choco_exe)
local_list_obj = double(:stdout => local_list_stdout)
- allow(provider).to receive(:shell_out!).with("#{choco_exe} list -l -r", {:timeout => timeout}).and_return(local_list_obj)
+ allow(provider).to receive(:shell_out!).with("#{choco_exe} list -l -r", { :timeout => timeout }).and_return(local_list_obj)
end
def allow_remote_list(package_names, args = nil)
@@ -57,7 +57,7 @@ Git|2.6.2
munin-node|1.6.1.20130823
EOF
remote_list_obj = double(stdout: remote_list_stdout)
- allow(provider).to receive(:shell_out!).with("#{choco_exe} list -ar #{package_names.join ' '}#{args}", {timeout: timeout}).and_return(remote_list_obj)
+ allow(provider).to receive(:shell_out!).with("#{choco_exe} list -ar #{package_names.join ' '}#{args}", { timeout: timeout }).and_return(remote_list_obj)
end
describe "#initialize" do
@@ -86,7 +86,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["git"])
new_resource.version("2.5.0")
expect(provider.candidate_version).to eql([nil])
- end
+ end
it "should set the candidate_version to nil if there is no candidate" do
allow_remote_list(["vim"])
@@ -132,7 +132,7 @@ munin-node|1.6.1.20130823
it "should load and downcase names in the installed_packages hash" do
provider.load_current_resource
expect(provider.send(:installed_packages)).to eql(
- {"chocolatey"=>"0.9.9.11", "conemu"=>"15.10.25.0"}
+ { "chocolatey" => "0.9.9.11", "conemu" => "15.10.25.0" }
)
end
@@ -140,7 +140,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["git"])
provider.load_current_resource
expect(provider.send(:available_packages)).to eql(
- {"chocolatey"=>"0.9.9.11", "conemu"=>"15.10.25.1", "git"=>"2.6.2", "munin-node" => "1.6.1.20130823"}
+ { "chocolatey" => "0.9.9.11", "conemu" => "15.10.25.1", "git" => "2.6.2", "munin-node" => "1.6.1.20130823" }
)
end
@@ -184,7 +184,7 @@ munin-node|1.6.1.20130823
it "should install a single package" do
allow_remote_list(["git"])
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y git", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y git", { :timeout => timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -195,7 +195,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["git"])
new_resource.timeout(timeout)
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y git", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y git", { :timeout => timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -224,7 +224,7 @@ munin-node|1.6.1.20130823
new_resource.package_name("ConEmu")
new_resource.version("15.10.25.1")
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y -version 15.10.25.1 conemu", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y -version 15.10.25.1 conemu", { :timeout => timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -237,7 +237,7 @@ munin-node|1.6.1.20130823
new_resource.package_name(["chocolatey", "ConEmu"])
new_resource.version([nil, "15.10.25.1"])
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y -version 15.10.25.1 conemu", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y -version 15.10.25.1 conemu", { :timeout => timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -247,7 +247,7 @@ munin-node|1.6.1.20130823
new_resource.package_name("conemu")
new_resource.version("15.10.25.1")
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y -version 15.10.25.1 conemu", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y -version 15.10.25.1 conemu", { :timeout => timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -257,8 +257,8 @@ munin-node|1.6.1.20130823
new_resource.package_name(["ConEmu", "git"])
new_resource.version(["15.10.25.1", nil])
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y -version 15.10.25.1 conemu", {:timeout=>timeout}).and_return(double)
- expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y git", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y -version 15.10.25.1 conemu", { :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y git", { :timeout => timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -267,7 +267,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["git", "munin-node"])
new_resource.package_name(["git", "munin-node"])
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y git munin-node", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y git munin-node", { :timeout => timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -277,7 +277,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["git"], " -source localpackages")
new_resource.source("localpackages")
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y -source localpackages git", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y -source localpackages git", { :timeout => timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -287,7 +287,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["git"])
new_resource.options("-force")
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y -force git", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} install -y -force git", { :timeout => timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -329,7 +329,7 @@ munin-node|1.6.1.20130823
it "should install a package that is not installed" do
allow_remote_list(["git"])
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} upgrade -y git", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} upgrade -y git", { :timeout => timeout }).and_return(double)
provider.run_action(:upgrade)
expect(new_resource).to be_updated_by_last_action
end
@@ -338,7 +338,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["ConEmu"])
new_resource.package_name("ConEmu")
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} upgrade -y conemu", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} upgrade -y conemu", { :timeout => timeout }).and_return(double)
provider.run_action(:upgrade)
expect(new_resource).to be_updated_by_last_action
end
@@ -347,7 +347,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["conemu"])
new_resource.package_name("conemu")
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} upgrade -y conemu", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} upgrade -y conemu", { :timeout => timeout }).and_return(double)
provider.run_action(:upgrade)
expect(new_resource).to be_updated_by_last_action
end
@@ -356,7 +356,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["chocolatey"])
new_resource.package_name("chocolatey")
provider.load_current_resource
- expect(provider).not_to receive(:shell_out!).with("#{choco_exe} upgrade -y chocolatey", {:timeout=>timeout})
+ expect(provider).not_to receive(:shell_out!).with("#{choco_exe} upgrade -y chocolatey", { :timeout => timeout })
provider.run_action(:upgrade)
expect(new_resource).not_to be_updated_by_last_action
end
@@ -365,7 +365,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["git"])
new_resource.version("2.6.2")
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} upgrade -y -version 2.6.2 git", {:timeout=>timeout})
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} upgrade -y -version 2.6.2 git", { :timeout => timeout })
provider.run_action(:upgrade)
expect(new_resource).to be_updated_by_last_action
end
@@ -373,7 +373,7 @@ munin-node|1.6.1.20130823
it "upgrading multiple packages uses a single command" do
allow_remote_list(["conemu", "git"])
new_resource.package_name(["conemu", "git"])
- expect(provider).to receive(:shell_out!).with("#{choco_exe} upgrade -y conemu git", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} upgrade -y conemu git", { :timeout => timeout }).and_return(double)
provider.run_action(:upgrade)
expect(new_resource).to be_updated_by_last_action
end
@@ -425,7 +425,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["ConEmu"])
new_resource.package_name("ConEmu")
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} uninstall -y ConEmu", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} uninstall -y ConEmu", { :timeout => timeout }).and_return(double)
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
@@ -434,7 +434,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["conemu"])
new_resource.package_name("conemu")
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} uninstall -y conemu", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} uninstall -y conemu", { :timeout => timeout }).and_return(double)
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
@@ -444,7 +444,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["git", "conemu"])
new_resource.package_name(["git", "conemu"])
provider.load_current_resource
- expect(provider).to receive(:shell_out!).with("#{choco_exe} uninstall -y conemu", {:timeout=>timeout}).and_return(double)
+ expect(provider).to receive(:shell_out!).with("#{choco_exe} uninstall -y conemu", { :timeout => timeout }).and_return(double)
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
diff --git a/spec/unit/provider/package/dpkg_spec.rb b/spec/unit/provider/package/dpkg_spec.rb
index a249f24793..613f7a326e 100644
--- a/spec/unit/provider/package/dpkg_spec.rb
+++ b/spec/unit/provider/package/dpkg_spec.rb
@@ -52,7 +52,7 @@ Conflicts: wget-ssl
before(:each) do
allow(provider).to receive(:shell_out!).with("dpkg-deb -W #{source}", timeout: 900).and_return(dpkg_deb_status)
- allow(provider).to receive(:shell_out!).with("dpkg -s #{package}", timeout: 900, returns: [0,1]).and_return(double(stdout: "", exitstatus: 1))
+ allow(provider).to receive(:shell_out!).with("dpkg -s #{package}", timeout: 900, returns: [0, 1]).and_return(double(stdout: "", exitstatus: 1))
allow(::File).to receive(:exist?).with(source).and_return(true)
end
@@ -160,12 +160,12 @@ Conflicts: wget-ssl
let(:source) { nil }
it "should raise an exception if the source is not set but we are installing" do
- expect { provider.run_action(:install)}.to raise_error(Chef::Exceptions::Package)
+ expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
end
end
it "should return the current version installed if found by dpkg" do
- allow(provider).to receive(:shell_out!).with("dpkg -s #{package}", timeout: 900, returns: [0,1]).and_return(dpkg_s_status)
+ allow(provider).to receive(:shell_out!).with("dpkg -s #{package}", timeout: 900, returns: [0, 1]).and_return(dpkg_s_status)
provider.load_current_resource
expect(provider.current_resource.version).to eq(["1.11.4-1ubuntu1"])
end
diff --git a/spec/unit/provider/package/freebsd/pkg_spec.rb b/spec/unit/provider/package/freebsd/pkg_spec.rb
index 7c17177bec..8890f62f73 100644
--- a/spec/unit/provider/package/freebsd/pkg_spec.rb
+++ b/spec/unit/provider/package/freebsd/pkg_spec.rb
@@ -77,7 +77,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
it "should return the version number when it is installed" do
pkg_info = OpenStruct.new(:stdout => "zsh-4.3.6_7")
- expect(@provider).to receive(:shell_out!).with('pkg_info -E "zsh*"', env: nil, returns: [0,1], timeout: 900).and_return(pkg_info)
+ expect(@provider).to receive(:shell_out!).with('pkg_info -E "zsh*"', env: nil, returns: [0, 1], timeout: 900).and_return(pkg_info)
#@provider.should_receive(:popen4).with('pkg_info -E "zsh*"').and_yield(@pid, @stdin, ["zsh-4.3.6_7"], @stderr).and_return(@status)
allow(@provider).to receive(:package_name).and_return("zsh")
expect(@provider.current_installed_version).to eq("4.3.6_7")
@@ -85,7 +85,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
it "does not set the current version number when the package is not installed" do
pkg_info = OpenStruct.new(:stdout => "")
- expect(@provider).to receive(:shell_out!).with('pkg_info -E "zsh*"', env: nil, returns: [0,1], timeout: 900).and_return(pkg_info)
+ expect(@provider).to receive(:shell_out!).with('pkg_info -E "zsh*"', env: nil, returns: [0, 1], timeout: 900).and_return(pkg_info)
allow(@provider).to receive(:package_name).and_return("zsh")
expect(@provider.current_installed_version).to be_nil
end
@@ -102,7 +102,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
it "should return the ports candidate version when given a valid port path" do
allow(@provider).to receive(:port_path).and_return("/usr/ports/shells/zsh")
make_v = OpenStruct.new(:stdout => "4.3.6\n", :exitstatus => 0)
- expect(@provider).to receive(:shell_out!).with("make -V PORTVERSION", {cwd: "/usr/ports/shells/zsh", returns: [0, 1], env: nil, timeout: 900}).and_return(make_v)
+ expect(@provider).to receive(:shell_out!).with("make -V PORTVERSION", { cwd: "/usr/ports/shells/zsh", returns: [0, 1], env: nil, timeout: 900 }).and_return(make_v)
expect(@provider.ports_candidate_version).to eq("4.3.6")
end
@@ -110,7 +110,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
allow(::File).to receive(:exist?).with("/usr/ports/Makefile").and_return(true)
allow(@provider).to receive(:port_path).and_return("/usr/ports/shells/zsh")
make_v = OpenStruct.new(:stdout => "zsh-4.3.6_7\n", :exitstatus => 0)
- expect(@provider).to receive(:shell_out!).with("make -V PKGNAME", {cwd: "/usr/ports/shells/zsh", env: nil, returns: [0, 1], timeout: 900}).and_return(make_v)
+ expect(@provider).to receive(:shell_out!).with("make -V PKGNAME", { cwd: "/usr/ports/shells/zsh", env: nil, returns: [0, 1], timeout: 900 }).and_return(make_v)
#@provider.should_receive(:ports_makefile_variable_value).with("PKGNAME").and_return("zsh-4.3.6_7")
expect(@provider.package_name).to eq("zsh")
end
@@ -220,7 +220,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
it "should return the version number when it is installed" do
pkg_info = OpenStruct.new(:stdout => "bonnie++-1.96")
- expect(@provider).to receive(:shell_out!).with('pkg_info -E "bonnie++*"', env: nil, returns: [0,1], timeout: 900).and_return(pkg_info)
+ expect(@provider).to receive(:shell_out!).with('pkg_info -E "bonnie++*"', env: nil, returns: [0, 1], timeout: 900).and_return(pkg_info)
allow(@provider).to receive(:package_name).and_return("bonnie++")
expect(@provider.current_installed_version).to eq("1.96")
end
diff --git a/spec/unit/provider/package/freebsd/pkgng_spec.rb b/spec/unit/provider/package/freebsd/pkgng_spec.rb
index d89bf24eb8..a2bd833d9e 100644
--- a/spec/unit/provider/package/freebsd/pkgng_spec.rb
+++ b/spec/unit/provider/package/freebsd/pkgng_spec.rb
@@ -16,7 +16,6 @@
# limitations under the License.
#
-
require "spec_helper"
require "ostruct"
@@ -30,7 +29,6 @@ describe Chef::Provider::Package::Freebsd::Port do
@provider = Chef::Provider::Package::Freebsd::Pkgng.new(@new_resource, @run_context)
end
-
describe "initialization" do
it "should create a current resource with the name of the new resource" do
expect(@provider.current_resource.is_a?(Chef::Resource::Package)).to be_truthy
@@ -38,7 +36,6 @@ describe Chef::Provider::Package::Freebsd::Port do
end
end
-
describe "loading current resource" do
before(:each) do
allow(@provider).to receive(:current_installed_version)
@@ -63,7 +60,6 @@ describe Chef::Provider::Package::Freebsd::Port do
end
end
-
describe "determining current installed version" do
before(:each) do
allow(@provider).to receive(:supports_pkgng?)
@@ -71,12 +67,11 @@ describe Chef::Provider::Package::Freebsd::Port do
end
it "should query pkg database" do
- expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', env: nil, returns: [0,70], timeout: 900).and_return(@pkg_info)
+ expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', env: nil, returns: [0, 70], timeout: 900).and_return(@pkg_info)
expect(@provider.current_installed_version).to eq("3.1.7")
end
end
-
describe "determining candidate version" do
it "should query repository" do
pkg_query = OpenStruct.new(:stdout => "5.0.5\n", :exitstatus => 0)
@@ -97,7 +92,6 @@ describe Chef::Provider::Package::Freebsd::Port do
end
end
-
describe "installing a binary package" do
before(:each) do
@install_result = OpenStruct.new(:status => true)
@@ -133,7 +127,6 @@ describe Chef::Provider::Package::Freebsd::Port do
end
end
-
describe "removing a binary package" do
before(:each) do
@install_result = OpenStruct.new(:status => true)
diff --git a/spec/unit/provider/package/freebsd/port_spec.rb b/spec/unit/provider/package/freebsd/port_spec.rb
index b12d4eb063..b593da4ff1 100644
--- a/spec/unit/provider/package/freebsd/port_spec.rb
+++ b/spec/unit/provider/package/freebsd/port_spec.rb
@@ -16,7 +16,6 @@
# limitations under the License.
#
-
require "spec_helper"
require "ostruct"
@@ -30,7 +29,6 @@ describe Chef::Provider::Package::Freebsd::Port do
@provider = Chef::Provider::Package::Freebsd::Port.new(@new_resource, @run_context)
end
-
describe "initialization" do
it "should create a current resource with the name of the new resource" do
expect(@provider.current_resource.is_a?(Chef::Resource::Package)).to be_truthy
@@ -38,7 +36,6 @@ describe Chef::Provider::Package::Freebsd::Port do
end
end
-
describe "loading current resource" do
before(:each) do
allow(@provider).to receive(:current_installed_version)
@@ -63,7 +60,6 @@ describe Chef::Provider::Package::Freebsd::Port do
end
end
-
describe "determining current installed version" do
before(:each) do
@pkg_info = OpenStruct.new(:stdout => "zsh-3.1.7\n")
@@ -72,7 +68,7 @@ describe Chef::Provider::Package::Freebsd::Port do
it "should check 'pkg_info' if system uses pkg_* tools" do
allow(@new_resource).to receive(:supports_pkgng?)
expect(@new_resource).to receive(:supports_pkgng?).and_return(false)
- expect(@provider).to receive(:shell_out!).with('pkg_info -E "zsh*"', env: nil, returns: [0,1], timeout: 900).and_return(@pkg_info)
+ expect(@provider).to receive(:shell_out!).with('pkg_info -E "zsh*"', env: nil, returns: [0, 1], timeout: 900).and_return(@pkg_info)
expect(@provider.current_installed_version).to eq("3.1.7")
end
@@ -81,7 +77,7 @@ describe Chef::Provider::Package::Freebsd::Port do
[1000016, 1000000, 901503, 902506, 802511].each do |__freebsd_version|
@node.automatic_attrs[:os_version] = __freebsd_version
expect(@new_resource).to receive(:shell_out!).with("make -V WITH_PKGNG", env: nil).and_return(pkg_enabled)
- expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', env: nil, returns: [0,70], timeout: 900).and_return(@pkg_info)
+ expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', env: nil, returns: [0, 70], timeout: 900).and_return(@pkg_info)
expect(@provider.current_installed_version).to eq("3.1.7")
end
end
@@ -89,7 +85,7 @@ describe Chef::Provider::Package::Freebsd::Port do
it "should check 'pkg info' if the freebsd version is greater than or equal to 1000017" do
__freebsd_version = 1000017
@node.automatic_attrs[:os_version] = __freebsd_version
- expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', env: nil, returns: [0,70], timeout: 900).and_return(@pkg_info)
+ expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', env: nil, returns: [0, 70], timeout: 900).and_return(@pkg_info)
expect(@provider.current_installed_version).to eq("3.1.7")
end
end
@@ -102,7 +98,7 @@ describe Chef::Provider::Package::Freebsd::Port do
it "should return candidate version if port exists" do
allow(::File).to receive(:exist?).with("/usr/ports/Makefile").and_return(true)
allow(@provider).to receive(:port_dir).and_return("/usr/ports/shells/zsh")
- expect(@provider).to receive(:shell_out!).with("make -V PORTVERSION", cwd: "/usr/ports/shells/zsh", env: nil, returns: [0,1], timeout: 900).
+ expect(@provider).to receive(:shell_out!).with("make -V PORTVERSION", cwd: "/usr/ports/shells/zsh", env: nil, returns: [0, 1], timeout: 900).
and_return(@port_version)
expect(@provider.candidate_version).to eq("5.0.5")
end
@@ -113,7 +109,6 @@ describe Chef::Provider::Package::Freebsd::Port do
end
end
-
describe "determining port directory" do
it "should return name if package name is absolute path" do
allow(@provider.new_resource).to receive(:package_name).and_return("/var/ports/shells/zsh")
@@ -138,7 +133,6 @@ describe Chef::Provider::Package::Freebsd::Port do
end
end
-
describe "building a binary package" do
before(:each) do
@install_result = OpenStruct.new(:status => true)
@@ -153,7 +147,6 @@ describe Chef::Provider::Package::Freebsd::Port do
end
end
-
describe "removing a binary package" do
before(:each) do
@install_result = OpenStruct.new(:status => true)
diff --git a/spec/unit/provider/package/homebrew_spec.rb b/spec/unit/provider/package/homebrew_spec.rb
index ab842eea60..17ed5ccc41 100644
--- a/spec/unit/provider/package/homebrew_spec.rb
+++ b/spec/unit/provider/package/homebrew_spec.rb
@@ -22,7 +22,7 @@ describe Chef::Provider::Package::Homebrew do
let(:events) { double("Chef::Events").as_null_object }
let(:run_context) { double("Chef::RunContext", node: node, events: events) }
let(:new_resource) { Chef::Resource::HomebrewPackage.new("emacs") }
- let(:current_resource) { Chef::Resource::HomebrewPackage.new("emacs")}
+ let(:current_resource) { Chef::Resource::HomebrewPackage.new("emacs") }
let(:provider) do
Chef::Provider::Package::Homebrew.new(new_resource, run_context)
diff --git a/spec/unit/provider/package/ips_spec.rb b/spec/unit/provider/package/ips_spec.rb
index 732e42a7bc..f47385da09 100644
--- a/spec/unit/provider/package/ips_spec.rb
+++ b/spec/unit/provider/package/ips_spec.rb
@@ -35,17 +35,16 @@ describe Chef::Provider::Package::Ips do
def local_output
stdin = StringIO.new
stdout = ""
- stderr =<<-PKG_STATUS
+ stderr = <<-PKG_STATUS
pkg: info: no packages matching the following patterns you specified are
installed on the system. Try specifying -r to query remotely:
crypto/gnupg
PKG_STATUS
- return OpenStruct.new(:stdout => stdout,:stdin => stdin,:stderr => stderr,:status => @status,:exitstatus => 1)
+ return OpenStruct.new(:stdout => stdout, :stdin => stdin, :stderr => stderr, :status => @status, :exitstatus => 1)
end
def remote_output
-
stdout = <<-PKG_STATUS
Name: security/sudo
Summary: sudo - authority delegation tool
@@ -58,9 +57,9 @@ Packaging Date: April 1, 2012 05:55:52 PM
Size: 2.57 MB
FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z
PKG_STATUS
- stdin = StringIO.new
- stderr = ""
- return OpenStruct.new(:stdout => stdout,:stdin => stdin,:stderr => stderr,:status => @status,:exitstatus => 0)
+ stdin = StringIO.new
+ stderr = ""
+ return OpenStruct.new(:stdout => stdout, :stdin => stdin, :stderr => stderr, :status => @status, :exitstatus => 0)
end
context "when loading current resource" do
diff --git a/spec/unit/provider/package/macports_spec.rb b/spec/unit/provider/package/macports_spec.rb
index ff9e669aa8..b90cf89047 100644
--- a/spec/unit/provider/package/macports_spec.rb
+++ b/spec/unit/provider/package/macports_spec.rb
@@ -70,7 +70,7 @@ describe Chef::Provider::Package::Macports do
describe "current_installed_version" do
it "should return the current version if the package is installed" do
- stdout = <<EOF
+ stdout = <<EOF
The following ports are currently installed:
openssl @0.9.8k_0 (active)
EOF
diff --git a/spec/unit/provider/package/openbsd_spec.rb b/spec/unit/provider/package/openbsd_spec.rb
index 3a7aab55ac..3e1c1c90b6 100644
--- a/spec/unit/provider/package/openbsd_spec.rb
+++ b/spec/unit/provider/package/openbsd_spec.rb
@@ -23,7 +23,7 @@ describe Chef::Provider::Package::Openbsd do
let(:node) do
node = Chef::Node.new
- node.default["kernel"] = {"name" => "OpenBSD", "release" => "5.5", "machine" => "amd64"}
+ node.default["kernel"] = { "name" => "OpenBSD", "release" => "5.5", "machine" => "amd64" }
node
end
@@ -33,7 +33,7 @@ describe Chef::Provider::Package::Openbsd do
Chef::Provider::Package::Openbsd.new(new_resource, run_context)
end
- let(:new_resource) { Chef::Resource::Package.new(name)}
+ let(:new_resource) { Chef::Resource::Package.new(name) }
before(:each) do
ENV["PKG_PATH"] = nil
@@ -41,7 +41,7 @@ describe Chef::Provider::Package::Openbsd do
describe "install a package" do
let(:name) { "ihavetoes" }
- let(:version) {"0.0"}
+ let(:version) { "0.0" }
context "when not already installed" do
before do
@@ -56,8 +56,8 @@ describe Chef::Provider::Package::Openbsd do
instance_double("shellout", :stdout => "#{name}-#{version}\n"))
expect(provider).to receive(:shell_out!).with(
"pkg_add -r #{name}-#{version}",
- {:env => {"PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/"}, timeout: 900}
- ) {OpenStruct.new :status => true}
+ { :env => { "PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/" }, timeout: 900 }
+ ) { OpenStruct.new :status => true }
provider.run_action(:install)
end
end
@@ -78,7 +78,7 @@ describe Chef::Provider::Package::Openbsd do
context "if a flavor is specified" do
let(:flavor) { "flavora" }
- let(:package_name) {"ihavetoes" }
+ let(:package_name) { "ihavetoes" }
let(:name) { "#{package_name}--#{flavor}" }
context "if no version is specified" do
@@ -88,8 +88,8 @@ describe Chef::Provider::Package::Openbsd do
instance_double("shellout", :stdout => "#{name}-#{version}-#{flavor}\n"))
expect(provider).to receive(:shell_out!).with(
"pkg_add -r #{name}-#{version}-#{flavor}",
- {env: {"PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/"}, timeout: 900}
- ) {OpenStruct.new :status => true}
+ { env: { "PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/" }, timeout: 900 }
+ ) { OpenStruct.new :status => true }
provider.run_action(:install)
end
end
@@ -104,8 +104,8 @@ describe Chef::Provider::Package::Openbsd do
new_resource.version("#{version}-#{flavor_b}")
expect(provider).to receive(:shell_out!).with(
"pkg_add -r #{name}-#{version}-#{flavor_b}",
- {env: {"PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/"}, timeout: 900}
- ) {OpenStruct.new :status => true}
+ { env: { "PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/" }, timeout: 900 }
+ ) { OpenStruct.new :status => true }
provider.run_action(:install)
end
end
@@ -124,7 +124,7 @@ describe Chef::Provider::Package::Openbsd do
it "should run the command to delete the installed package" do
expect(@provider).to receive(:shell_out!).with(
"pkg_delete #{@name}", env: nil, timeout: 900
- ) {OpenStruct.new :status => true}
+ ) { OpenStruct.new :status => true }
@provider.remove_package(@name, nil)
end
end
diff --git a/spec/unit/provider/package/pacman_spec.rb b/spec/unit/provider/package/pacman_spec.rb
index 4d3339767c..ce9107f31b 100644
--- a/spec/unit/provider/package/pacman_spec.rb
+++ b/spec/unit/provider/package/pacman_spec.rb
@@ -51,7 +51,7 @@ ERR
end
it "should run pacman query with the package name" do
- expect(@provider).to receive(:shell_out).with("pacman -Qi #{@new_resource.package_name}", {timeout: 900}).and_return(@status)
+ expect(@provider).to receive(:shell_out).with("pacman -Qi #{@new_resource.package_name}", { timeout: 900 }).and_return(@status)
@provider.load_current_resource
end
@@ -102,7 +102,7 @@ PACMAN
end
it "should use pacman.conf to determine valid repo names for package versions" do
- @pacman_conf = <<-PACMAN_CONF
+ @pacman_conf = <<-PACMAN_CONF
[options]
HoldPkg = pacman glibc
Architecture = auto
@@ -151,12 +151,12 @@ PACMAN_CONF
describe Chef::Provider::Package::Pacman, "install_package" do
it "should run pacman install with the package name and version" do
- expect(@provider).to receive(:shell_out!).with("pacman --sync --noconfirm --noprogressbar nano", {timeout: 900})
+ expect(@provider).to receive(:shell_out!).with("pacman --sync --noconfirm --noprogressbar nano", { timeout: 900 })
@provider.install_package("nano", "1.0")
end
it "should run pacman install with the package name and version and options if specified" do
- expect(@provider).to receive(:shell_out!).with("pacman --sync --noconfirm --noprogressbar --debug nano", {timeout: 900})
+ expect(@provider).to receive(:shell_out!).with("pacman --sync --noconfirm --noprogressbar --debug nano", { timeout: 900 })
allow(@new_resource).to receive(:options).and_return("--debug")
@provider.install_package("nano", "1.0")
@@ -172,12 +172,12 @@ PACMAN_CONF
describe Chef::Provider::Package::Pacman, "remove_package" do
it "should run pacman remove with the package name" do
- expect(@provider).to receive(:shell_out!).with("pacman --remove --noconfirm --noprogressbar nano", {timeout: 900})
+ expect(@provider).to receive(:shell_out!).with("pacman --remove --noconfirm --noprogressbar nano", { timeout: 900 })
@provider.remove_package("nano", "1.0")
end
it "should run pacman remove with the package name and options if specified" do
- expect(@provider).to receive(:shell_out!).with("pacman --remove --noconfirm --noprogressbar --debug nano", {timeout: 900})
+ expect(@provider).to receive(:shell_out!).with("pacman --remove --noconfirm --noprogressbar --debug nano", { timeout: 900 })
allow(@new_resource).to receive(:options).and_return("--debug")
@provider.remove_package("nano", "1.0")
diff --git a/spec/unit/provider/package/paludis_spec.rb b/spec/unit/provider/package/paludis_spec.rb
index 8ca6a881e1..b984aeb83f 100644
--- a/spec/unit/provider/package/paludis_spec.rb
+++ b/spec/unit/provider/package/paludis_spec.rb
@@ -33,7 +33,7 @@ describe Chef::Provider::Package::Paludis do
@stdin = StringIO.new
@stderr = StringIO.new
- @stdout =<<-PKG_STATUS
+ @stdout = <<-PKG_STATUS
group/ntp 0 accounts
group/ntp 0 installed-accounts
net/ntp 4.2.6_p5-r2 arbor
@@ -42,7 +42,7 @@ user/ntp 0 installed-accounts
net/ntp 4.2.6_p5-r1 installed
PKG_STATUS
@pid = 12345
- @shell_out = OpenStruct.new(:stdout => @stdout,:stdin => @stdin,:stderr => @stderr,:status => @status,:exitstatus => 0)
+ @shell_out = OpenStruct.new(:stdout => @stdout, :stdin => @stdin, :stderr => @stderr, :status => @status, :exitstatus => 0)
end
context "when loading current resource" do
@@ -86,13 +86,12 @@ INSTALLED
context "when installing a package" do
it "should run pkg install with the package name and version" do
- expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x \"=net/ntp-4.2.6_p5-r2\"", {:timeout=>@new_resource.timeout})
+ expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x \"=net/ntp-4.2.6_p5-r2\"", { :timeout => @new_resource.timeout })
@provider.install_package("net/ntp", "4.2.6_p5-r2")
end
-
it "should run pkg install with the package name and version and options if specified" do
- expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x --preserve-world \"=net/ntp-4.2.6_p5-r2\"", {:timeout=>@new_resource.timeout})
+ expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x --preserve-world \"=net/ntp-4.2.6_p5-r2\"", { :timeout => @new_resource.timeout })
allow(@new_resource).to receive(:options).and_return("--preserve-world")
@provider.install_package("net/ntp", "4.2.6_p5-r2")
end
@@ -102,7 +101,7 @@ INSTALLED
sys-process/lsof 4.87 arbor
sys-process/lsof 4.87 x86_64
PKG_STATUS
- expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x \"=sys-process/lsof-4.87\"", {:timeout=>@new_resource.timeout})
+ expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x \"=sys-process/lsof-4.87\"", { :timeout => @new_resource.timeout })
@provider.install_package("sys-process/lsof", "4.87")
end
@@ -120,7 +119,7 @@ PKG_STATUS
context "when upgrading a package" do
it "should run pkg install with the package name and version" do
- expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x \"=net/ntp-4.2.6_p5-r2\"", {:timeout=>@new_resource.timeout})
+ expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x \"=net/ntp-4.2.6_p5-r2\"", { :timeout => @new_resource.timeout })
@provider.upgrade_package("net/ntp", "4.2.6_p5-r2")
end
end
diff --git a/spec/unit/provider/package/rpm_spec.rb b/spec/unit/provider/package/rpm_spec.rb
index 2f2c44a5d5..1d179edf76 100644
--- a/spec/unit/provider/package/rpm_spec.rb
+++ b/spec/unit/provider/package/rpm_spec.rb
@@ -116,7 +116,6 @@ describe Chef::Provider::Package::Rpm do
end
end
-
context "when the package is installed" do
let(:rpm_qp_stdout) { "ImageMagick-c++ 6.5.4.7-7.el6_5" }
@@ -237,7 +236,6 @@ describe Chef::Provider::Package::Rpm do
end
end
-
context "when the package name contains a tilde (chef#3503)" do
let(:package_name) { "supermarket" }
@@ -396,7 +394,6 @@ describe Chef::Provider::Package::Rpm do
end
-
end
end
@@ -429,5 +426,4 @@ describe Chef::Provider::Package::Rpm do
end
end
-
end
diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb
index 7f81656eb3..141e2bd383 100644
--- a/spec/unit/provider/package/rubygems_spec.rb
+++ b/spec/unit/provider/package/rubygems_spec.rb
@@ -192,7 +192,7 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do
it "uses the cached result for gem paths when available" do
expect(@gem_env).not_to receive(:shell_out!)
expected = ["/path/to/gems", "/another/path/to/gems"]
- Chef::Provider::Package::Rubygems::AlternateGemEnvironment.gempath_cache["/usr/weird/bin/gem"]= expected
+ Chef::Provider::Package::Rubygems::AlternateGemEnvironment.gempath_cache["/usr/weird/bin/gem"] = expected
expect(@gem_env.gem_paths).to eq(["/path/to/gems", "/another/path/to/gems"])
end
@@ -235,7 +235,7 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do
end
it "detects when the target gem environment is the jruby platform" do
- gem_env_out=<<-JRUBY_GEM_ENV
+ gem_env_out = <<-JRUBY_GEM_ENV
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.6
- RUBY VERSION: 1.8.7 (2010-05-12 patchlevel 249) [java]
@@ -272,12 +272,12 @@ RubyGems Environment:
it "uses the cached result for gem platforms if available" do
expect(@gem_env).not_to receive(:shell_out!)
expected = ["ruby", Gem::Platform.new("universal-java-1.6")]
- Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache["/usr/weird/bin/gem"]= expected
+ Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache["/usr/weird/bin/gem"] = expected
expect(@gem_env.gem_platforms).to eq(expected)
end
it "uses the current gem platforms when the target env is not jruby" do
- gem_env_out=<<-RBX_GEM_ENV
+ gem_env_out = <<-RBX_GEM_ENV
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.6
- RUBY VERSION: 1.8.7 (2010-05-14 patchlevel 174) [x86_64-apple-darwin10.3.0]
@@ -394,10 +394,10 @@ describe Chef::Provider::Package::Rubygems do
end
context "when you try to use a hash of install options" do
- let(:options) { {:fail => :burger } }
+ let(:options) { { :fail => :burger } }
it "smites you" do
- expect {provider}.to raise_error(ArgumentError)
+ expect { provider }.to raise_error(ArgumentError)
end
end
end
@@ -473,8 +473,8 @@ describe Chef::Provider::Package::Rubygems do
expect(provider.current_resource.version).to eq(current_version)
end
- context "if the requested version is not installed" do
- let(:target_version) { "9000.0.2" }
+ context "if the requested version is not installed" do
+ let(:target_version) { "9000.0.2" }
it "sets the current version to the highest installed version if the requested version is not installed" do
expect(provider.current_resource.version).to eq(current_version)
@@ -539,8 +539,8 @@ describe Chef::Provider::Package::Rubygems do
args = [gem_dep]
args << source if source
allow(provider.gem_env).to receive(:candidate_version_from_remote).
- with(*args).
- and_return(version)
+ with(*args).
+ and_return(version)
end
describe "in the current gem environment" do
@@ -594,7 +594,7 @@ describe Chef::Provider::Package::Rubygems do
let(:options) { "-i /alt/install/location" }
it "installs the gem by shelling out when options are provided as a String" do
- expected ="gem install rspec-core -q --no-rdoc --no-ri -v \"#{target_version}\" #{options}"
+ expected = "gem install rspec-core -q --no-rdoc --no-ri -v \"#{target_version}\" #{options}"
expect(provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
@@ -606,7 +606,7 @@ describe Chef::Provider::Package::Rubygems do
let(:gem_binary) { "/foo/bar" }
it "installs the gem with rubygems.org as an added source" do
- expected ="#{gem_binary} install rspec-core -q --no-rdoc --no-ri -v \"#{target_version}\" --source=#{source} --source=https://rubygems.org"
+ expected = "#{gem_binary} install rspec-core -q --no-rdoc --no-ri -v \"#{target_version}\" --source=#{source} --source=https://rubygems.org"
expect(provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
@@ -619,7 +619,7 @@ describe Chef::Provider::Package::Rubygems do
it "installs the gem" do
new_resource.clear_sources(true)
- expected ="#{gem_binary} install rspec-core -q --no-rdoc --no-ri -v \"#{target_version}\" --clear-sources --source=#{source}"
+ expected = "#{gem_binary} install rspec-core -q --no-rdoc --no-ri -v \"#{target_version}\" --clear-sources --source=#{source}"
expect(provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
@@ -631,7 +631,7 @@ describe Chef::Provider::Package::Rubygems do
let(:options) { "-i /alt/install/location" }
it "installs the gem by shelling out when options are provided but no version is given" do
- expected ="gem install rspec-core -q --no-rdoc --no-ri -v \"#{candidate_version}\" #{options}"
+ expected = "gem install rspec-core -q --no-rdoc --no-ri -v \"#{candidate_version}\" #{options}"
expect(provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
diff --git a/spec/unit/provider/package/smartos_spec.rb b/spec/unit/provider/package/smartos_spec.rb
index 6746395dd2..51bffa17b6 100644
--- a/spec/unit/provider/package/smartos_spec.rb
+++ b/spec/unit/provider/package/smartos_spec.rb
@@ -28,7 +28,6 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
@new_resource = Chef::Resource::Package.new("varnish")
@current_resource = Chef::Resource::Package.new("varnish")
-
@status = double("Status", :exitstatus => 0)
@provider = Chef::Provider::Package::SmartOS.new(@new_resource, @run_context)
allow(Chef::Resource::Package).to receive(:new).and_return(@current_resource)
@@ -66,7 +65,6 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
expect(@current_resource.version).to eq(nil)
end
-
end
describe "candidate_version" do
@@ -82,7 +80,7 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
and_yield("something-varnish-1.1.1 something varnish like\n").
and_yield("varnish-2.3.4 actual varnish\n")
@shell_out = double("shell_out!", :stdout => search)
- expect(@provider).to receive(:shell_out!).with("/opt/local/bin/pkgin", "se", "varnish", :env => nil, :returns => [0,1], :timeout=>900).and_return(@shell_out)
+ expect(@provider).to receive(:shell_out!).with("/opt/local/bin/pkgin", "se", "varnish", :env => nil, :returns => [0, 1], :timeout => 900).and_return(@shell_out)
expect(@provider.candidate_version).to eq("2.3.4")
end
@@ -92,7 +90,7 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
and_yield("something-varnish-1.1.1;;something varnish like\n").
and_yield("varnish-2.3.4;;actual varnish\n")
@shell_out = double("shell_out!", :stdout => search)
- expect(@provider).to receive(:shell_out!).with("/opt/local/bin/pkgin", "se", "varnish", :env => nil, :returns => [0,1], :timeout=>900).and_return(@shell_out)
+ expect(@provider).to receive(:shell_out!).with("/opt/local/bin/pkgin", "se", "varnish", :env => nil, :returns => [0, 1], :timeout => 900).and_return(@shell_out)
expect(@provider.candidate_version).to eq("2.3.4")
end
end
@@ -101,8 +99,8 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
it "run pkgin and install the package" do
out = OpenStruct.new(:stdout => nil)
- expect(@provider).to receive(:shell_out!).with("/opt/local/sbin/pkg_info", "-E", "varnish*", {:env => nil, :returns=>[0,1], :timeout=>900}).and_return(@shell_out)
- expect(@provider).to receive(:shell_out!).with("/opt/local/bin/pkgin", "-y", "install", "varnish-2.1.5nb2", {:env=>nil, :timeout=>900}).and_return(out)
+ expect(@provider).to receive(:shell_out!).with("/opt/local/sbin/pkg_info", "-E", "varnish*", { :env => nil, :returns => [0, 1], :timeout => 900 }).and_return(@shell_out)
+ expect(@provider).to receive(:shell_out!).with("/opt/local/bin/pkgin", "-y", "install", "varnish-2.1.5nb2", { :env => nil, :timeout => 900 }).and_return(out)
@provider.load_current_resource
@provider.install_package("varnish", "2.1.5nb2")
end
diff --git a/spec/unit/provider/package/solaris_spec.rb b/spec/unit/provider/package/solaris_spec.rb
index b0a007b0cf..9cc8deeb2a 100644
--- a/spec/unit/provider/package/solaris_spec.rb
+++ b/spec/unit/provider/package/solaris_spec.rb
@@ -32,7 +32,7 @@ describe Chef::Provider::Package::Solaris do
describe "assessing the current package status" do
before do
- @pkginfo =<<-PKGINFO
+ @pkginfo = <<-PKGINFO
PKGINST: SUNWbash
NAME: GNU Bourne-Again shell (bash)
CATEGORY: system
@@ -46,7 +46,7 @@ INSTDATE: Nov 04 2009 01:02
HOTLINE: Please contact your local service provider
PKGINFO
- @status = double("Status",:stdout => "", :exitstatus => 0)
+ @status = double("Status", :stdout => "", :exitstatus => 0)
end
it "should create a current resource with the name of new_resource" do
diff --git a/spec/unit/provider/package/windows/msi_spec.rb b/spec/unit/provider/package/windows/msi_spec.rb
index 22be2d3497..e29508ca7b 100644
--- a/spec/unit/provider/package/windows/msi_spec.rb
+++ b/spec/unit/provider/package/windows/msi_spec.rb
@@ -21,7 +21,7 @@ require "chef/provider/package/windows/msi"
describe Chef::Provider::Package::Windows::MSI do
let(:node) { double("Chef::Node") }
- let(:events) { double("Chef::Events").as_null_object } # mock all the methods
+ let(:events) { double("Chef::Events").as_null_object } # mock all the methods
let(:run_context) { double("Chef::RunContext", :node => node, :events => events) }
let(:package_name) { "calculator" }
let(:resource_source) { "calculator.msi" }
@@ -85,7 +85,7 @@ describe Chef::Provider::Package::Windows::MSI do
context "version is explicitly provided" do
let(:resource_version) { "given_version" }
-
+
it "returns the given version" do
expect(provider.package_version).to eql("given_version")
end
@@ -95,7 +95,7 @@ describe Chef::Provider::Package::Windows::MSI do
before do
allow(::File).to receive(:exist?).with(Chef::Util::PathHelper.canonical_path(resource_source, false)).and_return(false)
end
-
+
it "returns nil" do
expect(provider.package_version).to eql(nil)
end
diff --git a/spec/unit/provider/package/windows_spec.rb b/spec/unit/provider/package/windows_spec.rb
index 948e138ae2..62e40e7b6a 100644
--- a/spec/unit/provider/package/windows_spec.rb
+++ b/spec/unit/provider/package/windows_spec.rb
@@ -27,7 +27,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
end
let(:node) { double("Chef::Node") }
- let(:events) { double("Chef::Events").as_null_object } # mock all the methods
+ let(:events) { double("Chef::Events").as_null_object } # mock all the methods
let(:run_context) { double("Chef::RunContext", :node => node, :events => events) }
let(:resource_source) { "calculator.msi" }
let(:resource_name) { "calculator" }
@@ -327,7 +327,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
new_resource.version("5.5.5")
allow(provider).to receive(:current_version_array).and_return([ ["5.5.5", "4.3.0", "1.1.1"] ])
end
-
+
it "does not install" do
expect(provider).not_to receive(:install_package)
provider.run_action(:install)
@@ -339,7 +339,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
new_resource.version("5.5.5")
allow(provider).to receive(:current_version_array).and_return([ ["5.5.0", "4.3.0", "1.1.1"] ])
end
-
+
it "installs given version" do
expect(provider).to receive(:install_package).with("blah", "5.5.5")
provider.run_action(:install)
@@ -353,7 +353,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
new_resource.version("5.5.5")
allow(provider).to receive(:current_version_array).and_return(["5.5.5"])
end
-
+
it "does not install" do
expect(provider).not_to receive(:install_package)
provider.run_action(:install)
@@ -365,7 +365,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
new_resource.version("5.5.5")
allow(provider).to receive(:current_version_array).and_return(["5.5.0"])
end
-
+
it "installs given version" do
expect(provider).to receive(:install_package).with("blah", "5.5.5")
provider.run_action(:install)
diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb
index f60bcd1405..98fe9551a6 100644
--- a/spec/unit/provider/package/yum_spec.rb
+++ b/spec/unit/provider/package/yum_spec.rb
@@ -258,10 +258,10 @@ describe Chef::Provider::Package::Yum do
@yum_cache = double(
"Chef::Provider::Yum::YumCache"
)
- allow(@yum_cache).to receive(:installed_version) do |package_name, arch|
- # nothing installed for package_name/new_package_name
- nil
- end
+ allow(@yum_cache).to receive(:installed_version) do |package_name, arch|
+ # nothing installed for package_name/new_package_name
+ nil
+ end
allow(@yum_cache).to receive(:candidate_version) do |package_name, arch|
if package_name == "testing.noarch"
nil
@@ -282,13 +282,13 @@ describe Chef::Provider::Package::Yum do
end
it "should flush the cache if :before is true" do
- allow(@new_resource).to receive(:flush_cache).and_return({:after => false, :before => true})
+ allow(@new_resource).to receive(:flush_cache).and_return({ :after => false, :before => true })
expect(@yum_cache).to receive(:reload).once
@provider.load_current_resource
end
it "should flush the cache if :before is false" do
- allow(@new_resource).to receive(:flush_cache).and_return({:after => false, :before => false})
+ allow(@new_resource).to receive(:flush_cache).and_return({ :after => false, :before => false })
expect(@yum_cache).not_to receive(:reload)
@provider.load_current_resource
end
@@ -346,7 +346,6 @@ describe Chef::Provider::Package::Yum do
expect(@new_resource.version).to eq("2.0.1.el5")
end
-
it "should search provides then set version to match if a requirement was passed in the version" do
@new_resource = Chef::Resource::YumPackage.new("test-package")
@new_resource.version("= 2.0.1.el5")
@@ -356,7 +355,6 @@ describe Chef::Provider::Package::Yum do
expect(@new_resource.version).to eq("2.0.1.el5")
end
-
it "should search provides and not set the version to match if a specific version was requested" do
@new_resource = Chef::Resource::YumPackage.new("test-package")
@new_resource.version("3.0.1.el5")
@@ -398,7 +396,7 @@ describe Chef::Provider::Package::Yum do
:disable_extra_repo_control => true,
)
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
- allow(@yum_cache).to receive(:yum_binary=).with("yum")
+ allow(@yum_cache).to receive(:yum_binary=).with("yum")
pkg = Chef::Provider::Package::Yum::RPMPackage.new("test-package", "2.0.1.el5", "x86_64", [])
expect(@yum_cache).to receive(:packages_from_require).and_return([pkg])
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@@ -420,7 +418,7 @@ describe Chef::Provider::Package::Yum do
:disable_extra_repo_control => true,
)
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
- allow(@yum_cache).to receive(:yum_binary=).with("yum")
+ allow(@yum_cache).to receive(:yum_binary=).with("yum")
pkg = Chef::Provider::Package::Yum::RPMPackage.new("test-package", "2.0.1.el5", "x86_64", [])
expect(@yum_cache).to receive(:packages_from_require).and_return([pkg])
@new_resource = Chef::Resource::YumPackage.new("test-package = 2.0.1.el5")
@@ -448,12 +446,12 @@ describe Chef::Provider::Package::Yum do
expect(@yum_cache).to receive(:packages_from_require).exactly(4).times.and_return([])
expect(@yum_cache).to receive(:reload_provides).twice
- @new_resource = Chef::Resource::YumPackage.new(["test-package","test-package2"])
- @new_resource.version(["2.0.1.el5","3.0.1.el5"])
+ @new_resource = Chef::Resource::YumPackage.new(["test-package", "test-package2"])
+ @new_resource.version(["2.0.1.el5", "3.0.1.el5"])
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@provider.load_current_resource
- expect(@new_resource.package_name).to eq(["test-package","test-package2"])
- expect(@new_resource.version).to eq(["2.0.1.el5","3.0.1.el5"])
+ expect(@new_resource.package_name).to eq(["test-package", "test-package2"])
+ expect(@new_resource.version).to eq(["2.0.1.el5", "3.0.1.el5"])
end
it "should search provides if no package is available - if no match in installed provides then load the complete set" do
@@ -656,7 +654,7 @@ describe Chef::Provider::Package::Yum do
end
it "should run yum install then flush the cache if :after is true" do
- allow(@new_resource).to receive(:flush_cache).and_return({:after => true, :before => false})
+ allow(@new_resource).to receive(:flush_cache).and_return({ :after => true, :before => false })
@provider.load_current_resource
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
expect(@provider).to receive(:yum_command).with(
@@ -667,7 +665,7 @@ describe Chef::Provider::Package::Yum do
end
it "should run yum install then not flush the cache if :after is false" do
- allow(@new_resource).to receive(:flush_cache).and_return({:after => false, :before => false})
+ allow(@new_resource).to receive(:flush_cache).and_return({ :after => false, :before => false })
@provider.load_current_resource
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
expect(@provider).to receive(:yum_command).with(
@@ -792,7 +790,7 @@ describe Chef::Provider::Package::Yum do
allow(@provider).to receive(:shell_out).and_return(@status)
expect(@provider).to receive(:shell_out).once.with(
"yum -d0 -e0 -y install emacs-1.0",
- {:timeout => Chef::Config[:yum_timeout]},
+ { :timeout => Chef::Config[:yum_timeout] },
)
@provider.yum_command("-d0 -e0 -y install emacs-1.0")
end
@@ -802,18 +800,18 @@ describe Chef::Provider::Package::Yum do
allow(@provider).to receive(:shell_out).and_return(@status)
expect(@provider).to receive(:shell_out).once.with(
"yum -d0 -e0 -y install emacs-1.0",
- {:timeout => Chef::Config[:yum_timeout]},
+ { :timeout => Chef::Config[:yum_timeout] },
)
expect { @provider.yum_command("-d0 -e0 -y install emacs-1.0") }.to raise_error(Chef::Exceptions::Exec)
end
it "should run yum once if it exits with a return code of 1 and %pre scriptlet failures" do
@status = double("Status", :exitstatus => 1, :stdout => "error: %pre(demo-1-1.el5.centos.x86_64) scriptlet failed, exit status 2",
- :stderr => "")
+ :stderr => "")
allow(@provider).to receive(:shell_out).and_return(@status)
expect(@provider).to receive(:shell_out).once.with(
"yum -d0 -e0 -y install emacs-1.0",
- {:timeout => Chef::Config[:yum_timeout]},
+ { :timeout => Chef::Config[:yum_timeout] },
)
# will still raise an exception, can't stub out the subsequent call
expect { @provider.yum_command("-d0 -e0 -y install emacs-1.0") }.to raise_error(Chef::Exceptions::Exec)
@@ -821,11 +819,11 @@ describe Chef::Provider::Package::Yum do
it "should run yum twice if it exits with a return code of 1 and %post scriptlet failures" do
@status = double("Status", :exitstatus => 1, :stdout => "error: %post(demo-1-1.el5.centos.x86_64) scriptlet failed, exit status 2",
- :stderr => "")
+ :stderr => "")
allow(@provider).to receive(:shell_out).and_return(@status)
expect(@provider).to receive(:shell_out).twice.with(
"yum -d0 -e0 -y install emacs-1.0",
- {:timeout => Chef::Config[:yum_timeout]},
+ { :timeout => Chef::Config[:yum_timeout] },
)
# will still raise an exception, can't stub out the subsequent call
expect { @provider.yum_command("-d0 -e0 -y install emacs-1.0") }.to raise_error(Chef::Exceptions::Exec)
@@ -839,7 +837,7 @@ describe Chef::Provider::Package::Yum do
allow(@provider).to receive(:shell_out).and_return(@status)
expect(@provider).to receive(:shell_out).once.with(
"yum-deprecated -d0 -e0 -y install emacs-1.0",
- {:timeout => Chef::Config[:yum_timeout]},
+ { :timeout => Chef::Config[:yum_timeout] },
)
@provider.yum_command("-d0 -e0 -y install emacs-1.0")
end
@@ -965,7 +963,7 @@ describe Chef::Provider::Package::Yum::RPMUtils do
[ "0.0.1aa", "0.0.1aa", 0 ],
[ "0.0.1a", "0.0.1aa", -1 ],
].each do |x, y, result|
- expect(@rpmutils.rpmvercmp(x,y)).to eq(result)
+ expect(@rpmutils.rpmvercmp(x, y)).to eq(result)
end
end
@@ -984,7 +982,7 @@ describe Chef::Provider::Package::Yum::RPMUtils do
[ "", "", 0 ],
[ "", "1.0.1", -1 ],
].each do |x, y, result|
- expect(@rpmutils.rpmvercmp(x,y)).to eq(result)
+ expect(@rpmutils.rpmvercmp(x, y)).to eq(result)
end
end
@@ -1840,19 +1838,19 @@ EOF
end
it "should return the default python if the yum-executable doesn't start with #!" do
- allow(::File).to receive(:open).with("/usr/bin/yum", "r") { |&b| r = b.call(bin_exe); bin_exe.rewind; r}
+ allow(::File).to receive(:open).with("/usr/bin/yum", "r") { |&b| r = b.call(bin_exe); bin_exe.rewind; r }
expect(@yc.python_bin).to eq("/usr/bin/python")
end
it "should return /usr/bin/python if the interpreter is /bin/bash" do
other = StringIO.new("#!/bin/bash\n# The yum executable redirecting to dnf from dnf-yum compatible package.")
- allow(::File).to receive(:open).with("/usr/bin/yum", "r") { |&b| r = b.call(other); other.rewind; r}
+ allow(::File).to receive(:open).with("/usr/bin/yum", "r") { |&b| r = b.call(other); other.rewind; r }
expect(@yc.python_bin).to eq("/usr/bin/python")
end
it "should return the interpreter for yum" do
other = StringIO.new("#!/usr/bin/super_python\n\nlasjdfdsaljf\nlasdjfs")
- allow(::File).to receive(:open).with("/usr/bin/yum", "r") { |&b| r = b.call(other); other.rewind; r}
+ allow(::File).to receive(:open).with("/usr/bin/yum", "r") { |&b| r = b.call(other); other.rewind; r }
expect(@yc.python_bin).to eq("/usr/bin/super_python")
end
end
@@ -1867,32 +1865,32 @@ EOF
it "should run yum-dump.py using the system python when next_refresh is for :all" do
@yc.reload
- expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --options --installed-provides --yum-lock-timeout 30$}, :timeout=>Chef::Config[:yum_timeout])
+ expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --options --installed-provides --yum-lock-timeout 30$}, :timeout => Chef::Config[:yum_timeout])
@yc.refresh
end
it "should run yum-dump.py with the installed flag when next_refresh is for :installed" do
@yc.reload_installed
- expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --installed --yum-lock-timeout 30$}, :timeout=>Chef::Config[:yum_timeout])
+ expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --installed --yum-lock-timeout 30$}, :timeout => Chef::Config[:yum_timeout])
@yc.refresh
end
it "should run yum-dump.py with the all-provides flag when next_refresh is for :provides" do
@yc.reload_provides
- expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --options --all-provides --yum-lock-timeout 30$}, :timeout=>Chef::Config[:yum_timeout])
+ expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --options --all-provides --yum-lock-timeout 30$}, :timeout => Chef::Config[:yum_timeout])
@yc.refresh
end
it "should pass extra_repo_control args to yum-dump.py" do
@yc.enable_extra_repo_control("--enablerepo=foo --disablerepo=bar")
- expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --options --installed-provides --enablerepo=foo --disablerepo=bar --yum-lock-timeout 30$}, :timeout=>Chef::Config[:yum_timeout])
+ expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --options --installed-provides --enablerepo=foo --disablerepo=bar --yum-lock-timeout 30$}, :timeout => Chef::Config[:yum_timeout])
@yc.refresh
end
it "should pass extra_repo_control args and configured yum lock timeout to yum-dump.py" do
Chef::Config[:yum_lock_timeout] = 999
@yc.enable_extra_repo_control("--enablerepo=foo --disablerepo=bar")
- expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --options --installed-provides --enablerepo=foo --disablerepo=bar --yum-lock-timeout 999$}, :timeout=>Chef::Config[:yum_timeout])
+ expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --options --installed-provides --enablerepo=foo --disablerepo=bar --yum-lock-timeout 999$}, :timeout => Chef::Config[:yum_timeout])
@yc.refresh
end
@@ -1920,7 +1918,7 @@ EOF
it "should raise exception yum-dump.py exits with a non zero status" do
@status = double("Status", :exitstatus => 1, :stdin => @stdin, :stdout => @stdout_no_output, :stderr => @stderr)
allow(@yc).to receive(:shell_out!).and_return(@status)
- expect { @yc.refresh}.to raise_error(Chef::Exceptions::Package, %r{CentOS-Base.repo, line: 12})
+ expect { @yc.refresh }.to raise_error(Chef::Exceptions::Package, %r{CentOS-Base.repo, line: 12})
end
it "should parse type 'i' into an installed state for a package" do
diff --git a/spec/unit/provider/package/zypper_spec.rb b/spec/unit/provider/package/zypper_spec.rb
index f5e2c5e8a5..c998c93d6e 100644
--- a/spec/unit/provider/package/zypper_spec.rb
+++ b/spec/unit/provider/package/zypper_spec.rb
@@ -38,12 +38,12 @@ describe Chef::Provider::Package::Zypper do
allow(provider).to receive(:`).and_return("2.0")
end
- def shell_out_expectation(command, options=nil)
+ def shell_out_expectation(command, options = nil)
options ||= { timeout: 900 }
expect(provider).to receive(:shell_out).with(command, options)
end
- def shell_out_expectation!(command, options=nil)
+ def shell_out_expectation!(command, options = nil)
options ||= { timeout: 900 }
expect(provider).to receive(:shell_out!).with(command, options)
end
@@ -104,8 +104,7 @@ describe Chef::Provider::Package::Zypper do
it "should run zypper install without gpg checks" do
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false)
shell_out_expectation!(
- "zypper --non-interactive --no-gpg-checks install "+
- "--auto-agree-with-licenses emacs=1.0"
+ "zypper --non-interactive --no-gpg-checks install " + "--auto-agree-with-licenses emacs=1.0"
)
provider.install_package(["emacs"], ["1.0"])
end
@@ -114,8 +113,7 @@ describe Chef::Provider::Package::Zypper do
/All packages will be installed without gpg signature checks/
)
shell_out_expectation!(
- "zypper --non-interactive --no-gpg-checks install "+
- "--auto-agree-with-licenses emacs=1.0"
+ "zypper --non-interactive --no-gpg-checks install " + "--auto-agree-with-licenses emacs=1.0"
)
provider.install_package(["emacs"], ["1.0"])
end
@@ -132,8 +130,7 @@ describe Chef::Provider::Package::Zypper do
it "should run zypper update without gpg checks" do
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false)
shell_out_expectation!(
- "zypper --non-interactive --no-gpg-checks install "+
- "--auto-agree-with-licenses emacs=1.0"
+ "zypper --non-interactive --no-gpg-checks install " + "--auto-agree-with-licenses emacs=1.0"
)
provider.upgrade_package(["emacs"], ["1.0"])
end
@@ -142,15 +139,13 @@ describe Chef::Provider::Package::Zypper do
/All packages will be installed without gpg signature checks/
)
shell_out_expectation!(
- "zypper --non-interactive --no-gpg-checks install "+
- "--auto-agree-with-licenses emacs=1.0"
+ "zypper --non-interactive --no-gpg-checks install " + "--auto-agree-with-licenses emacs=1.0"
)
provider.upgrade_package(["emacs"], ["1.0"])
end
it "should run zypper upgrade without gpg checks" do
shell_out_expectation!(
- "zypper --non-interactive --no-gpg-checks install "+
- "--auto-agree-with-licenses emacs=1.0"
+ "zypper --non-interactive --no-gpg-checks install " + "--auto-agree-with-licenses emacs=1.0"
)
provider.upgrade_package(["emacs"], ["1.0"])
end
@@ -257,8 +252,7 @@ describe Chef::Provider::Package::Zypper do
it "should install an array of package names and versions" do
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false)
shell_out_expectation!(
- "zypper --non-interactive --no-gpg-checks install "+
- "--auto-agree-with-licenses emacs=1.0 vim=2.0"
+ "zypper --non-interactive --no-gpg-checks install " + "--auto-agree-with-licenses emacs=1.0 vim=2.0"
)
provider.install_package(["emacs", "vim"], ["1.0", "2.0"])
end