diff options
Diffstat (limited to 'spec/unit/provider/package')
-rw-r--r-- | spec/unit/provider/package/apt_spec.rb | 162 | ||||
-rw-r--r-- | spec/unit/provider/package/cab_spec.rb | 112 | ||||
-rw-r--r-- | spec/unit/provider/package/chocolatey_spec.rb | 22 | ||||
-rw-r--r-- | spec/unit/provider/package/dpkg_spec.rb | 42 | ||||
-rw-r--r-- | spec/unit/provider/package/ips_spec.rb | 138 | ||||
-rw-r--r-- | spec/unit/provider/package/macports_spec.rb | 6 | ||||
-rw-r--r-- | spec/unit/provider/package/msu_spec.rb | 96 | ||||
-rw-r--r-- | spec/unit/provider/package/pacman_spec.rb | 76 | ||||
-rw-r--r-- | spec/unit/provider/package/paludis_spec.rb | 40 | ||||
-rw-r--r-- | spec/unit/provider/package/portage_spec.rb | 12 | ||||
-rw-r--r-- | spec/unit/provider/package/rubygems_spec.rb | 104 | ||||
-rw-r--r-- | spec/unit/provider/package/solaris_spec.rb | 24 |
12 files changed, 417 insertions, 417 deletions
diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb index 1047534f98..97eda1d774 100644 --- a/spec/unit/provider/package/apt_spec.rb +++ b/spec/unit/provider/package/apt_spec.rb @@ -34,13 +34,13 @@ 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 -irssi: - Installed: (none) - Candidate: 0.8.14-1ubuntu4 - Version table: - 0.8.14-1ubuntu4 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages + @stdout = <<~PKG_STATUS + irssi: + Installed: (none) + Candidate: 0.8.14-1ubuntu4 + Version table: + 0.8.14-1ubuntu4 0 + 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) @@ -65,17 +65,17 @@ irssi: end it "should set the installed version if package has one" do - @stdout.replace(<<-INSTALLED) -sudo: - Installed: 1.7.2p1-1ubuntu5.3 - Candidate: 1.7.2p1-1ubuntu5.3 - Version table: - *** 1.7.2p1-1ubuntu5.3 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages - 500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages - 100 /var/lib/dpkg/status - 1.7.2p1-1ubuntu5 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages + @stdout.replace(<<~INSTALLED) + sudo: + Installed: 1.7.2p1-1ubuntu5.3 + Candidate: 1.7.2p1-1ubuntu5.3 + Version table: + *** 1.7.2p1-1ubuntu5.3 0 + 500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages + 500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages + 100 /var/lib/dpkg/status + 1.7.2p1-1ubuntu5 0 + 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages INSTALLED expect(@provider).to receive(:shell_out_compacted!).and_return(@shell_out) @provider.load_current_resource @@ -86,8 +86,8 @@ sudo: # it is the superclasses responsibility to throw most exceptions it "if the package does not exist in the cache sets installed + candidate version to nil" do @new_resource.package_name("conic-smarms") - policy_out = <<-POLICY_STDOUT -N: Unable to locate package conic-smarms + policy_out = <<~POLICY_STDOUT + N: Unable to locate package conic-smarms POLICY_STDOUT policy = double(stdout: policy_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -95,8 +95,8 @@ N: Unable to locate package conic-smarms env: { "DEBIAN_FRONTEND" => "noninteractive" }, timeout: @timeout ).and_return(policy) - showpkg_out = <<-SHOWPKG_STDOUT -N: Unable to locate package conic-smarms + showpkg_out = <<~SHOWPKG_STDOUT + N: Unable to locate package conic-smarms SHOWPKG_STDOUT showpkg = double(stdout: showpkg_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -111,11 +111,11 @@ N: Unable to locate package conic-smarms # 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 -libmysqlclient15-dev: - Installed: (none) - Candidate: (none) - Version table: + virtual_package_out = <<~VPKG_STDOUT + libmysqlclient15-dev: + Installed: (none) + Candidate: (none) + Version table: VPKG_STDOUT virtual_package = double(stdout: virtual_package_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -123,23 +123,23 @@ libmysqlclient15-dev: env: { "DEBIAN_FRONTEND" => "noninteractive" }, timeout: @timeout ).and_return(virtual_package) - showpkg_out = <<-SHOWPKG_STDOUT -Package: libmysqlclient15-dev -Versions: - -Reverse Depends: - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev -Dependencies: -Provides: -Reverse Provides: -libmysqlclient-dev 5.1.41-3ubuntu12.7 -libmysqlclient-dev 5.1.41-3ubuntu12.10 -libmysqlclient-dev 5.1.41-3ubuntu12 + showpkg_out = <<~SHOWPKG_STDOUT + Package: libmysqlclient15-dev + Versions: + + Reverse Depends: + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + Dependencies: + Provides: + Reverse Provides: + 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) expect(@provider).to receive(:shell_out_compacted!).with( @@ -147,18 +147,18 @@ libmysqlclient-dev 5.1.41-3ubuntu12 env: { "DEBIAN_FRONTEND" => "noninteractive" }, timeout: @timeout ).and_return(showpkg) - real_package_out = <<-RPKG_STDOUT -libmysqlclient-dev: - Installed: 5.1.41-3ubuntu12.10 - Candidate: 5.1.41-3ubuntu12.10 - Version table: - *** 5.1.41-3ubuntu12.10 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages - 100 /var/lib/dpkg/status - 5.1.41-3ubuntu12.7 0 - 500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages - 5.1.41-3ubuntu12 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages + real_package_out = <<~RPKG_STDOUT + libmysqlclient-dev: + Installed: 5.1.41-3ubuntu12.10 + Candidate: 5.1.41-3ubuntu12.10 + Version table: + *** 5.1.41-3ubuntu12.10 0 + 500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages + 100 /var/lib/dpkg/status + 5.1.41-3ubuntu12.7 0 + 500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages + 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) expect(@provider).to receive(:shell_out_compacted!).with( @@ -171,11 +171,11 @@ 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 -mp3-decoder: - Installed: (none) - Candidate: (none) - Version table: + virtual_package_out = <<~VPKG_STDOUT + mp3-decoder: + Installed: (none) + Candidate: (none) + Version table: VPKG_STDOUT virtual_package = double(stdout: virtual_package_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -183,26 +183,26 @@ mp3-decoder: env: { "DEBIAN_FRONTEND" => "noninteractive" }, timeout: @timeout ).and_return(virtual_package) - showpkg_out = <<-SHOWPKG_STDOUT -Package: mp3-decoder -Versions: - -Reverse Depends: - nautilus,mp3-decoder - vux,mp3-decoder - plait,mp3-decoder - ecasound,mp3-decoder - nautilus,mp3-decoder -Dependencies: -Provides: -Reverse Provides: -vlc-nox 1.0.6-1ubuntu1.8 -vlc 1.0.6-1ubuntu1.8 -vlc-nox 1.0.6-1ubuntu1 -vlc 1.0.6-1ubuntu1 -opencubicplayer 1:0.1.17-2 -mpg321 0.2.10.6 -mpg123 1.12.1-0ubuntu1 + showpkg_out = <<~SHOWPKG_STDOUT + Package: mp3-decoder + Versions: + + Reverse Depends: + nautilus,mp3-decoder + vux,mp3-decoder + plait,mp3-decoder + ecasound,mp3-decoder + nautilus,mp3-decoder + Dependencies: + Provides: + Reverse Provides: + vlc-nox 1.0.6-1ubuntu1.8 + vlc 1.0.6-1ubuntu1.8 + vlc-nox 1.0.6-1ubuntu1 + vlc 1.0.6-1ubuntu1 + 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) expect(@provider).to receive(:shell_out_compacted!).with( diff --git a/spec/unit/provider/package/cab_spec.rb b/spec/unit/provider/package/cab_spec.rb index 5c86f781f3..bdfcd06be3 100644 --- a/spec/unit/provider/package/cab_spec.rb +++ b/spec/unit/provider/package/cab_spec.rb @@ -31,20 +31,20 @@ describe Chef::Provider::Package::Cab do end let(:installed_package_list_stdout) do - <<-EOF -Packages listing: -Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 -Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 + <<~EOF + Packages listing: + Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 + Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 EOF end let(:package_version_stdout) do - <<-EOF -Package information: -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -State : Installed -Dependency : Language Pack -The operation completed successfully + <<~EOF + Package information: + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + State : Installed + Dependency : Language Pack + The operation completed successfully EOF end @@ -57,20 +57,20 @@ The operation completed successfully end def allow_package_info(package_path = nil, package_name = nil) - get_package_info_stdout = <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 - -Image Version: 6.1.7600.16385 - -Package information: -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -Applicable : Yes -Copyright : Microsoft Corporation -Company : Microsoft Corporation -State : Installed -Dependency : Language Pack -The operation completed successfully + get_package_info_stdout = <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + + Image Version: 6.1.7600.16385 + + Package information: + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + Applicable : Yes + Copyright : Microsoft Corporation + Company : Microsoft Corporation + State : Installed + Dependency : Language Pack + The operation completed successfully EOF get_package_info_obj = double(stdout: get_package_info_stdout) if package_path @@ -81,30 +81,30 @@ The operation completed successfully end def allow_get_packages - get_packages_stdout = <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 - -Image Version: 6.1.7600.16385 - -Packages listing: - -Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 -State : Installed -Release Type : Language Pack -Install Time : 2/11/2015 11:33 PM - -Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 -State : Installed -Release Type : Language Pack -Install Time : 2/11/2015 11:33 PM - -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -State : Installed -Release Type : Feature Pack -Install Time : 11/21/2010 3:40 AM - -The operation completed successfully. + get_packages_stdout = <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + + Image Version: 6.1.7600.16385 + + Packages listing: + + Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 + State : Installed + Release Type : Language Pack + Install Time : 2/11/2015 11:33 PM + + Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 + State : Installed + Release Type : Language Pack + Install Time : 2/11/2015 11:33 PM + + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + State : Installed + Release Type : Feature Pack + Install Time : 11/21/2010 3:40 AM + + The operation completed successfully. EOF get_packages_obj = double(stdout: get_packages_stdout) allow(provider).to receive(:dism_command).with("/Get-Packages").and_return(get_packages_obj) @@ -248,14 +248,14 @@ The operation completed successfully. context "Invalid package source" do def package_version_stdout - package_version_stdout = <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 -Image Version: 6.1.7600.16385 -An error occurred trying to open - c:\\temp\\test6.1-KB2664825-v3-x64.cab Error: 0x80070003 -Error: 3 -The system cannot find the path specified. -The DISM log file can be found at C:\\Windows\\Logs\\DISM\\dism.log. + package_version_stdout = <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + Image Version: 6.1.7600.16385 + An error occurred trying to open - c:\\temp\\test6.1-KB2664825-v3-x64.cab Error: 0x80070003 + Error: 3 + The system cannot find the path specified. + The DISM log file can be found at C:\\Windows\\Logs\\DISM\\dism.log. EOF end diff --git a/spec/unit/provider/package/chocolatey_spec.rb b/spec/unit/provider/package/chocolatey_spec.rb index 40fca821d9..48f8a562de 100644 --- a/spec/unit/provider/package/chocolatey_spec.rb +++ b/spec/unit/provider/package/chocolatey_spec.rb @@ -35,10 +35,10 @@ describe Chef::Provider::Package::Chocolatey do # installed packages (ConEmu is upgradable) let(:local_list_stdout) do - <<-EOF -Chocolatey v0.9.9.11 -chocolatey|0.9.9.11 -ConEmu|15.10.25.0 + <<~EOF + Chocolatey v0.9.9.11 + chocolatey|0.9.9.11 + ConEmu|15.10.25.0 EOF end @@ -50,13 +50,13 @@ ConEmu|15.10.25.0 end def allow_remote_list(package_names, args = nil) - remote_list_stdout = <<-EOF -Chocolatey v0.9.9.11 -chocolatey|0.9.9.11 -ConEmu|15.10.25.1 -Git|2.6.1 -Git|2.6.2 -munin-node|1.6.1.20130823 + remote_list_stdout = <<~EOF + Chocolatey v0.9.9.11 + chocolatey|0.9.9.11 + ConEmu|15.10.25.1 + Git|2.6.1 + Git|2.6.2 + munin-node|1.6.1.20130823 EOF remote_list_obj = double(stdout: remote_list_stdout) package_names.each do |pkg| diff --git a/spec/unit/provider/package/dpkg_spec.rb b/spec/unit/provider/package/dpkg_spec.rb index cf8f5097f0..9df19f0f1b 100644 --- a/spec/unit/provider/package/dpkg_spec.rb +++ b/spec/unit/provider/package/dpkg_spec.rb @@ -34,18 +34,18 @@ describe Chef::Provider::Package::Dpkg do let(:dpkg_deb_status) { status = double(stdout: "#{package}\t#{dpkg_deb_version}", exitstatus: 0) } let(:dpkg_s_version) { "1.11.4-1ubuntu1" } let(:dpkg_s_status) do - stdout = <<-DPKG_S -Package: #{package} -Status: install ok installed -Priority: important -Section: web -Installed-Size: 1944 -Maintainer: Ubuntu Core developers <ubuntu-devel-discuss@lists.ubuntu.com> -Architecture: amd64 -Version: #{dpkg_s_version} -Config-Version: #{dpkg_s_version} -Depends: libc6 (>= 2.8~20080505), libssl0.9.8 (>= 0.9.8f-5) -Conflicts: wget-ssl + stdout = <<~DPKG_S + Package: #{package} + Status: install ok installed + Priority: important + Section: web + Installed-Size: 1944 + Maintainer: Ubuntu Core developers <ubuntu-devel-discuss@lists.ubuntu.com> + Architecture: amd64 + Version: #{dpkg_s_version} + Config-Version: #{dpkg_s_version} + Depends: libc6 (>= 2.8~20080505), libssl0.9.8 (>= 0.9.8f-5) + Conflicts: wget-ssl DPKG_S status = double(stdout: stdout, exitstatus: 1) end @@ -172,10 +172,10 @@ Conflicts: wget-ssl it "on new debian/ubuntu we get an exit(1) and no stdout from dpkg -s for uninstalled" do dpkg_s_status = double( - exitstatus: 1, stdout: "", stderr: <<-EOF -dpkg-query: package '#{package}' is not installed and no information is available -Use dpkg --info (= dpkg-deb --info) to examine archive files, -and dpkg --contents (= dpkg-deb --contents) to list their contents. + exitstatus: 1, stdout: "", stderr: <<~EOF + dpkg-query: package '#{package}' is not installed and no information is available + Use dpkg --info (= dpkg-deb --info) to examine archive files, + and dpkg --contents (= dpkg-deb --contents) to list their contents. EOF ) expect(provider).to receive(:shell_out_compacted!).with("dpkg", "-s", package, returns: [0, 1], timeout: 900).and_return(dpkg_s_status) @@ -185,11 +185,11 @@ and dpkg --contents (= dpkg-deb --contents) to list their contents. it "on old debian/ubuntu we get an exit(0) and we get info on stdout from dpkg -s for uninstalled" do dpkg_s_status = double( - exitstatus: 0, stderr: "", stdout: <<-EOF -Package: #{package} -Status: unknown ok not-installed -Priority: extra -Section: ruby + exitstatus: 0, stderr: "", stdout: <<~EOF + Package: #{package} + Status: unknown ok not-installed + Priority: extra + Section: ruby EOF ) expect(provider).to receive(:shell_out_compacted!).with("dpkg", "-s", package, returns: [0, 1], timeout: 900).and_return(dpkg_s_status) diff --git a/spec/unit/provider/package/ips_spec.rb b/spec/unit/provider/package/ips_spec.rb index 46f0c72399..b5fb05f7ec 100644 --- a/spec/unit/provider/package/ips_spec.rb +++ b/spec/unit/provider/package/ips_spec.rb @@ -35,27 +35,27 @@ describe Chef::Provider::Package::Ips do def local_output stdin = StringIO.new stdout = "" - 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 + 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 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 - State: Not Installed - Publisher: omnios - Version: 1.8.4.1 (1.8.4p1) - Build Release: 5.11 - Branch: 0.151002 -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 + stdout = <<~PKG_STATUS + Name: security/sudo + Summary: sudo - authority delegation tool + State: Not Installed + Publisher: omnios + Version: 1.8.4.1 (1.8.4p1) + Build Release: 5.11 + Branch: 0.151002 + 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 = "" @@ -92,20 +92,20 @@ PKG_STATUS it "should set the installed version if package has one" do local = local_output - local.stdout = <<-INSTALLED - Name: crypto/gnupg - Summary: GNU Privacy Guard - Description: A complete and free implementation of the OpenPGP Standard as - defined by RFC4880. - Category: Applications/System Utilities - State: Installed - Publisher: solaris - Version: 2.0.17 - Build Release: 5.11 - Branch: 0.175.0.0.0.2.537 -Packaging Date: October 19, 2011 09:14:50 AM - Size: 8.07 MB - FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z + local.stdout = <<~INSTALLED + Name: crypto/gnupg + Summary: GNU Privacy Guard + Description: A complete and free implementation of the OpenPGP Standard as + defined by RFC4880. + Category: Applications/System Utilities + State: Installed + Publisher: solaris + Version: 2.0.17 + Build Release: 5.11 + Branch: 0.175.0.0.0.2.537 + Packaging Date: October 19, 2011 09:14:50 AM + Size: 8.07 MB + FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z INSTALLED expect(@provider).to receive(:shell_out_compacted).with("pkg", "info", @new_resource.package_name, timeout: 900).and_return(local) expect(@provider).to receive(:shell_out_compacted!).with("pkg", "info", "-r", @new_resource.package_name, timeout: 900).and_return(remote_output) @@ -140,17 +140,17 @@ INSTALLED it "should not include the human-readable version in the candidate_version" do remote = remote_output - remote.stdout = <<-PKG_STATUS - Name: security/sudo - Summary: sudo - authority delegation tool - State: Not Installed - Publisher: omnios - Version: 1.8.4.1 (1.8.4p1) - Build Release: 5.11 - Branch: 0.151002 -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 + remote.stdout = <<~PKG_STATUS + Name: security/sudo + Summary: sudo - authority delegation tool + State: Not Installed + Publisher: omnios + Version: 1.8.4.1 (1.8.4p1) + Build Release: 5.11 + Branch: 0.151002 + 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 expect(@provider).to receive(:shell_out_compacted).with("pkg", "info", @new_resource.package_name, timeout: 900).and_return(local_output) expect(@provider).to receive(:shell_out_compacted!).with("pkg", "info", "-r", @new_resource.package_name, timeout: 900).and_return(remote) @@ -161,36 +161,36 @@ PKG_STATUS it "should not upgrade the package if it is already installed" do local = local_output - local.stdout = <<-INSTALLED - Name: crypto/gnupg - Summary: GNU Privacy Guard - Description: A complete and free implementation of the OpenPGP Standard as - defined by RFC4880. - Category: Applications/System Utilities - State: Installed - Publisher: solaris - Version: 2.0.17 - Build Release: 5.11 - Branch: 0.175.0.0.0.2.537 -Packaging Date: October 19, 2011 09:14:50 AM - Size: 8.07 MB - FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z + local.stdout = <<~INSTALLED + Name: crypto/gnupg + Summary: GNU Privacy Guard + Description: A complete and free implementation of the OpenPGP Standard as + defined by RFC4880. + Category: Applications/System Utilities + State: Installed + Publisher: solaris + Version: 2.0.17 + Build Release: 5.11 + Branch: 0.175.0.0.0.2.537 + Packaging Date: October 19, 2011 09:14:50 AM + Size: 8.07 MB + FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z INSTALLED remote = remote_output - remote.stdout = <<-REMOTE - Name: crypto/gnupg - Summary: GNU Privacy Guard - Description: A complete and free implementation of the OpenPGP Standard as - defined by RFC4880. - Category: Applications/System Utilities - State: Not Installed - Publisher: solaris - Version: 2.0.18 - Build Release: 5.11 - Branch: 0.175.0.0.0.2.537 -Packaging Date: October 19, 2011 09:14:50 AM - Size: 8.07 MB - FMRI: pkg://solaris/crypto/gnupg@2.0.18,5.11-0.175.0.0.0.2.537:20111019T091450Z + remote.stdout = <<~REMOTE + Name: crypto/gnupg + Summary: GNU Privacy Guard + Description: A complete and free implementation of the OpenPGP Standard as + defined by RFC4880. + Category: Applications/System Utilities + State: Not Installed + Publisher: solaris + Version: 2.0.18 + Build Release: 5.11 + Branch: 0.175.0.0.0.2.537 + Packaging Date: October 19, 2011 09:14:50 AM + Size: 8.07 MB + FMRI: pkg://solaris/crypto/gnupg@2.0.18,5.11-0.175.0.0.0.2.537:20111019T091450Z REMOTE expect(@provider).to receive(:shell_out_compacted).with("pkg", "info", @new_resource.package_name, timeout: 900).and_return(local) diff --git a/spec/unit/provider/package/macports_spec.rb b/spec/unit/provider/package/macports_spec.rb index 54c5340d72..8b75e40d72 100644 --- a/spec/unit/provider/package/macports_spec.rb +++ b/spec/unit/provider/package/macports_spec.rb @@ -70,9 +70,9 @@ 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 -The following ports are currently installed: - openssl @0.9.8k_0 (active) + stdout = <<~EOF + The following ports are currently installed: + openssl @0.9.8k_0 (active) EOF status = double(stdout: stdout, exitstatus: 0) diff --git a/spec/unit/provider/package/msu_spec.rb b/spec/unit/provider/package/msu_spec.rb index de805fcb39..49b723e572 100644 --- a/spec/unit/provider/package/msu_spec.rb +++ b/spec/unit/provider/package/msu_spec.rb @@ -31,66 +31,66 @@ describe Chef::Provider::Package::Msu, :windows_only do end let(:installed_package_list_stdout) do - <<-EOF -Packages listing: -Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 -Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 + <<~EOF + Packages listing: + Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 + Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 EOF end let(:package_version_stdout) do - <<-EOF -Package information: -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -State : Installed -Dependency : Language Pack -The operation completed successfully + <<~EOF + Package information: + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + State : Installed + Dependency : Language Pack + The operation completed successfully EOF end let(:get_package_info_stdout) do - <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 - -Image Version: 6.1.7600.16385 - -Package information: -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -Applicable : Yes -Copyright : Microsoft Corporation -Company : Microsoft Corporation -State : Installed -Dependency : Language Pack -The operation completed successfully + <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + + Image Version: 6.1.7600.16385 + + Package information: + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + Applicable : Yes + Copyright : Microsoft Corporation + Company : Microsoft Corporation + State : Installed + Dependency : Language Pack + The operation completed successfully EOF end def allow_get_packages - get_packages_stdout = <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 - -Image Version: 6.1.7600.16385 - -Packages listing: - -Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 -State : Installed -Release Type : Language Pack -Install Time : 2/11/2015 11:33 PM - -Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 -State : Installed -Release Type : Language Pack -Install Time : 2/11/2015 11:33 PM - -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -State : Installed -Release Type : Feature Pack -Install Time : 11/21/2010 3:40 AM - -The operation completed successfully. + get_packages_stdout = <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + + Image Version: 6.1.7600.16385 + + Packages listing: + + Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 + State : Installed + Release Type : Language Pack + Install Time : 2/11/2015 11:33 PM + + Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 + State : Installed + Release Type : Language Pack + Install Time : 2/11/2015 11:33 PM + + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + State : Installed + Release Type : Feature Pack + Install Time : 11/21/2010 3:40 AM + + The operation completed successfully. EOF get_packages_obj = double(stdout: get_packages_stdout) allow_any_instance_of(Chef::Provider::Package::Cab).to receive(:dism_command).with("/Get-Packages").and_return(get_packages_obj) diff --git a/spec/unit/provider/package/pacman_spec.rb b/spec/unit/provider/package/pacman_spec.rb index 9fbba202f5..a07c3b236d 100644 --- a/spec/unit/provider/package/pacman_spec.rb +++ b/spec/unit/provider/package/pacman_spec.rb @@ -32,8 +32,8 @@ describe Chef::Provider::Package::Pacman do allow(@provider).to receive(:shell_out_compacted).and_return(@status) @stdin = StringIO.new - @stdout = StringIO.new(<<-ERR) -error: package "nano" not found + @stdout = StringIO.new(<<~ERR) + error: package "nano" not found ERR @stderr = StringIO.new @pid = 2342 @@ -66,26 +66,26 @@ ERR end it "should set the installed version if pacman has one" do - stdout = <<-PACMAN -Name : nano -Version : 2.2.2-1 -URL : http://www.nano-editor.org -Licenses : GPL -Groups : base -Provides : None -Depends On : glibc ncurses -Optional Deps : None -Required By : None -Conflicts With : None -Replaces : None -Installed Size : 1496.00 K -Packager : Andreas Radke <andyrtr@archlinux.org> -Architecture : i686 -Build Date : Mon 18 Jan 2010 06:16:16 PM CET -Install Date : Mon 01 Feb 2010 10:06:30 PM CET -Install Reason : Explicitly installed -Install Script : Yes -Description : Pico editor clone with enhancements + stdout = <<~PACMAN + Name : nano + Version : 2.2.2-1 + URL : http://www.nano-editor.org + Licenses : GPL + Groups : base + Provides : None + Depends On : glibc ncurses + Optional Deps : None + Required By : None + Conflicts With : None + Replaces : None + Installed Size : 1496.00 K + Packager : Andreas Radke <andyrtr@archlinux.org> + Architecture : i686 + Build Date : Mon 18 Jan 2010 06:16:16 PM CET + Install Date : Mon 01 Feb 2010 10:06:30 PM CET + Install Reason : Explicitly installed + Install Script : Yes + Description : Pico editor clone with enhancements PACMAN status = double(stdout: stdout, exitstatus: 0) @@ -102,22 +102,22 @@ PACMAN end it "should use pacman.conf to determine valid repo names for package versions" do - @pacman_conf = <<-PACMAN_CONF -[options] -HoldPkg = pacman glibc -Architecture = auto - -[customrepo] -Server = https://my.custom.repo - -[core] -Include = /etc/pacman.d/mirrorlist - -[extra] -Include = /etc/pacman.d/mirrorlist - -[community] -Include = /etc/pacman.d/mirrorlist + @pacman_conf = <<~PACMAN_CONF + [options] + HoldPkg = pacman glibc + Architecture = auto + + [customrepo] + Server = https://my.custom.repo + + [core] + Include = /etc/pacman.d/mirrorlist + + [extra] + Include = /etc/pacman.d/mirrorlist + + [community] + Include = /etc/pacman.d/mirrorlist PACMAN_CONF status = double(stdout: "customrepo nano 1.2.3-4", exitstatus: 0) diff --git a/spec/unit/provider/package/paludis_spec.rb b/spec/unit/provider/package/paludis_spec.rb index a9ae5bf9d3..10c0d0f7e8 100644 --- a/spec/unit/provider/package/paludis_spec.rb +++ b/spec/unit/provider/package/paludis_spec.rb @@ -33,13 +33,13 @@ describe Chef::Provider::Package::Paludis do @stdin = StringIO.new @stderr = StringIO.new - @stdout = <<-PKG_STATUS -group/ntp 0 accounts -group/ntp 0 installed-accounts -net/ntp 4.2.6_p5-r2 arbor -user/ntp 0 accounts -user/ntp 0 installed-accounts -net/ntp 4.2.6_p5-r1 installed + @stdout = <<~PKG_STATUS + group/ntp 0 accounts + group/ntp 0 installed-accounts + net/ntp 4.2.6_p5-r2 arbor + user/ntp 0 accounts + 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) @@ -64,13 +64,13 @@ PKG_STATUS end it "should return new version if package is installed" do - @stdout.replace(<<-INSTALLED) -group/ntp 0 accounts -group/ntp 0 installed-accounts -net/ntp 4.2.6_p5-r2 arbor -user/ntp 0 accounts -user/ntp 0 installed-accounts -net/ntp 4.2.6_p5-r1 installed + @stdout.replace(<<~INSTALLED) + group/ntp 0 accounts + group/ntp 0 installed-accounts + net/ntp 4.2.6_p5-r2 arbor + user/ntp 0 accounts + user/ntp 0 installed-accounts + net/ntp 4.2.6_p5-r1 installed INSTALLED expect(@provider).to receive(:shell_out_compacted!).and_return(@shell_out) @provider.load_current_resource @@ -97,18 +97,18 @@ INSTALLED end it "should not contain invalid characters for the version string" do - @stdout.replace(<<-PKG_STATUS) -sys-process/lsof 4.87 arbor -sys-process/lsof 4.87 x86_64 + @stdout.replace(<<~PKG_STATUS) + sys-process/lsof 4.87 arbor + sys-process/lsof 4.87 x86_64 PKG_STATUS expect(@provider).to receive(:shell_out_compacted!).with("cave", "-L", "warning", "resolve", "-x", "=sys-process/lsof-4.87", { timeout: @new_resource.timeout || 900 }) @provider.install_package("sys-process/lsof", "4.87") end it "should not include the human-readable version in the candidate_version" do - @stdout.replace(<<-PKG_STATUS) -sys-process/lsof 4.87 arbor -sys-process/lsof 4.87 x86_64 + @stdout.replace(<<~PKG_STATUS) + sys-process/lsof 4.87 arbor + sys-process/lsof 4.87 x86_64 PKG_STATUS expect(@provider).to receive(:shell_out_compacted!).and_return(@shell_out) @provider.load_current_resource diff --git a/spec/unit/provider/package/portage_spec.rb b/spec/unit/provider/package/portage_spec.rb index 889053e826..08d80d3a7d 100644 --- a/spec/unit/provider/package/portage_spec.rb +++ b/spec/unit/provider/package/portage_spec.rb @@ -132,12 +132,12 @@ describe Chef::Provider::Package::Portage, "load_current_resource" do end it "should throw an exception if a category is not specified and there are duplicates" do - stderr_output = <<EOF -You specified an unqualified atom that matched multiple packages: -* app-misc/sphinx -* dev-python/sphinx - -Please use a more specific atom. + stderr_output = <<~EOF + You specified an unqualified atom that matched multiple packages: + * app-misc/sphinx + * dev-python/sphinx + + Please use a more specific atom. EOF status = double(stdout: "", stderr: stderr_output, exitstatus: 1) @provider = Chef::Provider::Package::Portage.new(@new_resource_without_category, @run_context) diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb index 3b1a13e49c..6b33ab97f9 100644 --- a/spec/unit/provider/package/rubygems_spec.rb +++ b/spec/unit/provider/package/rubygems_spec.rb @@ -253,32 +253,32 @@ 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 -RubyGems Environment: - - RUBYGEMS VERSION: 1.3.6 - - RUBY VERSION: 1.8.7 (2010-05-12 patchlevel 249) [java] - - INSTALLATION DIRECTORY: /Users/you/.rvm/gems/jruby-1.5.0 - - RUBY EXECUTABLE: /Users/you/.rvm/rubies/jruby-1.5.0/bin/jruby - - EXECUTABLE DIRECTORY: /Users/you/.rvm/gems/jruby-1.5.0/bin - - RUBYGEMS PLATFORMS: - - ruby - - universal-java-1.6 - - GEM PATHS: - - /Users/you/.rvm/gems/jruby-1.5.0 - - /Users/you/.rvm/gems/jruby-1.5.0@global - - GEM CONFIGURATION: - - :update_sources => true - - :verbose => true - - :benchmark => false - - :backtrace => false - - :bulk_threshold => 1000 - - "install" => "--env-shebang" - - "update" => "--env-shebang" - - "gem" => "--no-rdoc --no-ri" - - :sources => ["https://rubygems.org/", "http://gems.github.com/"] - - REMOTE SOURCES: - - https://rubygems.org/ - - http://gems.github.com/ + gem_env_out = <<~JRUBY_GEM_ENV + RubyGems Environment: + - RUBYGEMS VERSION: 1.3.6 + - RUBY VERSION: 1.8.7 (2010-05-12 patchlevel 249) [java] + - INSTALLATION DIRECTORY: /Users/you/.rvm/gems/jruby-1.5.0 + - RUBY EXECUTABLE: /Users/you/.rvm/rubies/jruby-1.5.0/bin/jruby + - EXECUTABLE DIRECTORY: /Users/you/.rvm/gems/jruby-1.5.0/bin + - RUBYGEMS PLATFORMS: + - ruby + - universal-java-1.6 + - GEM PATHS: + - /Users/you/.rvm/gems/jruby-1.5.0 + - /Users/you/.rvm/gems/jruby-1.5.0@global + - GEM CONFIGURATION: + - :update_sources => true + - :verbose => true + - :benchmark => false + - :backtrace => false + - :bulk_threshold => 1000 + - "install" => "--env-shebang" + - "update" => "--env-shebang" + - "gem" => "--no-rdoc --no-ri" + - :sources => ["https://rubygems.org/", "http://gems.github.com/"] + - REMOTE SOURCES: + - https://rubygems.org/ + - http://gems.github.com/ JRUBY_GEM_ENV expect(@gem_env).to receive(:shell_out_compacted!).with("/usr/weird/bin/gem env").and_return(double("jruby_gem_env", stdout: gem_env_out)) expected = ["ruby", Gem::Platform.new("universal-java-1.6")] @@ -295,32 +295,32 @@ RubyGems Environment: end it "uses the current gem platforms when the target env is not jruby" do - 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] - - INSTALLATION DIRECTORY: /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514 - - RUBYGEMS PREFIX: /Users/ddeleo/.rvm/rubies/rbx-1.0.0-20100514 - - RUBY EXECUTABLE: /Users/ddeleo/.rvm/rubies/rbx-1.0.0-20100514/bin/rbx - - EXECUTABLE DIRECTORY: /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514/bin - - RUBYGEMS PLATFORMS: - - ruby - - x86_64-darwin-10 - - x86_64-rubinius-1.0 - - GEM PATHS: - - /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514 - - /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514@global - - GEM CONFIGURATION: - - :update_sources => true - - :verbose => true - - :benchmark => false - - :backtrace => false - - :bulk_threshold => 1000 - - :sources => ["https://rubygems.org/", "http://gems.github.com/"] - - "gem" => "--no-rdoc --no-ri" - - REMOTE SOURCES: - - https://rubygems.org/ - - http://gems.github.com/ + 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] + - INSTALLATION DIRECTORY: /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514 + - RUBYGEMS PREFIX: /Users/ddeleo/.rvm/rubies/rbx-1.0.0-20100514 + - RUBY EXECUTABLE: /Users/ddeleo/.rvm/rubies/rbx-1.0.0-20100514/bin/rbx + - EXECUTABLE DIRECTORY: /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514/bin + - RUBYGEMS PLATFORMS: + - ruby + - x86_64-darwin-10 + - x86_64-rubinius-1.0 + - GEM PATHS: + - /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514 + - /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514@global + - GEM CONFIGURATION: + - :update_sources => true + - :verbose => true + - :benchmark => false + - :backtrace => false + - :bulk_threshold => 1000 + - :sources => ["https://rubygems.org/", "http://gems.github.com/"] + - "gem" => "--no-rdoc --no-ri" + - REMOTE SOURCES: + - https://rubygems.org/ + - http://gems.github.com/ RBX_GEM_ENV expect(@gem_env).to receive(:shell_out_compacted!).with("/usr/weird/bin/gem env").and_return(double("rbx_gem_env", stdout: gem_env_out)) expect(@gem_env.gem_platforms).to eq(Gem.platforms) diff --git a/spec/unit/provider/package/solaris_spec.rb b/spec/unit/provider/package/solaris_spec.rb index 2ebf8fe4be..2aa37fe8b3 100644 --- a/spec/unit/provider/package/solaris_spec.rb +++ b/spec/unit/provider/package/solaris_spec.rb @@ -32,18 +32,18 @@ describe Chef::Provider::Package::Solaris do describe "assessing the current package status" do before do - @pkginfo = <<-PKGINFO -PKGINST: SUNWbash -NAME: GNU Bourne-Again shell (bash) -CATEGORY: system -ARCH: sparc -VERSION: 11.10.0,REV=2005.01.08.05.16 -BASEDIR: / -VENDOR: Sun Microsystems, Inc. -DESC: GNU Bourne-Again shell (bash) version 3.0 -PSTAMP: sfw10-patch20070430084444 -INSTDATE: Nov 04 2009 01:02 -HOTLINE: Please contact your local service provider + @pkginfo = <<~PKGINFO + PKGINST: SUNWbash + NAME: GNU Bourne-Again shell (bash) + CATEGORY: system + ARCH: sparc + VERSION: 11.10.0,REV=2005.01.08.05.16 + BASEDIR: / + VENDOR: Sun Microsystems, Inc. + DESC: GNU Bourne-Again shell (bash) version 3.0 + PSTAMP: sfw10-patch20070430084444 + INSTDATE: Nov 04 2009 01:02 + HOTLINE: Please contact your local service provider PKGINFO @status = double("Status", stdout: "", exitstatus: 0) |