diff options
author | Thom May <thom@chef.io> | 2016-01-14 14:08:03 +0000 |
---|---|---|
committer | Thom May <thom@chef.io> | 2016-01-14 14:08:03 +0000 |
commit | 51cfbdc4d16739caac4d946fadbe678444aafe34 (patch) | |
tree | 56dfd8f1cd9fd933de27268b32402e955a43ac2b /spec/unit/provider/package | |
parent | 05064423057d4cf46f4713b81b08829cf6d20af6 (diff) | |
download | chef-51cfbdc4d16739caac4d946fadbe678444aafe34.tar.gz |
Use double quotes by default
This is an entirely mechanically generated (chefstyle -a) change, to go
along with chef/chefstyle#5 . We should pick something and use it
consistently, and my opinion is that double quotes are the appropriate
thing.
Diffstat (limited to 'spec/unit/provider/package')
24 files changed, 523 insertions, 523 deletions
diff --git a/spec/unit/provider/package/aix_spec.rb b/spec/unit/provider/package/aix_spec.rb index 13992cb8d1..9eb980f5cb 100644 --- a/spec/unit/provider/package/aix_spec.rb +++ b/spec/unit/provider/package/aix_spec.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -require 'spec_helper' +require "spec_helper" describe Chef::Provider::Package::Aix do before(:each) do diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb index f1845abfb1..1f4322041d 100644 --- a/spec/unit/provider/package/apt_spec.rb +++ b/spec/unit/provider/package/apt_spec.rb @@ -16,8 +16,8 @@ # limitations under the License. # -require 'spec_helper' -require 'ostruct' +require "spec_helper" +require "ostruct" describe Chef::Provider::Package::Apt do # XXX: sorry this is ugly and was done quickly to get 12.0.2 out, this file needs a rewrite to use @@ -356,7 +356,7 @@ mpg123 1.12.1-0ubuntu1 describe "when installing a virtual package" do it "should install the package without specifying a version" do - @provider.is_virtual_package['libmysqlclient-dev'] = true + @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 }, @@ -369,8 +369,8 @@ mpg123 1.12.1-0ubuntu1 describe "when installing multiple packages" do it "can install a virtual package followed by a non-virtual package" do # https://github.com/chef/chef/issues/2914 - @provider.is_virtual_package['libmysqlclient-dev'] = true - @provider.is_virtual_package['irssi'] = false + @provider.is_virtual_package["libmysqlclient-dev"] = true + @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 }, diff --git a/spec/unit/provider/package/chocolatey_spec.rb b/spec/unit/provider/package/chocolatey_spec.rb index b2e1d2daaf..406ebcd184 100644 --- a/spec/unit/provider/package/chocolatey_spec.rb +++ b/spec/unit/provider/package/chocolatey_spec.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require 'spec_helper' +require "spec_helper" describe Chef::Provider::Package::Chocolatey do let(:timeout) { 900 } diff --git a/spec/unit/provider/package/dpkg_spec.rb b/spec/unit/provider/package/dpkg_spec.rb index 5b77e7788b..e0bf2accde 100644 --- a/spec/unit/provider/package/dpkg_spec.rb +++ b/spec/unit/provider/package/dpkg_spec.rb @@ -15,7 +15,7 @@ # limitations under the License. # -require 'spec_helper' +require "spec_helper" describe Chef::Provider::Package::Dpkg do let(:node) { Chef::Node.new } @@ -114,7 +114,7 @@ Conflicts: wget-ssl expect(provider.current_resource.package_name).to eq(["wget"]) end - describe 'gets the source package version from dpkg-deb' do + describe "gets the source package version from dpkg-deb" do def check_version(version) status = double(:stdout => "wget\t#{version}", :exitstatus => 0) expect(provider).to receive(:shell_out!).with("dpkg-deb -W #{source}", timeout: 900).and_return(status) @@ -123,20 +123,20 @@ Conflicts: wget-ssl expect(provider.candidate_version).to eq([version]) end - it 'if short version provided' do - check_version('1.11.4') + it "if short version provided" do + check_version("1.11.4") end - it 'if extended version provided' do - check_version('1.11.4-1ubuntu1') + it "if extended version provided" do + check_version("1.11.4-1ubuntu1") end - it 'if distro-specific version provided' do - check_version('1.11.4-1ubuntu1~lucid') + it "if distro-specific version provided" do + check_version("1.11.4-1ubuntu1~lucid") end - it 'returns the version if an epoch is used' do - check_version('1:1.8.3-2') + it "returns the version if an epoch is used" do + check_version("1:1.8.3-2") end end @@ -156,7 +156,7 @@ Conflicts: wget-ssl it "gets the source package version from dpkg-deb correctly when the package version has `~', `-', `+' or `.' characters" do provider.load_current_resource - expect(provider.candidate_version).to eq(['1.2.3+3141592-1ubuntu1~lucid']) + expect(provider.candidate_version).to eq(["1.2.3+3141592-1ubuntu1~lucid"]) end end diff --git a/spec/unit/provider/package/easy_install_spec.rb b/spec/unit/provider/package/easy_install_spec.rb index 4ac325e7d4..09d295fec3 100644 --- a/spec/unit/provider/package/easy_install_spec.rb +++ b/spec/unit/provider/package/easy_install_spec.rb @@ -16,15 +16,15 @@ # limitations under the License. # -require 'spec_helper' +require "spec_helper" describe Chef::Provider::Package::EasyInstall do before(:each) do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - @new_resource = Chef::Resource::EasyInstallPackage.new('boto') - @new_resource.version('1.8d') + @new_resource = Chef::Resource::EasyInstallPackage.new("boto") + @new_resource.version("1.8d") @provider = Chef::Provider::Package::EasyInstall.new(@new_resource, @run_context) diff --git a/spec/unit/provider/package/freebsd/pkg_spec.rb b/spec/unit/provider/package/freebsd/pkg_spec.rb index d1f5a649bc..05660d196a 100644 --- a/spec/unit/provider/package/freebsd/pkg_spec.rb +++ b/spec/unit/provider/package/freebsd/pkg_spec.rb @@ -17,8 +17,8 @@ # limitations under the License. # -require 'spec_helper' -require 'ostruct' +require "spec_helper" +require "ostruct" describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do before(:each) do @@ -30,7 +30,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do @provider = Chef::Provider::Package::Freebsd::Pkg.new(@new_resource, @run_context) @provider.current_resource = @current_resource - allow(::File).to receive(:exist?).with('/usr/ports/Makefile').and_return(false) + allow(::File).to receive(:exist?).with("/usr/ports/Makefile").and_return(false) end describe "when determining the current package state" do @@ -107,7 +107,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do end it "should figure out the package name when we have ports" do - allow(::File).to receive(:exist?).with('/usr/ports/Makefile').and_return(true) + 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) diff --git a/spec/unit/provider/package/freebsd/pkgng_spec.rb b/spec/unit/provider/package/freebsd/pkgng_spec.rb index 59215f855b..0052300e45 100644 --- a/spec/unit/provider/package/freebsd/pkgng_spec.rb +++ b/spec/unit/provider/package/freebsd/pkgng_spec.rb @@ -17,8 +17,8 @@ # -require 'spec_helper' -require 'ostruct' +require "spec_helper" +require "ostruct" describe Chef::Provider::Package::Freebsd::Port do before(:each) do @@ -34,7 +34,7 @@ describe Chef::Provider::Package::Freebsd::Port do 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 - expect(@provider.current_resource.name).to eq('zsh') + expect(@provider.current_resource.name).to eq("zsh") end end @@ -85,7 +85,7 @@ describe Chef::Provider::Package::Freebsd::Port do end it "should query specified repository when given option" do - @provider.new_resource.options('-r LocalMirror') # This requires LocalMirror repo configuration. + @provider.new_resource.options("-r LocalMirror") # This requires LocalMirror repo configuration. pkg_query = OpenStruct.new(:stdout => "5.0.3\n", :exitstatus => 0) expect(@provider).to receive(:shell_out!).with("pkg rquery -r LocalMirror '%v' zsh", env: nil, timeout: 900).and_return(pkg_query) expect(@provider.candidate_version).to eq("5.0.3") @@ -106,7 +106,7 @@ describe Chef::Provider::Package::Freebsd::Port do it "should handle package source from file" do @provider.new_resource.source("/nas/pkg/repo/zsh-5.0.1.txz") expect(@provider).to receive(:shell_out!). - with("pkg add /nas/pkg/repo/zsh-5.0.1.txz", env: { 'LC_ALL' => nil }, timeout: 900). + with("pkg add /nas/pkg/repo/zsh-5.0.1.txz", env: { "LC_ALL" => nil }, timeout: 900). and_return(@install_result) @provider.install_package("zsh", "5.0.1") end @@ -114,21 +114,21 @@ describe Chef::Provider::Package::Freebsd::Port do it "should handle package source over ftp or http" do @provider.new_resource.source("http://repo.example.com/zsh-5.0.1.txz") expect(@provider).to receive(:shell_out!). - with("pkg add http://repo.example.com/zsh-5.0.1.txz", env: { 'LC_ALL' => nil }, timeout: 900). + with("pkg add http://repo.example.com/zsh-5.0.1.txz", env: { "LC_ALL" => nil }, timeout: 900). and_return(@install_result) @provider.install_package("zsh", "5.0.1") end it "should handle a package name" do expect(@provider).to receive(:shell_out!). - with("pkg install -y zsh", env: { 'LC_ALL' => nil }, timeout: 900).and_return(@install_result) + with("pkg install -y zsh", env: { "LC_ALL" => nil }, timeout: 900).and_return(@install_result) @provider.install_package("zsh", "5.0.1") end it "should handle a package name with a specified repo" do - @provider.new_resource.options('-r LocalMirror') # This requires LocalMirror repo configuration. + @provider.new_resource.options("-r LocalMirror") # This requires LocalMirror repo configuration. expect(@provider).to receive(:shell_out!). - with("pkg install -y -r LocalMirror zsh", env: { 'LC_ALL' => nil }, timeout: 900).and_return(@install_result) + with("pkg install -y -r LocalMirror zsh", env: { "LC_ALL" => nil }, timeout: 900).and_return(@install_result) @provider.install_package("zsh", "5.0.1") end end @@ -146,7 +146,7 @@ describe Chef::Provider::Package::Freebsd::Port do end it "should not include repo option in pkg delete" do - @provider.new_resource.options('-r LocalMirror') # This requires LocalMirror repo configuration. + @provider.new_resource.options("-r LocalMirror") # This requires LocalMirror repo configuration. expect(@provider).to receive(:shell_out!). with("pkg delete -y zsh-5.0.1", env: nil, timeout: 900).and_return(@install_result) @provider.remove_package("zsh", "5.0.1") diff --git a/spec/unit/provider/package/freebsd/port_spec.rb b/spec/unit/provider/package/freebsd/port_spec.rb index 4b23575740..958d505187 100644 --- a/spec/unit/provider/package/freebsd/port_spec.rb +++ b/spec/unit/provider/package/freebsd/port_spec.rb @@ -17,8 +17,8 @@ # -require 'spec_helper' -require 'ostruct' +require "spec_helper" +require "ostruct" describe Chef::Provider::Package::Freebsd::Port do before(:each) do @@ -34,7 +34,7 @@ describe Chef::Provider::Package::Freebsd::Port do 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 - expect(@provider.current_resource.name).to eq('zsh') + expect(@provider.current_resource.name).to eq("zsh") end end @@ -80,7 +80,7 @@ describe Chef::Provider::Package::Freebsd::Port do pkg_enabled = OpenStruct.new(:stdout => "yes\n") [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(@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.current_installed_version).to eq("3.1.7") end @@ -100,15 +100,15 @@ describe Chef::Provider::Package::Freebsd::Port do end 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') + 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). and_return(@port_version) expect(@provider.candidate_version).to eq("5.0.5") end it "should raise exception if ports tree not found" do - allow(::File).to receive(:exist?).with('/usr/ports/Makefile').and_return(false) + allow(::File).to receive(:exist?).with("/usr/ports/Makefile").and_return(false) expect { @provider.candidate_version }.to raise_error(Chef::Exceptions::Package, "Ports collection could not be found") end end diff --git a/spec/unit/provider/package/homebrew_spec.rb b/spec/unit/provider/package/homebrew_spec.rb index 926c1a0ff0..b4a2e16f87 100644 --- a/spec/unit/provider/package/homebrew_spec.rb +++ b/spec/unit/provider/package/homebrew_spec.rb @@ -15,14 +15,14 @@ # limitations under the License. # -require 'spec_helper' +require "spec_helper" describe Chef::Provider::Package::Homebrew do let(:node) { Chef::Node.new } - 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(: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(:provider) do Chef::Provider::Package::Homebrew.new(new_resource, run_context) @@ -32,85 +32,85 @@ describe Chef::Provider::Package::Homebrew do let(:uninstalled_brew_info) do { - 'name' => 'emacs', - 'homepage' => 'http://www.gnu.org/software/emacs', - 'versions' => { - 'stable' => '24.3', - 'bottle' => false, - 'devel' => nil, - 'head' => nil, + "name" => "emacs", + "homepage" => "http://www.gnu.org/software/emacs", + "versions" => { + "stable" => "24.3", + "bottle" => false, + "devel" => nil, + "head" => nil, }, - 'revision' => 0, - 'installed' => [], - 'linked_keg' => nil, - 'keg_only' => nil, - 'dependencies' => [], - 'conflicts_with' => [], - 'caveats' => nil, - 'options' => [], + "revision" => 0, + "installed" => [], + "linked_keg" => nil, + "keg_only" => nil, + "dependencies" => [], + "conflicts_with" => [], + "caveats" => nil, + "options" => [], } end let(:installed_brew_info) do { - 'name' => 'emacs', - 'homepage' => 'http://www.gnu.org/software/emacs/', - 'versions' => { - 'stable' => '24.3', - 'bottle' => false, - 'devel' => nil, - 'head' => 'HEAD', + "name" => "emacs", + "homepage" => "http://www.gnu.org/software/emacs/", + "versions" => { + "stable" => "24.3", + "bottle" => false, + "devel" => nil, + "head" => "HEAD", }, - 'revision' => 0, - 'installed' => [{ 'version' => '24.3' }], - 'linked_keg' => '24.3', - 'keg_only' => nil, - 'dependencies' => [], - 'conflicts_with' => [], - 'caveats' => '', - 'options' => [], + "revision" => 0, + "installed" => [{ "version" => "24.3" }], + "linked_keg" => "24.3", + "keg_only" => nil, + "dependencies" => [], + "conflicts_with" => [], + "caveats" => "", + "options" => [], } end let(:keg_only_brew_info) do { - 'name' => 'emacs-kegger', - 'homepage' => 'http://www.gnu.org/software/emacs/', - 'versions' => { - 'stable' => '24.3-keggy', - 'bottle' => false, - 'devel' => nil, - 'head' => 'HEAD', + "name" => "emacs-kegger", + "homepage" => "http://www.gnu.org/software/emacs/", + "versions" => { + "stable" => "24.3-keggy", + "bottle" => false, + "devel" => nil, + "head" => "HEAD", }, - 'revision' => 0, - 'installed' => [{ 'version' => '24.3-keggy' }], - 'linked_keg' => nil, - 'keg_only' => true, - 'dependencies' => [], - 'conflicts_with' => [], - 'caveats' => '', - 'options' => [], + "revision" => 0, + "installed" => [{ "version" => "24.3-keggy" }], + "linked_keg" => nil, + "keg_only" => true, + "dependencies" => [], + "conflicts_with" => [], + "caveats" => "", + "options" => [], } end let(:keg_only_uninstalled_brew_info) do { - 'name' => 'emacs-kegger', - 'homepage' => 'http://www.gnu.org/software/emacs/', - 'versions' => { - 'stable' => '24.3-keggy', - 'bottle' => false, - 'devel' => nil, - 'head' => 'HEAD', + "name" => "emacs-kegger", + "homepage" => "http://www.gnu.org/software/emacs/", + "versions" => { + "stable" => "24.3-keggy", + "bottle" => false, + "devel" => nil, + "head" => "HEAD", }, - 'revision' => 0, - 'installed' => [], - 'linked_keg' => nil, - 'keg_only' => true, - 'dependencies' => [], - 'conflicts_with' => [], - 'caveats' => '', - 'options' => [], + "revision" => 0, + "installed" => [], + "linked_keg" => nil, + "keg_only" => true, + "dependencies" => [], + "conflicts_with" => [], + "caveats" => "", + "options" => [], } end @@ -118,174 +118,174 @@ describe Chef::Provider::Package::Homebrew do end - describe 'load_current_resource' do + describe "load_current_resource" do before(:each) do allow(provider).to receive(:current_installed_version).and_return(nil) - allow(provider).to receive(:candidate_version).and_return('24.3') + allow(provider).to receive(:candidate_version).and_return("24.3") end - it 'creates a current resource with the name of the new resource' do + it "creates a current resource with the name of the new resource" do provider.load_current_resource expect(provider.current_resource).to be_a(Chef::Resource::Package) - expect(provider.current_resource.name).to eql('emacs') + expect(provider.current_resource.name).to eql("emacs") end - it 'creates a current resource with the version if the package is installed' do - expect(provider).to receive(:current_installed_version).and_return('24.3') + it "creates a current resource with the version if the package is installed" do + expect(provider).to receive(:current_installed_version).and_return("24.3") provider.load_current_resource - expect(provider.current_resource.version).to eql('24.3') + expect(provider.current_resource.version).to eql("24.3") end - it 'creates a current resource with a nil version if the package is not installed' do + it "creates a current resource with a nil version if the package is not installed" do provider.load_current_resource expect(provider.current_resource.version).to be_nil end - it 'sets a candidate version if one exists' do + it "sets a candidate version if one exists" do provider.load_current_resource - expect(provider.candidate_version).to eql('24.3') + expect(provider.candidate_version).to eql("24.3") end end - describe 'current_installed_version' do - it 'returns the latest version from brew info if the package is keg only' do + describe "current_installed_version" do + it "returns the latest version from brew info if the package is keg only" do allow(provider).to receive(:brew_info).and_return(keg_only_brew_info) - expect(provider.current_installed_version).to eql('24.3-keggy') + expect(provider.current_installed_version).to eql("24.3-keggy") end - it 'returns the linked keg version if the package is not keg only' do + it "returns the linked keg version if the package is not keg only" do allow(provider).to receive(:brew_info).and_return(installed_brew_info) - expect(provider.current_installed_version).to eql('24.3') + expect(provider.current_installed_version).to eql("24.3") end - it 'returns nil if the package is not installed' do + it "returns nil if the package is not installed" do allow(provider).to receive(:brew_info).and_return(uninstalled_brew_info) expect(provider.current_installed_version).to be_nil end - it 'returns nil if the package is keg only and not installed' do + it "returns nil if the package is keg only and not installed" do allow(provider).to receive(:brew_info).and_return(keg_only_uninstalled_brew_info) expect(provider.current_installed_version).to be_nil end end - describe 'brew' do + describe "brew" do before do expect(provider).to receive(:find_homebrew_uid).and_return(homebrew_uid) expect(Etc).to receive(:getpwuid).with(homebrew_uid).and_return(OpenStruct.new(:name => "name", :dir => "/")) end - it 'passes a single to the brew command and return stdout' do - allow(provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => 'zombo')) - expect(provider.brew).to eql('zombo') + it "passes a single to the brew command and return stdout" do + allow(provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "zombo")) + expect(provider.brew).to eql("zombo") end - it 'takes multiple arguments as an array' do - allow(provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => 'homestarrunner')) - expect(provider.brew('info', 'opts', 'bananas')).to eql('homestarrunner') + it "takes multiple arguments as an array" do + allow(provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "homestarrunner")) + expect(provider.brew("info", "opts", "bananas")).to eql("homestarrunner") end context "when new_resource is Package" do - let(:new_resource) { Chef::Resource::Package.new('emacs') } + let(:new_resource) { Chef::Resource::Package.new("emacs") } it "does not try to read homebrew_user from Package, which does not have it" do - allow(provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => 'zombo')) - expect(provider.brew).to eql('zombo') + allow(provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "zombo")) + expect(provider.brew).to eql("zombo") end end end - context 'when testing actions' do + context "when testing actions" do before(:each) do provider.current_resource = current_resource end - describe 'install_package' do + describe "install_package" do before(:each) do - allow(provider).to receive(:candidate_version).and_return('24.3') + allow(provider).to receive(:candidate_version).and_return("24.3") end - it 'installs the named package with brew install' do - allow(provider.new_resource).to receive(:version).and_return('24.3') + it "installs the named package with brew install" do + allow(provider.new_resource).to receive(:version).and_return("24.3") allow(provider.current_resource).to receive(:version).and_return(nil) allow(provider).to receive(:brew_info).and_return(uninstalled_brew_info) - expect(provider).to receive(:get_response_from_command).with('brew install emacs') - provider.install_package('emacs', '24.3') + expect(provider).to receive(:get_response_from_command).with("brew install emacs") + provider.install_package("emacs", "24.3") end - it 'does not do anything if the package is installed' do - allow(provider.current_resource).to receive(:version).and_return('24.3') + it "does not do anything if the package is installed" do + allow(provider.current_resource).to receive(:version).and_return("24.3") allow(provider).to receive(:brew_info).and_return(installed_brew_info) expect(provider).not_to receive(:get_response_from_command) - provider.install_package('emacs', '24.3') + provider.install_package("emacs", "24.3") end - it 'uses options to the brew command if specified' do - allow(provider.new_resource).to receive(:options).and_return('--cocoa') - allow(provider.current_resource).to receive(:version).and_return('24.3') - allow(provider).to receive(:get_response_from_command).with('brew install --cocoa emacs') - provider.install_package('emacs', '24.3') + it "uses options to the brew command if specified" do + allow(provider.new_resource).to receive(:options).and_return("--cocoa") + allow(provider.current_resource).to receive(:version).and_return("24.3") + allow(provider).to receive(:get_response_from_command).with("brew install --cocoa emacs") + provider.install_package("emacs", "24.3") end end - describe 'upgrade_package' do - it 'uses brew upgrade to upgrade the package if it is installed' do - allow(provider.current_resource).to receive(:version).and_return('24') + describe "upgrade_package" do + it "uses brew upgrade to upgrade the package if it is installed" do + allow(provider.current_resource).to receive(:version).and_return("24") allow(provider).to receive(:brew_info).and_return(installed_brew_info) - expect(provider).to receive(:get_response_from_command).with('brew upgrade emacs') - provider.upgrade_package('emacs', '24.3') + expect(provider).to receive(:get_response_from_command).with("brew upgrade emacs") + provider.upgrade_package("emacs", "24.3") end - it 'does not do anything if the package version is already installed' do - allow(provider.current_resource).to receive(:version).and_return('24.3') + it "does not do anything if the package version is already installed" do + allow(provider.current_resource).to receive(:version).and_return("24.3") allow(provider).to receive(:brew_info).and_return(installed_brew_info) expect(provider).not_to receive(:get_response_from_command) - provider.install_package('emacs', '24.3') + provider.install_package("emacs", "24.3") end - it 'uses brew install to install the package if it is not installed' do + it "uses brew install to install the package if it is not installed" do allow(provider.current_resource).to receive(:version).and_return(nil) allow(provider).to receive(:brew_info).and_return(uninstalled_brew_info) - expect(provider).to receive(:get_response_from_command).with('brew install emacs') - provider.upgrade_package('emacs', '24.3') + expect(provider).to receive(:get_response_from_command).with("brew install emacs") + provider.upgrade_package("emacs", "24.3") end - it 'uses options to the brew command if specified' do - allow(provider.current_resource).to receive(:version).and_return('24') + it "uses options to the brew command if specified" do + allow(provider.current_resource).to receive(:version).and_return("24") allow(provider).to receive(:brew_info).and_return(installed_brew_info) - allow(provider.new_resource).to receive(:options).and_return('--cocoa') - expect(provider).to receive(:get_response_from_command).with('brew upgrade --cocoa emacs') - provider.upgrade_package('emacs', '24.3') + allow(provider.new_resource).to receive(:options).and_return("--cocoa") + expect(provider).to receive(:get_response_from_command).with("brew upgrade --cocoa emacs") + provider.upgrade_package("emacs", "24.3") end end - describe 'remove_package' do - it 'uninstalls the package with brew uninstall' do - allow(provider.current_resource).to receive(:version).and_return('24.3') + describe "remove_package" do + it "uninstalls the package with brew uninstall" do + allow(provider.current_resource).to receive(:version).and_return("24.3") allow(provider).to receive(:brew_info).and_return(installed_brew_info) - expect(provider).to receive(:get_response_from_command).with('brew uninstall emacs') - provider.remove_package('emacs', '24.3') + expect(provider).to receive(:get_response_from_command).with("brew uninstall emacs") + provider.remove_package("emacs", "24.3") end - it 'does not do anything if the package is not installed' do + it "does not do anything if the package is not installed" do allow(provider).to receive(:brew_info).and_return(uninstalled_brew_info) expect(provider).not_to receive(:get_response_from_command) - provider.remove_package('emacs', '24.3') + provider.remove_package("emacs", "24.3") end end - describe 'purge_package' do - it 'uninstalls the package with brew uninstall --force' do - allow(provider.current_resource).to receive(:version).and_return('24.3') + describe "purge_package" do + it "uninstalls the package with brew uninstall --force" do + allow(provider.current_resource).to receive(:version).and_return("24.3") allow(provider).to receive(:brew_info).and_return(installed_brew_info) - expect(provider).to receive(:get_response_from_command).with('brew uninstall --force emacs') - provider.purge_package('emacs', '24.3') + expect(provider).to receive(:get_response_from_command).with("brew uninstall --force emacs") + provider.purge_package("emacs", "24.3") end - it 'does not do anything if the package is not installed' do + it "does not do anything if the package is not installed" do allow(provider).to receive(:brew_info).and_return(uninstalled_brew_info) expect(provider).not_to receive(:get_response_from_command) - provider.purge_package('emacs', '24.3') + provider.purge_package("emacs", "24.3") end end end diff --git a/spec/unit/provider/package/ips_spec.rb b/spec/unit/provider/package/ips_spec.rb index ad69dffb10..bc29e30fd8 100644 --- a/spec/unit/provider/package/ips_spec.rb +++ b/spec/unit/provider/package/ips_spec.rb @@ -16,8 +16,8 @@ # limitations under the License. # -require 'spec_helper' -require 'ostruct' +require "spec_helper" +require "ostruct" # based on the apt specs @@ -34,7 +34,7 @@ describe Chef::Provider::Package::Ips do def local_output stdin = StringIO.new - stdout = '' + 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: @@ -59,7 +59,7 @@ Packaging Date: April 1, 2012 05:55:52 PM FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z PKG_STATUS stdin = StringIO.new - stderr = '' + stderr = "" return OpenStruct.new(:stdout => stdout,:stdin => stdin,:stderr => stderr,:status => @status,:exitstatus => 0) end diff --git a/spec/unit/provider/package/macports_spec.rb b/spec/unit/provider/package/macports_spec.rb index eef84113b4..83b6e04be9 100644 --- a/spec/unit/provider/package/macports_spec.rb +++ b/spec/unit/provider/package/macports_spec.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require 'spec_helper' +require "spec_helper" describe Chef::Provider::Package::Macports do before(:each) do diff --git a/spec/unit/provider/package/openbsd_spec.rb b/spec/unit/provider/package/openbsd_spec.rb index 8407f83785..0801b4b233 100644 --- a/spec/unit/provider/package/openbsd_spec.rb +++ b/spec/unit/provider/package/openbsd_spec.rb @@ -16,14 +16,14 @@ # limitations under the License. # -require 'spec_helper' -require 'ostruct' +require "spec_helper" +require "ostruct" 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 @@ -36,24 +36,24 @@ describe Chef::Provider::Package::Openbsd do let(:new_resource) { Chef::Resource::Package.new(name)} before(:each) do - ENV['PKG_PATH'] = nil + ENV["PKG_PATH"] = nil end describe "install a package" do - let(:name) { 'ihavetoes' } - let(:version) {'0.0'} + let(:name) { "ihavetoes" } + let(:version) {"0.0"} - context 'when not already installed' do + context "when not already installed" do before do - allow(provider).to receive(:shell_out!).with("pkg_info -e \"#{name}->0\"", anything()).and_return(instance_double('shellout', :stdout => '')) + allow(provider).to receive(:shell_out!).with("pkg_info -e \"#{name}->0\"", anything()).and_return(instance_double("shellout", :stdout => "")) end - context 'when there is a single candidate' do + context "when there is a single candidate" do - context 'when source is not provided' do - it 'should run the installation command' do + context "when source is not provided" do + it "should run the installation command" do expect(provider).to receive(:shell_out!).with("pkg_info -I \"#{name}\"", anything()).and_return( - instance_double('shellout', :stdout => "#{name}-#{version}\n")) + 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} @@ -63,29 +63,29 @@ describe Chef::Provider::Package::Openbsd do end end - context 'when there are multiple candidates' do - let(:flavor_a) { 'flavora' } - let(:flavor_b) { 'flavorb' } + context "when there are multiple candidates" do + let(:flavor_a) { "flavora" } + let(:flavor_b) { "flavorb" } - context 'if no version is specified' do - it 'should raise an exception' do + context "if no version is specified" do + it "should raise an exception" do expect(provider).to receive(:shell_out!).with("pkg_info -I \"#{name}\"", anything()).and_return( - instance_double('shellout', :stdout => "#{name}-#{version}-#{flavor_a}\n#{name}-#{version}-#{flavor_b}\n")) + instance_double("shellout", :stdout => "#{name}-#{version}-#{flavor_a}\n#{name}-#{version}-#{flavor_b}\n")) expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package, /multiple matching candidates/) end end - context 'if a flavor is specified' do + context "if a flavor is specified" do - let(:flavor) { 'flavora' } - let(:package_name) {'ihavetoes' } + let(:flavor) { "flavora" } + let(:package_name) {"ihavetoes" } let(:name) { "#{package_name}--#{flavor}" } - context 'if no version is specified' do - it 'should run the installation command' do - expect(provider).to receive(:shell_out!).with("pkg_info -e \"#{package_name}->0\"", anything()).and_return(instance_double('shellout', :stdout => '')) + context "if no version is specified" do + it "should run the installation command" do + expect(provider).to receive(:shell_out!).with("pkg_info -e \"#{package_name}->0\"", anything()).and_return(instance_double("shellout", :stdout => "")) expect(provider).to receive(:shell_out!).with("pkg_info -I \"#{name}\"", anything()).and_return( - instance_double('shellout', :stdout => "#{name}-#{version}-#{flavor}\n")) + 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} @@ -96,10 +96,10 @@ describe Chef::Provider::Package::Openbsd do end - context 'if a version is specified' do - it 'should use the flavor from the version' do + context "if a version is specified" do + it "should use the flavor from the version" do expect(provider).to receive(:shell_out!).with("pkg_info -I \"#{name}-#{version}-#{flavor_b}\"", anything()).and_return( - instance_double('shellout', :stdout => "#{name}-#{version}-#{flavor_a}\n")) + instance_double("shellout", :stdout => "#{name}-#{version}-#{flavor_a}\n")) new_resource.version("#{version}-#{flavor_b}") expect(provider).to receive(:shell_out!).with( @@ -115,7 +115,7 @@ describe Chef::Provider::Package::Openbsd do describe "delete a package" do before do - @name = 'ihavetoes' + @name = "ihavetoes" @new_resource = Chef::Resource::Package.new(@name) @current_resource = Chef::Resource::Package.new(@name) @provider = Chef::Provider::Package::Openbsd.new(@new_resource, @run_context) diff --git a/spec/unit/provider/package/pacman_spec.rb b/spec/unit/provider/package/pacman_spec.rb index da27edafeb..4b715da8b6 100644 --- a/spec/unit/provider/package/pacman_spec.rb +++ b/spec/unit/provider/package/pacman_spec.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require 'spec_helper' +require "spec_helper" describe Chef::Provider::Package::Pacman do before(:each) do diff --git a/spec/unit/provider/package/paludis_spec.rb b/spec/unit/provider/package/paludis_spec.rb index 4ed5dfc003..05c1e529b7 100644 --- a/spec/unit/provider/package/paludis_spec.rb +++ b/spec/unit/provider/package/paludis_spec.rb @@ -16,8 +16,8 @@ # limitations under the License. # -require 'spec_helper' -require 'ostruct' +require "spec_helper" +require "ostruct" # based on the ips specs diff --git a/spec/unit/provider/package/portage_spec.rb b/spec/unit/provider/package/portage_spec.rb index 55743dbeaf..a73db877b6 100644 --- a/spec/unit/provider/package/portage_spec.rb +++ b/spec/unit/provider/package/portage_spec.rb @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -require 'spec_helper' +require "spec_helper" describe Chef::Provider::Package::Portage, "load_current_resource" do before(:each) do diff --git a/spec/unit/provider/package/rpm_spec.rb b/spec/unit/provider/package/rpm_spec.rb index ad9d694e34..409b5268ee 100644 --- a/spec/unit/provider/package/rpm_spec.rb +++ b/spec/unit/provider/package/rpm_spec.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -require 'spec_helper' +require "spec_helper" describe Chef::Provider::Package::Rpm do let(:provider) { Chef::Provider::Package::Rpm.new(new_resource, run_context) } @@ -35,10 +35,10 @@ describe Chef::Provider::Package::Rpm do end # `rpm -qp [stuff] $source` - let(:rpm_qp_status) { instance_double('Mixlib::ShellOut', exitstatus: rpm_qp_exitstatus, stdout: rpm_qp_stdout) } + let(:rpm_qp_status) { instance_double("Mixlib::ShellOut", exitstatus: rpm_qp_exitstatus, stdout: rpm_qp_stdout) } # `rpm -q [stuff] $package_name` - let(:rpm_q_status) { instance_double('Mixlib::ShellOut', exitstatus: rpm_q_exitstatus, stdout: rpm_q_stdout) } + let(:rpm_q_status) { instance_double("Mixlib::ShellOut", exitstatus: rpm_q_exitstatus, stdout: rpm_q_stdout) } before(:each) do allow(::File).to receive(:exists?).with("PLEASE STUB File.exists? EXACTLY").and_return(true) diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb index 5e4d8a6224..85de24fdb4 100644 --- a/spec/unit/provider/package/rubygems_spec.rb +++ b/spec/unit/provider/package/rubygems_spec.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -require 'pp' +require "pp" module GemspecBackcompatCreator def gemspec(name, version) @@ -28,8 +28,8 @@ module GemspecBackcompatCreator end end -require 'spec_helper' -require 'ostruct' +require "spec_helper" +require "ostruct" describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do include GemspecBackcompatCreator @@ -43,18 +43,18 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do end it "determines the installed versions of gems from Gem.source_index" do - gems = [gemspec('rspec-core', Gem::Version.new('1.2.9')), gemspec('rspec-core', Gem::Version.new('1.3.0'))] - if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0') - expect(Gem::Specification).to receive(:find_all_by_name).with('rspec-core', Gem::Dependency.new('rspec-core').requirement).and_return(gems) + gems = [gemspec("rspec-core", Gem::Version.new("1.2.9")), gemspec("rspec-core", Gem::Version.new("1.3.0"))] + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("1.8.0") + expect(Gem::Specification).to receive(:find_all_by_name).with("rspec-core", Gem::Dependency.new("rspec-core").requirement).and_return(gems) else - expect(Gem.source_index).to receive(:search).with(Gem::Dependency.new('rspec-core', nil)).and_return(gems) + expect(Gem.source_index).to receive(:search).with(Gem::Dependency.new("rspec-core", nil)).and_return(gems) end - expect(@gem_env.installed_versions(Gem::Dependency.new('rspec-core', nil))).to eq(gems) + expect(@gem_env.installed_versions(Gem::Dependency.new("rspec-core", nil))).to eq(gems) end it "determines the installed versions of gems from the source index (part2: the unmockening)" do - expected = ['rspec-core', Gem::Version.new(RSpec::Core::Version::STRING)] - actual = @gem_env.installed_versions(Gem::Dependency.new('rspec-core', nil)).map { |spec| [spec.name, spec.version] } + expected = ["rspec-core", Gem::Version.new(RSpec::Core::Version::STRING)] + actual = @gem_env.installed_versions(Gem::Dependency.new("rspec-core", nil)).map { |spec| [spec.name, spec.version] } expect(actual).to include(expected) end @@ -87,16 +87,16 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do end it "finds a matching gem candidate version" do - dep = Gem::Dependency.new('rspec', '>= 0') + dep = Gem::Dependency.new("rspec", ">= 0") dep_installer = Gem::DependencyInstaller.new allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer) latest = [[gemspec("rspec", Gem::Version.new("1.3.0")), "https://rubygems.org/"]] expect(dep_installer).to receive(:find_gems_with_sources).with(dep).and_return(latest) - expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>= 0'))).to eq(Gem::Version.new('1.3.0')) + expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new("rspec", ">= 0"))).to eq(Gem::Version.new("1.3.0")) end it "finds a matching gem candidate version on rubygems 2.0.0+" do - dep = Gem::Dependency.new('rspec', '>= 0') + dep = Gem::Dependency.new("rspec", ">= 0") dep_installer = Gem::DependencyInstaller.new allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer) best_gem = double("best gem match", :spec => gemspec("rspec", Gem::Version.new("1.3.0")), :source => "https://rubygems.org") @@ -104,62 +104,62 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do expect(available_set).to receive(:pick_best!) expect(available_set).to receive(:set).and_return([best_gem]) expect(dep_installer).to receive(:find_gems_with_sources).with(dep).and_return(available_set) - expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>= 0'))).to eq(Gem::Version.new('1.3.0')) + expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new("rspec", ">= 0"))).to eq(Gem::Version.new("1.3.0")) end it "gives the candidate version as nil if none is found" do - dep = Gem::Dependency.new('rspec', '>= 0') + dep = Gem::Dependency.new("rspec", ">= 0") latest = [] dep_installer = Gem::DependencyInstaller.new allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer) expect(dep_installer).to receive(:find_gems_with_sources).with(dep).and_return(latest) - expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>= 0'))).to be_nil + expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new("rspec", ">= 0"))).to be_nil end it "finds a matching candidate version from a .gem file when the path to the gem is supplied" do - location = CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem' - expect(@gem_env.candidate_version_from_file(Gem::Dependency.new('chef-integration-test', '>= 0'), location)).to eq(Gem::Version.new('0.1.0')) - expect(@gem_env.candidate_version_from_file(Gem::Dependency.new('chef-integration-test', '>= 0.2.0'), location)).to be_nil + location = CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem" + expect(@gem_env.candidate_version_from_file(Gem::Dependency.new("chef-integration-test", ">= 0"), location)).to eq(Gem::Version.new("0.1.0")) + expect(@gem_env.candidate_version_from_file(Gem::Dependency.new("chef-integration-test", ">= 0.2.0"), location)).to be_nil end it "finds a matching gem from a specific gemserver when explicit sources are given" do - dep = Gem::Dependency.new('rspec', '>= 0') + dep = Gem::Dependency.new("rspec", ">= 0") latest = [[gemspec("rspec", Gem::Version.new("1.3.0")), "https://rubygems.org/"]] - expect(@gem_env).to receive(:with_gem_sources).with('http://gems.example.com').and_yield + expect(@gem_env).to receive(:with_gem_sources).with("http://gems.example.com").and_yield dep_installer = Gem::DependencyInstaller.new allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer) expect(dep_installer).to receive(:find_gems_with_sources).with(dep).and_return(latest) - expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>=0'), 'http://gems.example.com')).to eq(Gem::Version.new('1.3.0')) + expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new("rspec", ">=0"), "http://gems.example.com")).to eq(Gem::Version.new("1.3.0")) end it "installs a gem with a hash of options for the dependency installer" do dep_installer = Gem::DependencyInstaller.new - expect(@gem_env).to receive(:dependency_installer).with(:install_dir => '/foo/bar').and_return(dep_installer) - expect(@gem_env).to receive(:with_gem_sources).with('http://gems.example.com').and_yield - expect(dep_installer).to receive(:install).with(Gem::Dependency.new('rspec', '>= 0')) - @gem_env.install(Gem::Dependency.new('rspec', '>= 0'), :install_dir => '/foo/bar', :sources => ['http://gems.example.com']) + expect(@gem_env).to receive(:dependency_installer).with(:install_dir => "/foo/bar").and_return(dep_installer) + expect(@gem_env).to receive(:with_gem_sources).with("http://gems.example.com").and_yield + expect(dep_installer).to receive(:install).with(Gem::Dependency.new("rspec", ">= 0")) + @gem_env.install(Gem::Dependency.new("rspec", ">= 0"), :install_dir => "/foo/bar", :sources => ["http://gems.example.com"]) end it "builds an uninstaller for a gem with options set to avoid requiring user input" do # default options for uninstaller should be: # :ignore => true, :executables => true - expect(Gem::Uninstaller).to receive(:new).with('rspec', :ignore => true, :executables => true) - @gem_env.uninstaller('rspec') + expect(Gem::Uninstaller).to receive(:new).with("rspec", :ignore => true, :executables => true) + @gem_env.uninstaller("rspec") end it "uninstalls all versions of a gem" do - uninstaller = double('gem uninstaller') + uninstaller = double("gem uninstaller") expect(uninstaller).to receive(:uninstall) - expect(@gem_env).to receive(:uninstaller).with('rspec', :all => true).and_return(uninstaller) - @gem_env.uninstall('rspec') + expect(@gem_env).to receive(:uninstaller).with("rspec", :all => true).and_return(uninstaller) + @gem_env.uninstall("rspec") end it "uninstalls a specific version of a gem" do - uninstaller = double('gem uninstaller') + uninstaller = double("gem uninstaller") expect(uninstaller).to receive(:uninstall) - expect(@gem_env).to receive(:uninstaller).with('rspec', :version => '1.2.3').and_return(uninstaller) - @gem_env.uninstall('rspec', '1.2.3') + expect(@gem_env).to receive(:uninstaller).with("rspec", :version => "1.2.3").and_return(uninstaller) + @gem_env.uninstall("rspec", "1.2.3") end end @@ -170,54 +170,54 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do before do Chef::Provider::Package::Rubygems::AlternateGemEnvironment.gempath_cache.clear Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache.clear - @gem_env = Chef::Provider::Package::Rubygems::AlternateGemEnvironment.new('/usr/weird/bin/gem') + @gem_env = Chef::Provider::Package::Rubygems::AlternateGemEnvironment.new("/usr/weird/bin/gem") end it "determines the gem paths from shelling out to gem env" do - gem_env_output = ['/path/to/gems', '/another/path/to/gems'].join(File::PATH_SEPARATOR) + gem_env_output = ["/path/to/gems", "/another/path/to/gems"].join(File::PATH_SEPARATOR) shell_out_result = OpenStruct.new(:stdout => gem_env_output) - expect(@gem_env).to receive(:shell_out!).with('/usr/weird/bin/gem env gempath').and_return(shell_out_result) - expect(@gem_env.gem_paths).to eq(['/path/to/gems', '/another/path/to/gems']) + expect(@gem_env).to receive(:shell_out!).with("/usr/weird/bin/gem env gempath").and_return(shell_out_result) + expect(@gem_env.gem_paths).to eq(["/path/to/gems", "/another/path/to/gems"]) end it "caches the gempaths by gem_binary" do - gem_env_output = ['/path/to/gems', '/another/path/to/gems'].join(File::PATH_SEPARATOR) + gem_env_output = ["/path/to/gems", "/another/path/to/gems"].join(File::PATH_SEPARATOR) shell_out_result = OpenStruct.new(:stdout => gem_env_output) - expect(@gem_env).to receive(:shell_out!).with('/usr/weird/bin/gem env gempath').and_return(shell_out_result) - expected = ['/path/to/gems', '/another/path/to/gems'] - expect(@gem_env.gem_paths).to eq(['/path/to/gems', '/another/path/to/gems']) - expect(Chef::Provider::Package::Rubygems::AlternateGemEnvironment.gempath_cache['/usr/weird/bin/gem']).to eq(expected) + expect(@gem_env).to receive(:shell_out!).with("/usr/weird/bin/gem env gempath").and_return(shell_out_result) + expected = ["/path/to/gems", "/another/path/to/gems"] + expect(@gem_env.gem_paths).to eq(["/path/to/gems", "/another/path/to/gems"]) + expect(Chef::Provider::Package::Rubygems::AlternateGemEnvironment.gempath_cache["/usr/weird/bin/gem"]).to eq(expected) end 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 - expect(@gem_env.gem_paths).to eq(['/path/to/gems', '/another/path/to/gems']) + expected = ["/path/to/gems", "/another/path/to/gems"] + 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 it "builds the gems source index from the gem paths" do - allow(@gem_env).to receive(:gem_paths).and_return(['/path/to/gems', '/another/path/to/gems']) - if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0') + allow(@gem_env).to receive(:gem_paths).and_return(["/path/to/gems", "/another/path/to/gems"]) + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("1.8.0") @gem_env.gem_specification - expect(Gem::Specification.dirs).to eq([ '/path/to/gems/specifications', '/another/path/to/gems/specifications' ]) + expect(Gem::Specification.dirs).to eq([ "/path/to/gems/specifications", "/another/path/to/gems/specifications" ]) else - expect(Gem::SourceIndex).to receive(:from_gems_in).with('/path/to/gems/specifications', '/another/path/to/gems/specifications') + expect(Gem::SourceIndex).to receive(:from_gems_in).with("/path/to/gems/specifications", "/another/path/to/gems/specifications") @gem_env.gem_source_index end end it "determines the installed versions of gems from the source index" do - gems = [gemspec('rspec', Gem::Version.new('1.2.9')), gemspec('rspec', Gem::Version.new('1.3.0'))] - rspec_dep = Gem::Dependency.new('rspec', nil) - if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0') + gems = [gemspec("rspec", Gem::Version.new("1.2.9")), gemspec("rspec", Gem::Version.new("1.3.0"))] + rspec_dep = Gem::Dependency.new("rspec", nil) + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("1.8.0") allow(@gem_env).to receive(:gem_specification).and_return(Gem::Specification) expect(@gem_env.gem_specification).to receive(:find_all_by_name).with(rspec_dep.name, rspec_dep.requirement).and_return(gems) else allow(@gem_env).to receive(:gem_source_index).and_return(Gem.source_index) expect(@gem_env.gem_source_index).to receive(:search).with(rspec_dep).and_return(gems) end - expect(@gem_env.installed_versions(Gem::Dependency.new('rspec', nil))).to eq(gems) + expect(@gem_env.installed_versions(Gem::Dependency.new("rspec", nil))).to eq(gems) end it "determines the installed versions of gems from the source index (part2: the unmockening)" do @@ -229,8 +229,8 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do end skip("cant find your gem executable") if path_to_gem.empty? gem_env = Chef::Provider::Package::Rubygems::AlternateGemEnvironment.new(path_to_gem) - expected = ['rspec-core', Gem::Version.new(RSpec::Core::Version::STRING)] - actual = gem_env.installed_versions(Gem::Dependency.new('rspec-core', nil)).map { |s| [s.name, s.version] } + expected = ["rspec-core", Gem::Version.new(RSpec::Core::Version::STRING)] + actual = gem_env.installed_versions(Gem::Dependency.new("rspec-core", nil)).map { |s| [s.name, s.version] } expect(actual).to include(expected) end @@ -262,17 +262,17 @@ RubyGems Environment: - https://rubygems.org/ - http://gems.github.com/ JRUBY_GEM_ENV - expect(@gem_env).to receive(:shell_out!).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')] + expect(@gem_env).to receive(:shell_out!).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")] expect(@gem_env.gem_platforms).to eq(expected) # it should also cache the result - expect(Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache['/usr/weird/bin/gem']).to eq(expected) + expect(Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache["/usr/weird/bin/gem"]).to eq(expected) end 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 + expected = ["ruby", Gem::Platform.new("universal-java-1.6")] + Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache["/usr/weird/bin/gem"]= expected expect(@gem_env.gem_platforms).to eq(expected) end @@ -304,22 +304,22 @@ RubyGems Environment: - https://rubygems.org/ - http://gems.github.com/ RBX_GEM_ENV - expect(@gem_env).to receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(double('rbx_gem_env', :stdout => gem_env_out)) + expect(@gem_env).to receive(:shell_out!).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) - expect(Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache['/usr/weird/bin/gem']).to eq(Gem.platforms) + expect(Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache["/usr/weird/bin/gem"]).to eq(Gem.platforms) end it "yields to a block while masquerading as a different gems platform" do original_platforms = Gem.platforms platforms_in_block = nil begin - @gem_env.with_gem_platforms(['ruby', Gem::Platform.new('sparc64-java-1.7')]) do + @gem_env.with_gem_platforms(["ruby", Gem::Platform.new("sparc64-java-1.7")]) do platforms_in_block = Gem.platforms raise "gem platforms should get set to the correct value even when an error occurs" end rescue RuntimeError end - expect(platforms_in_block).to eq(['ruby', Gem::Platform.new('sparc64-java-1.7')]) + expect(platforms_in_block).to eq(["ruby", Gem::Platform.new("sparc64-java-1.7")]) expect(Gem.platforms).to eq(original_platforms) end @@ -336,9 +336,9 @@ describe Chef::Provider::Package::Rubygems do @run_context = Chef::RunContext.new(@node, {}, @events) # We choose detect omnibus via RbConfig::CONFIG['bindir'] in Chef::Provider::Package::Rubygems.new - allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("/usr/bin/ruby") + allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return("/usr/bin/ruby") # Rubygems uses this interally - allow(RbConfig::CONFIG).to receive(:[]).with('arch').and_call_original + allow(RbConfig::CONFIG).to receive(:[]).with("arch").and_call_original @provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context) end @@ -364,45 +364,45 @@ describe Chef::Provider::Package::Rubygems do end it "uses the AlternateGemEnvironment implementation when a gem_binary_path is provided" do - @new_resource.gem_binary('/usr/weird/bin/gem') + @new_resource.gem_binary("/usr/weird/bin/gem") provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context) - expect(provider.gem_env.gem_binary_location).to eq('/usr/weird/bin/gem') + expect(provider.gem_env.gem_binary_location).to eq("/usr/weird/bin/gem") end it "recognizes chef as omnibus" do - allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("/opt/chef/embedded/bin") + allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return("/opt/chef/embedded/bin") provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context) expect(provider.is_omnibus?).to be true end it "recognizes opscode as omnibus" do - allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("/opt/opscode/embedded/bin") + allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return("/opt/opscode/embedded/bin") provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context) expect(provider.is_omnibus?).to be true end it "recognizes chefdk as omnibus" do - allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("/opt/chefdk/embedded/bin") + allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return("/opt/chefdk/embedded/bin") provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context) expect(provider.is_omnibus?).to be true end it "searches for a gem binary when running on Omnibus on Unix" do platform_mock :unix do - allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("/opt/chef/embedded/bin") - allow(ENV).to receive(:[]).with('PATH').and_return("/usr/bin:/usr/sbin:/opt/chef/embedded/bin") - allow(File).to receive(:exists?).with('/usr/bin/gem').and_return(false) - allow(File).to receive(:exists?).with('/usr/sbin/gem').and_return(true) - allow(File).to receive(:exists?).with('/opt/chef/embedded/bin/gem').and_return(true) # should not get here + allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return("/opt/chef/embedded/bin") + allow(ENV).to receive(:[]).with("PATH").and_return("/usr/bin:/usr/sbin:/opt/chef/embedded/bin") + allow(File).to receive(:exists?).with("/usr/bin/gem").and_return(false) + allow(File).to receive(:exists?).with("/usr/sbin/gem").and_return(true) + allow(File).to receive(:exists?).with("/opt/chef/embedded/bin/gem").and_return(true) # should not get here provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context) - expect(provider.gem_env.gem_binary_location).to eq('/usr/sbin/gem') + expect(provider.gem_env.gem_binary_location).to eq("/usr/sbin/gem") end end it "searches for a gem binary when running on Omnibus on Windows" do platform_mock :windows do - allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("d:/opscode/chef/embedded/bin") - allow(ENV).to receive(:[]).with('PATH').and_return('C:\windows\system32;C:\windows;C:\Ruby186\bin;d:\opscode\chef\embedded\bin') + allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return("d:/opscode/chef/embedded/bin") + allow(ENV).to receive(:[]).with("PATH").and_return('C:\windows\system32;C:\windows;C:\Ruby186\bin;d:\opscode\chef\embedded\bin') allow(File).to receive(:exists?).with('C:\\windows\\system32\\gem').and_return(false) allow(File).to receive(:exists?).with('C:\\windows\\gem').and_return(false) allow(File).to receive(:exists?).with('C:\\Ruby186\\bin\\gem').and_return(true) @@ -414,15 +414,15 @@ describe Chef::Provider::Package::Rubygems do end it "smites you when you try to use a hash of install options with an explicit gem binary" do - @new_resource.gem_binary('/foo/bar') + @new_resource.gem_binary("/foo/bar") @new_resource.options(:fail => :burger) expect {Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)}.to raise_error(ArgumentError) end it "converts the new resource into a gem dependency" do - expect(@provider.gem_dependency).to eq(Gem::Dependency.new('rspec-core', @spec_version)) - @new_resource.version('~> 1.2.0') - expect(@provider.gem_dependency).to eq(Gem::Dependency.new('rspec-core', '~> 1.2.0')) + expect(@provider.gem_dependency).to eq(Gem::Dependency.new("rspec-core", @spec_version)) + @new_resource.version("~> 1.2.0") + expect(@provider.gem_dependency).to eq(Gem::Dependency.new("rspec-core", "~> 1.2.0")) end describe "when determining the currently installed version" do @@ -433,7 +433,7 @@ describe Chef::Provider::Package::Rubygems do end it "sets the current version to the highest installed version if the requested version is not installed" do - @new_resource.version('9000.0.2') + @new_resource.version("9000.0.2") @provider.load_current_resource expect(@provider.current_resource.version).to eq(@spec_version) end @@ -454,31 +454,31 @@ describe Chef::Provider::Package::Rubygems do end it "determines the candidate version by querying the remote gem servers" do - @new_resource.source('http://mygems.example.com') + @new_resource.source("http://mygems.example.com") @provider.load_current_resource - @provider.current_resource.version('0.0.1') + @provider.current_resource.version("0.0.1") version = Gem::Version.new(@spec_version) expect(@provider.gem_env).to receive(:candidate_version_from_remote). - with(Gem::Dependency.new('rspec-core', @spec_version), "http://mygems.example.com"). + with(Gem::Dependency.new("rspec-core", @spec_version), "http://mygems.example.com"). and_return(version) expect(@provider.candidate_version).to eq(@spec_version) end it "parses the gem's specification if the requested source is a file" do - @new_resource.package_name('chef-integration-test') - @new_resource.source(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') - @new_resource.version('>= 0') + @new_resource.package_name("chef-integration-test") + @new_resource.source(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem") + @new_resource.version(">= 0") @provider.load_current_resource - expect(@provider.candidate_version).to eq('0.1.0') + expect(@provider.candidate_version).to eq("0.1.0") end end describe "when installing a gem" do before do - @current_resource = Chef::Resource::GemPackage.new('rspec-core') + @current_resource = Chef::Resource::GemPackage.new("rspec-core") @provider.current_resource = @current_resource - @gem_dep = Gem::Dependency.new('rspec-core', @spec_version) + @gem_dep = Gem::Dependency.new("rspec-core", @spec_version) allow(@provider).to receive(:load_current_resource) end @@ -490,26 +490,26 @@ describe Chef::Provider::Package::Rubygems do end it "installs the gem via the gems api when a remote source is provided" do - @new_resource.source('http://gems.example.org') - sources = ['http://gems.example.org'] + @new_resource.source("http://gems.example.org") + sources = ["http://gems.example.org"] expect(@provider.gem_env).to receive(:install).with(@gem_dep, :sources => sources) @provider.run_action(:install) expect(@new_resource).to be_updated_by_last_action end it "installs the gem from file via the gems api when no explicit options are used" do - @new_resource.source(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') - expect(@provider.gem_env).to receive(:install).with(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') + @new_resource.source(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem") + expect(@provider.gem_env).to receive(:install).with(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem") @provider.run_action(:install) expect(@new_resource).to be_updated_by_last_action end it "installs the gem from file via the gems api when the package is a path and the source is nil" do - @new_resource = Chef::Resource::GemPackage.new(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') + @new_resource = Chef::Resource::GemPackage.new(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem") @provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context) @provider.current_resource = @current_resource - expect(@new_resource.source).to eq(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') - expect(@provider.gem_env).to receive(:install).with(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') + expect(@new_resource.source).to eq(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem") + expect(@provider.gem_env).to receive(:install).with(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem") @provider.run_action(:install) expect(@new_resource).to be_updated_by_last_action end @@ -517,14 +517,14 @@ describe Chef::Provider::Package::Rubygems do # this catches 'gem_package "foo"' when "./foo" is a file in the cwd, and instead of installing './foo' it fetches the remote gem it "installs the gem via the gems api, when the package has no file separator characters in it, but a matching file exists in cwd" do allow(::File).to receive(:exists?).and_return(true) - @new_resource.package_name('rspec-core') + @new_resource.package_name("rspec-core") expect(@provider.gem_env).to receive(:install).with(@gem_dep, :sources => nil) @provider.run_action(:install) expect(@new_resource).to be_updated_by_last_action end it "installs the gem by shelling out when options are provided as a String" do - @new_resource.options('-i /alt/install/location') + @new_resource.options("-i /alt/install/location") expected ="gem install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\" -i /alt/install/location" expect(@provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900) @provider.run_action(:install) @@ -532,8 +532,8 @@ describe Chef::Provider::Package::Rubygems do end it "installs the gem with rubygems.org as an added source" do - @new_resource.gem_binary('/foo/bar') - @new_resource.source('http://mirror.ops.rhcloud.com/mirror/ruby') + @new_resource.gem_binary("/foo/bar") + @new_resource.source("http://mirror.ops.rhcloud.com/mirror/ruby") expected ="/foo/bar install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\" --source=#{@new_resource.source} --source=https://rubygems.org" expect(@provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900) @provider.run_action(:install) @@ -541,8 +541,8 @@ describe Chef::Provider::Package::Rubygems do end it "installs the gem with cleared sources and explict source when specified" do - @new_resource.gem_binary('/foo/bar') - @new_resource.source('http://mirror.ops.rhcloud.com/mirror/ruby') + @new_resource.gem_binary("/foo/bar") + @new_resource.source("http://mirror.ops.rhcloud.com/mirror/ruby") @new_resource.clear_sources(true) expected ="/foo/bar install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\" --clear-sources --source=#{@new_resource.source}" expect(@provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900) @@ -554,7 +554,7 @@ describe Chef::Provider::Package::Rubygems do let(:target_version) { nil } it "installs the gem by shelling out when options are provided but no version is given" do - @new_resource.options('-i /alt/install/location') + @new_resource.options("-i /alt/install/location") expected ="gem install rspec-core -q --no-rdoc --no-ri -v \"#{@provider.candidate_version}\" -i /alt/install/location" expect(@provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900) @provider.run_action(:install) @@ -563,15 +563,15 @@ describe Chef::Provider::Package::Rubygems do end it "installs the gem via the gems api when options are given as a Hash" do - @new_resource.options(:install_dir => '/alt/install/location') - expect(@provider.gem_env).to receive(:install).with(@gem_dep, :sources => nil, :install_dir => '/alt/install/location') + @new_resource.options(:install_dir => "/alt/install/location") + expect(@provider.gem_env).to receive(:install).with(@gem_dep, :sources => nil, :install_dir => "/alt/install/location") @provider.run_action(:install) expect(@new_resource).to be_updated_by_last_action end describe "at a specific version" do before do - @gem_dep = Gem::Dependency.new('rspec-core', @spec_version) + @gem_dep = Gem::Dependency.new("rspec-core", @spec_version) end it "installs the gem via the gems api" do @@ -601,28 +601,28 @@ describe Chef::Provider::Package::Rubygems do describe "in an alternate gem environment" do it "installs the gem by shelling out to gem install" do - @new_resource.gem_binary('/usr/weird/bin/gem') + @new_resource.gem_binary("/usr/weird/bin/gem") expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\"", env: nil, timeout: 900) @provider.run_action(:install) expect(@new_resource).to be_updated_by_last_action end it "installs the gem from file by shelling out to gem install" do - @new_resource.gem_binary('/usr/weird/bin/gem') - @new_resource.source(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') - @new_resource.version('>= 0') + @new_resource.gem_binary("/usr/weird/bin/gem") + @new_resource.source(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem") + @new_resource.version(">= 0") expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install #{CHEF_SPEC_DATA}/gems/chef-integration-test-0.1.0.gem -q --no-rdoc --no-ri -v \">= 0\"", env: nil, timeout: 900) @provider.run_action(:install) expect(@new_resource).to be_updated_by_last_action end it "installs the gem from file by shelling out to gem install when the package is a path and the source is nil" do - @new_resource = Chef::Resource::GemPackage.new(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') + @new_resource = Chef::Resource::GemPackage.new(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem") @provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context) @provider.current_resource = @current_resource - @new_resource.gem_binary('/usr/weird/bin/gem') - @new_resource.version('>= 0') - expect(@new_resource.source).to eq(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') + @new_resource.gem_binary("/usr/weird/bin/gem") + @new_resource.version(">= 0") + expect(@new_resource.source).to eq(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem") expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install #{CHEF_SPEC_DATA}/gems/chef-integration-test-0.1.0.gem -q --no-rdoc --no-ri -v \">= 0\"", env: nil, timeout: 900) @provider.run_action(:install) expect(@new_resource).to be_updated_by_last_action @@ -635,7 +635,7 @@ describe Chef::Provider::Package::Rubygems do before do @new_resource = Chef::Resource::GemPackage.new("rspec") @current_resource = @new_resource.dup - @current_resource.version('1.2.3') + @current_resource.version("1.2.3") @provider.new_resource = @new_resource @provider.current_resource = @current_resource end @@ -646,7 +646,7 @@ describe Chef::Provider::Package::Rubygems do expect(@provider.new_resource.version).to be_nil expect(@provider.current_resource.version).not_to be_nil # the behavior we're testing: - expect(@provider.gem_env).to receive(:uninstall).with('rspec', nil) + expect(@provider.gem_env).to receive(:uninstall).with("rspec", nil) @provider.action_remove end @@ -655,27 +655,27 @@ describe Chef::Provider::Package::Rubygems do expect(@provider.new_resource.version).to be_nil expect(@provider.current_resource.version).not_to be_nil # the behavior we're testing: - @new_resource.options(:install_dir => '/alt/install/location') - expect(@provider.gem_env).to receive(:uninstall).with('rspec', nil, :install_dir => '/alt/install/location') + @new_resource.options(:install_dir => "/alt/install/location") + expect(@provider.gem_env).to receive(:uninstall).with("rspec", nil, :install_dir => "/alt/install/location") @provider.action_remove end it "uninstalls via the gem command when options are given as a String" do - @new_resource.options('-i /alt/install/location') + @new_resource.options("-i /alt/install/location") expect(@provider).to receive(:shell_out!).with("gem uninstall rspec -q -x -I -a -i /alt/install/location", env: nil, timeout: 900) @provider.action_remove end it "uninstalls a specific version of a gem when a version is provided" do - @new_resource.version('1.2.3') - expect(@provider.gem_env).to receive(:uninstall).with('rspec', '1.2.3') + @new_resource.version("1.2.3") + expect(@provider.gem_env).to receive(:uninstall).with("rspec", "1.2.3") @provider.action_remove end end describe "in an alternate gem environment" do it "uninstalls via the gem command" do - @new_resource.gem_binary('/usr/weird/bin/gem') + @new_resource.gem_binary("/usr/weird/bin/gem") expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem uninstall rspec -q -x -I -a", env: nil, timeout: 900) @provider.action_remove end diff --git a/spec/unit/provider/package/smartos_spec.rb b/spec/unit/provider/package/smartos_spec.rb index 8f2d2bb8ea..93bfcb7a39 100644 --- a/spec/unit/provider/package/smartos_spec.rb +++ b/spec/unit/provider/package/smartos_spec.rb @@ -18,7 +18,7 @@ # require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "spec_helper")) -require 'ostruct' +require "ostruct" describe Chef::Provider::Package::SmartOS, "load_current_resource" do before(:each) do @@ -81,8 +81,8 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do expect(search).to receive(:each_line). 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) + @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.candidate_version).to eq("2.3.4") end @@ -91,8 +91,8 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do expect(search).to receive(:each_line). 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) + @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.candidate_version).to eq("2.3.4") end end diff --git a/spec/unit/provider/package/solaris_spec.rb b/spec/unit/provider/package/solaris_spec.rb index ae6c96da00..722007a6b0 100644 --- a/spec/unit/provider/package/solaris_spec.rb +++ b/spec/unit/provider/package/solaris_spec.rb @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -require 'spec_helper' +require "spec_helper" describe Chef::Provider::Package::Solaris do before(:each) do diff --git a/spec/unit/provider/package/windows/exe_spec.rb b/spec/unit/provider/package/windows/exe_spec.rb index 6756ffa9e0..18c1c2cd5d 100644 --- a/spec/unit/provider/package/windows/exe_spec.rb +++ b/spec/unit/provider/package/windows/exe_spec.rb @@ -16,8 +16,8 @@ # limitations under the License. # -require 'spec_helper' -require 'chef/provider/package/windows/exe' +require "spec_helper" +require "chef/provider/package/windows/exe" unless Chef::Platform.windows? class Chef @@ -41,14 +41,14 @@ describe Chef::Provider::Package::Windows::Exe do end let(:uninstall_hash) do [{ - 'DisplayVersion' => 'outdated', - 'UninstallString' => File.join("uninst_dir", "uninst_file"), + "DisplayVersion" => "outdated", + "UninstallString" => File.join("uninst_dir", "uninst_file"), }] end let(:uninstall_entry) do entries = [] uninstall_hash.each do |entry| - entries.push(Chef::Provider::Package::Windows::RegistryUninstallEntry.new('hive', 'key', entry)) + entries.push(Chef::Provider::Package::Windows::RegistryUninstallEntry.new("hive", "key", entry)) end entries end @@ -100,8 +100,8 @@ describe Chef::Provider::Package::Windows::Exe do end it "returns the version attribute if given" do - new_resource.version('v55555') - expect(provider.package_version).to eql('v55555') + new_resource.version("v55555") + expect(provider.package_version).to eql("v55555") end it "returns nil if no version given" do @@ -121,19 +121,19 @@ describe Chef::Provider::Package::Windows::Exe do let(:uninstall_hash) do [ { - 'DisplayVersion' => 'v1', - 'UninstallString' => File.join("uninst_dir1", "uninst_file1"), + "DisplayVersion" => "v1", + "UninstallString" => File.join("uninst_dir1", "uninst_file1"), }, { - 'DisplayVersion' => 'v2', - 'UninstallString' => File.join("uninst_dir2", "uninst_file2"), + "DisplayVersion" => "v2", + "UninstallString" => File.join("uninst_dir2", "uninst_file2"), }, ] end context "version given and installed" do it "removes given version" do - new_resource.version('v2') + new_resource.version("v2") expect(provider).to receive(:shell_out!).with(/start \"\" \/wait \/d\"uninst_dir2\" uninst_file2 \/S \/NCRC & exit %%%%ERRORLEVEL%%%%/, kind_of(Hash)) provider.remove_package end diff --git a/spec/unit/provider/package/windows/msi_spec.rb b/spec/unit/provider/package/windows/msi_spec.rb index 835bd4ad19..86067ce8c8 100644 --- a/spec/unit/provider/package/windows/msi_spec.rb +++ b/spec/unit/provider/package/windows/msi_spec.rb @@ -16,13 +16,13 @@ # limitations under the License. # -require 'spec_helper' -require 'chef/provider/package/windows/msi' +require "spec_helper" +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(:run_context) { double('Chef::RunContext', :node => node, :events => events) } + let(:node) { double("Chef::Node") } + 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" } let(:resource_version) { nil } @@ -34,14 +34,14 @@ describe Chef::Provider::Package::Windows::MSI do end let(:uninstall_hash) do [{ - 'DisplayVersion' => 'outdated', - 'UninstallString' => "MsiExec.exe /X{guid}", + "DisplayVersion" => "outdated", + "UninstallString" => "MsiExec.exe /X{guid}", }] end let(:uninstall_entry) do entries = [] uninstall_hash.each do |entry| - entries.push(Chef::Provider::Package::Windows::RegistryUninstallEntry.new('hive', 'key', entry)) + entries.push(Chef::Provider::Package::Windows::RegistryUninstallEntry.new("hive", "key", entry)) end entries end @@ -129,12 +129,12 @@ describe Chef::Provider::Package::Windows::MSI do let(:uninstall_hash) do [ { - 'DisplayVersion' => 'outdated', - 'UninstallString' => "MsiExec.exe /X{guid}", + "DisplayVersion" => "outdated", + "UninstallString" => "MsiExec.exe /X{guid}", }, { - 'DisplayVersion' => 'really_outdated', - 'UninstallString' => "MsiExec.exe /X{guid2}", + "DisplayVersion" => "really_outdated", + "UninstallString" => "MsiExec.exe /X{guid2}", }, ] end diff --git a/spec/unit/provider/package/windows_spec.rb b/spec/unit/provider/package/windows_spec.rb index 200cc9888a..4771057133 100644 --- a/spec/unit/provider/package/windows_spec.rb +++ b/spec/unit/provider/package/windows_spec.rb @@ -16,9 +16,9 @@ # limitations under the License. # -require 'spec_helper' -require 'chef/provider/package/windows/exe' -require 'chef/provider/package/windows/msi' +require "spec_helper" +require "chef/provider/package/windows/exe" +require "chef/provider/package/windows/msi" describe Chef::Provider::Package::Windows, :windows_only do before(:each) do @@ -26,11 +26,11 @@ describe Chef::Provider::Package::Windows, :windows_only do allow(Chef::FileCache).to receive(:create_cache_path).with("package/").and_return(cache_path) end - let(:node) { double('Chef::Node') } - 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' } + let(:node) { double("Chef::Node") } + 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" } let(:new_resource) do new_resource = Chef::Resource::WindowsPackage.new(resource_name) new_resource.source(resource_source) if resource_source @@ -47,7 +47,7 @@ describe Chef::Provider::Package::Windows, :windows_only do shared_examples "a local file" do before(:each) do allow(Chef::Util::PathHelper).to receive(:validate_path) - allow(provider).to receive(:package_provider).and_return(double('package_provider', + allow(provider).to receive(:package_provider).and_return(double("package_provider", :installed_version => "1.0", :package_version => "2.0")) end @@ -69,7 +69,7 @@ describe Chef::Provider::Package::Windows, :windows_only do end context "when the source is a uri" do - let(:resource_source) { 'https://foo.bar/calculator.msi' } + let(:resource_source) { "https://foo.bar/calculator.msi" } context "when the source has not been downloaded" do before(:each) do @@ -134,7 +134,7 @@ describe Chef::Provider::Package::Windows, :windows_only do end context "when the source is a uri" do - let(:resource_source) { 'https://foo.bar/calculator.msi' } + let(:resource_source) { "https://foo.bar/calculator.msi" } context "when the source has not been downloaded" do before(:each) do @@ -170,15 +170,15 @@ describe Chef::Provider::Package::Windows, :windows_only do context "there is no source" do let(:uninstall_hash) do [{ - 'DisplayVersion' => 'outdated', - 'UninstallString' => "blah blah", + "DisplayVersion" => "outdated", + "UninstallString" => "blah blah", }] end let(:uninstall_key) { "blah" } let(:uninstall_entry) do entries = [] uninstall_hash.each do |entry| - entries.push(Chef::Provider::Package::Windows::RegistryUninstallEntry.new('hive', uninstall_key, entry)) + entries.push(Chef::Provider::Package::Windows::RegistryUninstallEntry.new("hive", uninstall_key, entry)) end entries end @@ -191,8 +191,8 @@ describe Chef::Provider::Package::Windows, :windows_only do context "uninstall string contains MsiExec.exe" do let(:uninstall_hash) do [{ - 'DisplayVersion' => 'outdated', - 'UninstallString' => "MsiExec.exe /X{guid}", + "DisplayVersion" => "outdated", + "UninstallString" => "MsiExec.exe /X{guid}", }] end @@ -204,8 +204,8 @@ describe Chef::Provider::Package::Windows, :windows_only do context "uninstall string ends with uninst.exe" do let(:uninstall_hash) do [{ - 'DisplayVersion' => 'outdated', - 'UninstallString' => %q{"c:/hfhfheru/uninst.exe"}, + "DisplayVersion" => "outdated", + "UninstallString" => %q{"c:/hfhfheru/uninst.exe"}, }] end @@ -237,17 +237,17 @@ describe Chef::Provider::Package::Windows, :windows_only do end it "sets installer_type to inno if the source contains inno" do - allow(::Kernel).to receive(:open).and_yield(StringIO.new('blah blah inno blah')) + allow(::Kernel).to receive(:open).and_yield(StringIO.new("blah blah inno blah")) expect(provider.installer_type).to eql(:inno) end it "sets installer_type to wise if the source contains wise" do - allow(::Kernel).to receive(:open).and_yield(StringIO.new('blah blah wise blah')) + allow(::Kernel).to receive(:open).and_yield(StringIO.new("blah blah wise blah")) expect(provider.installer_type).to eql(:wise) end it "sets installer_type to nsis if the source contains nsis" do - allow(::Kernel).to receive(:open).and_yield(StringIO.new('blah blah nullsoft blah')) + allow(::Kernel).to receive(:open).and_yield(StringIO.new("blah blah nullsoft blah")) expect(provider.installer_type).to eql(:nsis) end @@ -263,7 +263,7 @@ describe Chef::Provider::Package::Windows, :windows_only do let(:resource_source) { "setup.exe" } it "sets installer_type to installshield" do - allow(::Kernel).to receive(:open).and_yield(StringIO.new('')) + allow(::Kernel).to receive(:open).and_yield(StringIO.new("")) expect(provider.installer_type).to eql(:installshield) end end @@ -272,7 +272,7 @@ describe Chef::Provider::Package::Windows, :windows_only do let(:resource_source) { "tomfoolery.now" } it "raises an error" do - allow(::Kernel).to receive(:open).and_yield(StringIO.new('')) + allow(::Kernel).to receive(:open).and_yield(StringIO.new("")) provider.new_resource.installer_type(nil) expect { provider.installer_type }.to raise_error(Chef::Exceptions::CannotDetermineWindowsInstallerType) end @@ -313,7 +313,7 @@ describe Chef::Provider::Package::Windows, :windows_only do end context "a version is given and none is installed" do - before { new_resource.version('5.5.5') } + before { new_resource.version("5.5.5") } it "installs given version" do expect(provider).to receive(:install_package).with("blah", "5.5.5") @@ -324,7 +324,7 @@ describe Chef::Provider::Package::Windows, :windows_only do context "a version is given and several are installed" do context "given version matches an installed version" do before do - new_resource.version('5.5.5') + 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 @@ -336,7 +336,7 @@ describe Chef::Provider::Package::Windows, :windows_only do context "given version does not match an installed version" do before do - new_resource.version('5.5.5') + 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 @@ -350,7 +350,7 @@ describe Chef::Provider::Package::Windows, :windows_only do context "a version is given and one is installed" do context "given version matches installed version" do before do - new_resource.version('5.5.5') + new_resource.version("5.5.5") allow(provider).to receive(:current_version_array).and_return(["5.5.5"]) end @@ -362,7 +362,7 @@ describe Chef::Provider::Package::Windows, :windows_only do context "given version does not match installed version" do before do - new_resource.version('5.5.5') + new_resource.version("5.5.5") allow(provider).to receive(:current_version_array).and_return(["5.5.0"]) end diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb index 70ab257a54..efbbdf6450 100644 --- a/spec/unit/provider/package/yum_spec.rb +++ b/spec/unit/provider/package/yum_spec.rb @@ -16,18 +16,18 @@ # limitations under the License. # -require 'spec_helper' -require 'securerandom' +require "spec_helper" +require "securerandom" describe Chef::Provider::Package::Yum do before(:each) do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - @new_resource = Chef::Resource::YumPackage.new('cups') + @new_resource = Chef::Resource::YumPackage.new("cups") @status = double("Status", :exitstatus => 0) @yum_cache = double( - 'Chef::Provider::Yum::YumCache', + "Chef::Provider::Yum::YumCache", :reload_installed => true, :reset => true, :installed_version => "1.2.4-11.18.el5", @@ -77,15 +77,15 @@ describe Chef::Provider::Package::Yum do describe "when source is provided" do it "should set the candidate version" do - @new_resource = Chef::Resource::YumPackage.new('testing.source') + @new_resource = Chef::Resource::YumPackage.new("testing.source") @new_resource.source "chef-server-core-12.0.5-1.rpm" @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context) allow(File).to receive(:exists?).with(@new_resource.source).and_return(true) allow(@yum_cache).to receive(:installed_version).and_return(nil) - shellout_double = double(:stdout => 'chef-server-core 12.0.5-1') + shellout_double = double(:stdout => "chef-server-core 12.0.5-1") allow(@provider).to receive(:shell_out!).and_return(shellout_double) @provider.load_current_resource - expect(@provider.candidate_version).to eql('12.0.5-1') + expect(@provider.candidate_version).to eql("12.0.5-1") end end @@ -113,7 +113,7 @@ describe Chef::Provider::Package::Yum do end it "when the new_resource is a vanilla package class and yum-deprecated exists" do - @new_resource = Chef::Resource::Package.new('cups') + @new_resource = Chef::Resource::Package.new("cups") expect(File).to receive(:exist?).with("/usr/bin/yum-deprecated").and_return(true) expect(@yum_cache).to receive(:yum_binary=).with("yum-deprecated") @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context) @@ -121,7 +121,7 @@ describe Chef::Provider::Package::Yum do end it "when the new_resource is a vanilla package class and yum-deprecated does not exist" do - @new_resource = Chef::Resource::Package.new('cups') + @new_resource = Chef::Resource::Package.new("cups") expect(File).to receive(:exist?).with("/usr/bin/yum-deprecated").and_return(false) expect(@yum_cache).to receive(:yum_binary=).with("yum") @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context) @@ -131,9 +131,9 @@ describe Chef::Provider::Package::Yum do describe "when arch in package_name" do it "should set the arch if no existing package_name is found and new_package_name+new_arch is available" do - @new_resource = Chef::Resource::YumPackage.new('testing.noarch') + @new_resource = Chef::Resource::YumPackage.new("testing.noarch") @yum_cache = double( - 'Chef::Provider::Yum::YumCache' + "Chef::Provider::Yum::YumCache" ) allow(@yum_cache).to receive(:installed_version) do |package_name, arch| # nothing installed for package_name/new_package_name @@ -157,7 +157,7 @@ describe Chef::Provider::Package::Yum do expect(@provider.new_resource.arch).to eq("noarch") expect(@provider.arch).to eq("noarch") - @new_resource = Chef::Resource::YumPackage.new('testing.more.noarch') + @new_resource = Chef::Resource::YumPackage.new("testing.more.noarch") @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context) @provider.load_current_resource expect(@provider.new_resource.package_name).to eq("testing.more") @@ -167,9 +167,9 @@ describe Chef::Provider::Package::Yum do describe "when version constraint in package_name" do it "should set package_version if no existing package_name is found and new_package_name is available" do - @new_resource = Chef::Resource::Package.new('cups = 1.2.4-11.18.el5_2.3') + @new_resource = Chef::Resource::Package.new("cups = 1.2.4-11.18.el5_2.3") @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context) - allow(@yum_cache).to receive(:package_available?) { |pkg| pkg == 'cups' ? true : false } + allow(@yum_cache).to receive(:package_available?) { |pkg| pkg == "cups" ? true : false } allow(@yum_cache).to receive(:packages_from_require) do |pkg| [Chef::Provider::Package::Yum::RPMDbPackage.new("cups", "1.2.4-11.18.el5_2.3", "noarch", [], false, true, "base"), Chef::Provider::Package::Yum::RPMDbPackage.new("cups", "1.2.4-11.18.el5_2.2", "noarch", [], false, true, "base")] @@ -186,9 +186,9 @@ describe Chef::Provider::Package::Yum do end it "should not set the arch when an existing package_name is found" do - @new_resource = Chef::Resource::YumPackage.new('testing.beta3') + @new_resource = Chef::Resource::YumPackage.new("testing.beta3") @yum_cache = double( - 'Chef::Provider::Yum::YumCache' + "Chef::Provider::Yum::YumCache" ) allow(@yum_cache).to receive(:installed_version) do |package_name, arch| # installed for package_name @@ -213,7 +213,7 @@ describe Chef::Provider::Package::Yum do expect(@provider.new_resource.arch).to eq(nil) expect(@provider.arch).to eq(nil) - @new_resource = Chef::Resource::YumPackage.new('testing.beta3.more') + @new_resource = Chef::Resource::YumPackage.new("testing.beta3.more") @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context) @provider.load_current_resource expect(@provider.new_resource.package_name).to eq("testing.beta3.more") @@ -222,9 +222,9 @@ describe Chef::Provider::Package::Yum do end it "should not set the arch when no existing package_name or new_package_name+new_arch is found" do - @new_resource = Chef::Resource::YumPackage.new('testing.beta3') + @new_resource = Chef::Resource::YumPackage.new("testing.beta3") @yum_cache = double( - 'Chef::Provider::Yum::YumCache' + "Chef::Provider::Yum::YumCache" ) allow(@yum_cache).to receive(:installed_version) do |package_name, arch| # nothing installed for package_name/new_package_name @@ -244,7 +244,7 @@ describe Chef::Provider::Package::Yum do expect(@provider.new_resource.arch).to eq(nil) expect(@provider.arch).to eq(nil) - @new_resource = Chef::Resource::YumPackage.new('testing.beta3.more') + @new_resource = Chef::Resource::YumPackage.new("testing.beta3.more") @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context) @provider.load_current_resource expect(@provider.new_resource.package_name).to eq("testing.beta3.more") @@ -253,10 +253,10 @@ describe Chef::Provider::Package::Yum do end it "should ensure it doesn't clobber an existing arch if passed" do - @new_resource = Chef::Resource::YumPackage.new('testing.i386') + @new_resource = Chef::Resource::YumPackage.new("testing.i386") @new_resource.arch("x86_64") @yum_cache = double( - 'Chef::Provider::Yum::YumCache' + "Chef::Provider::Yum::YumCache" ) allow(@yum_cache).to receive(:installed_version) do |package_name, arch| # nothing installed for package_name/new_package_name @@ -313,7 +313,7 @@ describe Chef::Provider::Package::Yum do context "when the package name isn't found" do let(:yum_cache) { double( - 'Chef::Provider::Yum::YumCache', + "Chef::Provider::Yum::YumCache", :reload_installed => true, :reset => true, :installed_version => "1.0.1.el5", @@ -334,61 +334,61 @@ describe Chef::Provider::Package::Yum do it "should search provides then set package_name to match" do @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context) @provider.load_current_resource - expect(@new_resource.package_name).to eq('test-package') + expect(@new_resource.package_name).to eq("test-package") expect(@new_resource.version).to eq(nil) end it "should search provides then set version to match if a requirement was passed in the package name" do - @new_resource = Chef::Resource::YumPackage.new('test-package = 2.0.1.el5') + @new_resource = Chef::Resource::YumPackage.new("test-package = 2.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') - expect(@new_resource.version).to eq('2.0.1.el5') + expect(@new_resource.package_name).to eq("test-package") + 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') + @new_resource = Chef::Resource::YumPackage.new("test-package") + @new_resource.version("= 2.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') - expect(@new_resource.version).to eq('2.0.1.el5') + expect(@new_resource.package_name).to eq("test-package") + 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') + @new_resource = Chef::Resource::YumPackage.new("test-package") + @new_resource.version("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') - expect(@new_resource.version).to eq('3.0.1.el5') + expect(@new_resource.package_name).to eq("test-package") + expect(@new_resource.version).to eq("3.0.1.el5") end it "should search provides then set versions to match if requirements were passed in the package name as an array" do - @new_resource = Chef::Resource::YumPackage.new(['test-package = 2.0.1.el5']) + @new_resource = Chef::Resource::YumPackage.new(["test-package = 2.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']) - expect(@new_resource.version).to eq(['2.0.1.el5']) + expect(@new_resource.package_name).to eq(["test-package"]) + expect(@new_resource.version).to eq(["2.0.1.el5"]) end it "should search provides and not set the versions to match if specific versions were requested in an array" do - @new_resource = Chef::Resource::YumPackage.new(['test-package']) - @new_resource.version(['3.0.1.el5']) + @new_resource = Chef::Resource::YumPackage.new(["test-package"]) + @new_resource.version(["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']) - expect(@new_resource.version).to eq(['3.0.1.el5']) + expect(@new_resource.package_name).to eq(["test-package"]) + expect(@new_resource.version).to eq(["3.0.1.el5"]) end end it "should not return an error if no version number is specified in the resource" do - @new_resource = Chef::Resource::YumPackage.new('test-package') + @new_resource = Chef::Resource::YumPackage.new("test-package") @yum_cache = double( - 'Chef::Provider::Yum::YumCache', + "Chef::Provider::Yum::YumCache", :reload_installed => true, :reset => true, :installed_version => "1.0.1.el5", @@ -408,9 +408,9 @@ describe Chef::Provider::Package::Yum do end it "should give precedence to the version attribute when both a requirement in the resource name and a version attribute are specified" do - @new_resource = Chef::Resource::YumPackage.new('test-package') + @new_resource = Chef::Resource::YumPackage.new("test-package") @yum_cache = double( - 'Chef::Provider::Yum::YumCache', + "Chef::Provider::Yum::YumCache", :reload_installed => true, :reset => true, :installed_version => "1.2.4-11.18.el5", @@ -423,17 +423,17 @@ describe Chef::Provider::Package::Yum do 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') - @new_resource.version('3.0.1.el5') + @new_resource = Chef::Resource::YumPackage.new("test-package = 2.0.1.el5") + @new_resource.version("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') - expect(@new_resource.version).to eq('3.0.1.el5') + expect(@new_resource.package_name).to eq("test-package") + expect(@new_resource.version).to eq("3.0.1.el5") end it "should correctly detect the installed states of an array of package names and version numbers" do @yum_cache = double( - 'Chef::Provider::Yum::YumCache', + "Chef::Provider::Yum::YumCache", :reload_installed => true, :reset => true, :installed_version => "1.0.1.el5", @@ -448,17 +448,17 @@ 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 @yum_cache = double( - 'Chef::Provider::Yum::YumCache', + "Chef::Provider::Yum::YumCache", :reload_installed => true, :reset => true, :installed_version => "1.2.4-11.18.el5", @@ -478,7 +478,7 @@ describe Chef::Provider::Package::Yum do it "should search provides if no package is available and not load the complete set if action is :remove or :purge" do @yum_cache = double( - 'Chef::Provider::Yum::YumCache', + "Chef::Provider::Yum::YumCache", :reload_installed => true, :reset => true, :installed_version => "1.2.4-11.18.el5", @@ -502,7 +502,7 @@ describe Chef::Provider::Package::Yum do it "should search provides if no package is available - if no match in provides leave the name intact" do @yum_cache = double( - 'Chef::Provider::Yum::YumCache', + "Chef::Provider::Yum::YumCache", :reload_provides => true, :reload_installed => true, :reset => true, @@ -562,7 +562,7 @@ describe Chef::Provider::Package::Yum do it "installs the package with the options given in the resource" do @provider.load_current_resource - allow(@provider).to receive(:candidate_version).and_return('11') + allow(@provider).to receive(:candidate_version).and_return("11") allow(@new_resource).to receive(:options).and_return("--disablerepo epmd") allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1) expect(@provider).to receive(:yum_command).with( @@ -573,7 +573,7 @@ describe Chef::Provider::Package::Yum do it "should raise an exception if the package is not available" do @yum_cache = double( - 'Chef::Provider::Yum::YumCache', + "Chef::Provider::Yum::YumCache", :reload_from_cache => true, :reset => true, :installed_version => "1.2.4-11.18.el5", @@ -591,7 +591,7 @@ describe Chef::Provider::Package::Yum do it "should raise an exception if candidate version is older than the installed version and allow_downgrade is false" do allow(@new_resource).to receive(:allow_downgrade).and_return(false) @yum_cache = double( - 'Chef::Provider::Yum::YumCache', + "Chef::Provider::Yum::YumCache", :reload_installed => true, :reset => true, :installed_version => "1.2.4-11.18.el5", @@ -610,7 +610,7 @@ describe Chef::Provider::Package::Yum do it "should not raise an exception if candidate version is older than the installed version and the package is list in yum's installonlypkg option" do @yum_cache = double( - 'Chef::Provider::Yum::YumCache', + "Chef::Provider::Yum::YumCache", :reload_installed => true, :reset => true, :installed_version => "1.2.4-11.18.el5", @@ -634,7 +634,7 @@ describe Chef::Provider::Package::Yum do it "should run yum downgrade if candidate version is older than the installed version and allow_downgrade is true" do allow(@new_resource).to receive(:allow_downgrade).and_return(true) @yum_cache = double( - 'Chef::Provider::Yum::YumCache', + "Chef::Provider::Yum::YumCache", :reload_installed => true, :reset => true, :installed_version => "1.2.4-11.18.el5", @@ -681,7 +681,7 @@ describe Chef::Provider::Package::Yum do describe "when upgrading a package" do it "should run yum install if the package is installed and a version is given" do @provider.load_current_resource - allow(@provider).to receive(:candidate_version).and_return('11') + allow(@provider).to receive(:candidate_version).and_return("11") allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1) expect(@provider).to receive(:yum_command).with( "-d0 -e0 -y install cups-11" @@ -691,8 +691,8 @@ describe Chef::Provider::Package::Yum do it "should run yum install if the package is not installed" do @provider.load_current_resource - @current_resource = Chef::Resource::Package.new('cups') - allow(@provider).to receive(:candidate_version).and_return('11') + @current_resource = Chef::Resource::Package.new("cups") + allow(@provider).to receive(:candidate_version).and_return("11") allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1) expect(@provider).to receive(:yum_command).with( "-d0 -e0 -y install cups-11" @@ -702,7 +702,7 @@ describe Chef::Provider::Package::Yum do it "should raise an exception if candidate version is older than the installed version" do @yum_cache = double( - 'Chef::Provider::Yum::YumCache', + "Chef::Provider::Yum::YumCache", :reload_installed => true, :reset => true, :installed_version => "1.2.4-11.18.el5", @@ -722,8 +722,8 @@ describe Chef::Provider::Package::Yum do # Test our little workaround, some crossover into Chef::Provider::Package territory it "should call action_upgrade in the parent if the current resource version is nil" do allow(@yum_cache).to receive(:installed_version).and_return(nil) - @current_resource = Chef::Resource::Package.new('cups') - allow(@provider).to receive(:candidate_version).and_return('11') + @current_resource = Chef::Resource::Package.new("cups") + allow(@provider).to receive(:candidate_version).and_return("11") expect(@provider).to receive(:upgrade_package).with( "cups", "11", @@ -733,7 +733,7 @@ describe Chef::Provider::Package::Yum do it "should call action_upgrade in the parent if the candidate version is nil" do @provider.load_current_resource - @current_resource = Chef::Resource::Package.new('cups') + @current_resource = Chef::Resource::Package.new("cups") allow(@provider).to receive(:candidate_version).and_return(nil) expect(@provider).not_to receive(:upgrade_package) @provider.run_action(:upgrade) @@ -741,8 +741,8 @@ describe Chef::Provider::Package::Yum do it "should call action_upgrade in the parent if the candidate is newer" do @provider.load_current_resource - @current_resource = Chef::Resource::Package.new('cups') - allow(@provider).to receive(:candidate_version).and_return('11') + @current_resource = Chef::Resource::Package.new("cups") + allow(@provider).to receive(:candidate_version).and_return("11") expect(@provider).to receive(:upgrade_package).with( "cups", "11", @@ -753,8 +753,8 @@ describe Chef::Provider::Package::Yum do it "should not call action_upgrade in the parent if the candidate is older" do allow(@yum_cache).to receive(:installed_version).and_return("12") @provider.load_current_resource - @current_resource = Chef::Resource::Package.new('cups') - allow(@provider).to receive(:candidate_version).and_return('11') + @current_resource = Chef::Resource::Package.new("cups") + allow(@provider).to receive(:candidate_version).and_return("11") expect(@provider).not_to receive(:upgrade_package) @provider.run_action(:upgrade) end @@ -989,37 +989,37 @@ describe Chef::Provider::Package::Yum::RPMUtils do end it "tests isalnum good input" do - [ 'a', 'z', 'A', 'Z', '0', '9' ].each do |t| + [ "a", "z", "A", "Z", "0", "9" ].each do |t| expect(@rpmutils.isalnum(t)).to eq(true) end end it "tests isalnum bad input" do - [ '-', '.', '!', '^', ':', '_' ].each do |t| + [ "-", ".", "!", "^", ":", "_" ].each do |t| expect(@rpmutils.isalnum(t)).to eq(false) end end it "tests isalpha good input" do - [ 'a', 'z', 'A', 'Z' ].each do |t| + [ "a", "z", "A", "Z" ].each do |t| expect(@rpmutils.isalpha(t)).to eq(true) end end it "tests isalpha bad input" do - [ '0', '9', '-', '.', '!', '^', ':', '_' ].each do |t| + [ "0", "9", "-", ".", "!", "^", ":", "_" ].each do |t| expect(@rpmutils.isalpha(t)).to eq(false) end end it "tests isdigit good input" do - [ '0', '9' ].each do |t| + [ "0", "9" ].each do |t| expect(@rpmutils.isdigit(t)).to eq(true) end end it "tests isdigit bad input" do - [ 'A', 'z', '-', '.', '!', '^', ':', '_' ].each do |t| + [ "A", "z", "-", ".", "!", "^", ":", "_" ].each do |t| expect(@rpmutils.isdigit(t)).to eq(false) end end @@ -2115,18 +2115,18 @@ describe "Chef::Provider::Package::Yum - Multi" do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - @new_resource = Chef::Resource::Package.new(['cups', 'vim']) + @new_resource = Chef::Resource::Package.new(["cups", "vim"]) @status = double("Status", :exitstatus => 0) @yum_cache = double( - 'Chef::Provider::Yum::YumCache', + "Chef::Provider::Yum::YumCache", :reload_installed => true, :reset => true, - :installed_version => 'XXXX', - :candidate_version => 'YYYY', + :installed_version => "XXXX", + :candidate_version => "YYYY", :package_available? => true, :version_available? => true, - :allow_multi_install => [ 'kernel' ], - :package_repository => 'base', + :allow_multi_install => [ "kernel" ], + :package_repository => "base", :disable_extra_repo_control => true, ) allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache) @@ -2139,12 +2139,12 @@ describe "Chef::Provider::Package::Yum - Multi" do describe "when loading the current system state" do it "should create a current resource with the name of the new_resource" do @provider.load_current_resource - expect(@provider.current_resource.name).to eq('cups, vim') + expect(@provider.current_resource.name).to eq("cups, vim") end it "should set the current resources package name to the new resources package name" do @provider.load_current_resource - expect(@provider.current_resource.package_name).to eq(['cups', 'vim']) + expect(@provider.current_resource.package_name).to eq(["cups", "vim"]) end it "should set the installed version to nil on the current resource if no installed package" do @@ -2154,21 +2154,21 @@ describe "Chef::Provider::Package::Yum - Multi" do end it "should set the installed version if yum has one" do - allow(@yum_cache).to receive(:installed_version).with('cups', nil).and_return('1.2.4-11.18.el5') - allow(@yum_cache).to receive(:installed_version).with('vim', nil).and_return('1.0') - allow(@yum_cache).to receive(:candidate_version).with('cups', nil).and_return('1.2.4-11.18.el5_2.3') - allow(@yum_cache).to receive(:candidate_version).with('vim', nil).and_return('1.5') + allow(@yum_cache).to receive(:installed_version).with("cups", nil).and_return("1.2.4-11.18.el5") + allow(@yum_cache).to receive(:installed_version).with("vim", nil).and_return("1.0") + allow(@yum_cache).to receive(:candidate_version).with("cups", nil).and_return("1.2.4-11.18.el5_2.3") + allow(@yum_cache).to receive(:candidate_version).with("vim", nil).and_return("1.5") @provider.load_current_resource - expect(@provider.current_resource.version).to eq(['1.2.4-11.18.el5', '1.0']) + expect(@provider.current_resource.version).to eq(["1.2.4-11.18.el5", "1.0"]) end it "should set the candidate version if yum info has one" do - allow(@yum_cache).to receive(:installed_version).with('cups', nil).and_return('1.2.4-11.18.el5') - allow(@yum_cache).to receive(:installed_version).with('vim', nil).and_return('1.0') - allow(@yum_cache).to receive(:candidate_version).with('cups', nil).and_return('1.2.4-11.18.el5_2.3') - allow(@yum_cache).to receive(:candidate_version).with('vim', nil).and_return('1.5') + allow(@yum_cache).to receive(:installed_version).with("cups", nil).and_return("1.2.4-11.18.el5") + allow(@yum_cache).to receive(:installed_version).with("vim", nil).and_return("1.0") + allow(@yum_cache).to receive(:candidate_version).with("cups", nil).and_return("1.2.4-11.18.el5_2.3") + allow(@yum_cache).to receive(:candidate_version).with("vim", nil).and_return("1.5") @provider.load_current_resource - expect(@provider.candidate_version).to eql(['1.2.4-11.18.el5_2.3', '1.5']) + expect(@provider.candidate_version).to eql(["1.2.4-11.18.el5_2.3", "1.5"]) end it "should return the current resouce" do @@ -2177,20 +2177,20 @@ describe "Chef::Provider::Package::Yum - Multi" do describe "when version constraint in package_name" do it "should set package_version if no existing package_name is found and new_package_name is available" do - @new_resource = Chef::Resource::Package.new(['cups = 1.2.4-11.18.el5_2.3', 'emacs = 24.4']) + @new_resource = Chef::Resource::Package.new(["cups = 1.2.4-11.18.el5_2.3", "emacs = 24.4"]) @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context) allow(@yum_cache).to receive(:package_available?) { |pkg| %w(cups emacs).include?(pkg) ? true : false } allow(@yum_cache).to receive(:candidate_version) do |pkg| - if pkg == 'cups' + if pkg == "cups" "1.2.4-11.18.el5_2.3" - elsif pkg == 'emacs' + elsif pkg == "emacs" "24.4" end end allow(@yum_cache).to receive(:packages_from_require) do |pkg| - if pkg.name == 'cups' + if pkg.name == "cups" [Chef::Provider::Package::Yum::RPMDbPackage.new("cups", "1.2.4-11.18.el5_2.3", "noarch", [], false, true, "base")] - elsif pkg.name == 'emacs' + elsif pkg.name == "emacs" [Chef::Provider::Package::Yum::RPMDbPackage.new("emacs", "24.4", "noarch", [], false, true, "base")] end end @@ -2210,12 +2210,12 @@ describe "Chef::Provider::Package::Yum - Multi" do it "should run yum install with the package name and version" do @provider.load_current_resource allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1) - allow(@yum_cache).to receive(:installed_version).with('cups', nil).and_return('1.2.4-11.18.el5') - allow(@yum_cache).to receive(:installed_version).with('vim', nil).and_return('0.9') + allow(@yum_cache).to receive(:installed_version).with("cups", nil).and_return("1.2.4-11.18.el5") + allow(@yum_cache).to receive(:installed_version).with("vim", nil).and_return("0.9") expect(@provider).to receive(:yum_command).with( "-d0 -e0 -y install cups-1.2.4-11.19.el5 vim-1.0" ) - @provider.install_package(["cups", "vim"], ["1.2.4-11.19.el5", '1.0']) + @provider.install_package(["cups", "vim"], ["1.2.4-11.19.el5", "1.0"]) end it "should run yum install with the package name, version and arch" do @@ -2231,17 +2231,17 @@ describe "Chef::Provider::Package::Yum - Multi" do it "installs the package with the options given in the resource" do @provider.load_current_resource allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1) - allow(@yum_cache).to receive(:installed_version).with('cups', nil).and_return('1.2.4-11.18.el5') - allow(@yum_cache).to receive(:installed_version).with('vim', nil).and_return('0.9') + allow(@yum_cache).to receive(:installed_version).with("cups", nil).and_return("1.2.4-11.18.el5") + allow(@yum_cache).to receive(:installed_version).with("vim", nil).and_return("0.9") expect(@provider).to receive(:yum_command).with( "-d0 -e0 -y --disablerepo epmd install cups-1.2.4-11.19.el5 vim-1.0" ) allow(@new_resource).to receive(:options).and_return("--disablerepo epmd") - @provider.install_package(["cups", "vim"], ["1.2.4-11.19.el5", '1.0']) + @provider.install_package(["cups", "vim"], ["1.2.4-11.19.el5", "1.0"]) end it "should run yum install with the package name and version when name has arch" do - @new_resource = Chef::Resource::Package.new(['cups.x86_64', 'vim']) + @new_resource = Chef::Resource::Package.new(["cups.x86_64", "vim"]) @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context) allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1) @@ -2249,20 +2249,20 @@ describe "Chef::Provider::Package::Yum - Multi" do # and we need to craft the right response. The default mock setup above # will just return valid versions all the time which won't work for this # test. - allow(@yum_cache).to receive(:installed_version).with('cups', 'x86_64').and_return('XXXX') - allow(@yum_cache).to receive(:candidate_version).with('cups', 'x86_64').and_return('1.2.4-11.18.el5') - allow(@yum_cache).to receive(:installed_version).with('cups.x86_64').and_return(nil) - allow(@yum_cache).to receive(:candidate_version).with('cups.x86_64').and_return(nil) + allow(@yum_cache).to receive(:installed_version).with("cups", "x86_64").and_return("XXXX") + allow(@yum_cache).to receive(:candidate_version).with("cups", "x86_64").and_return("1.2.4-11.18.el5") + allow(@yum_cache).to receive(:installed_version).with("cups.x86_64").and_return(nil) + allow(@yum_cache).to receive(:candidate_version).with("cups.x86_64").and_return(nil) # Normal mock's for the idempotency check - allow(@yum_cache).to receive(:installed_version).with('cups', nil).and_return('1.2.4-11.18.el5') - allow(@yum_cache).to receive(:installed_version).with('vim', nil).and_return('0.9') + allow(@yum_cache).to receive(:installed_version).with("cups", nil).and_return("1.2.4-11.18.el5") + allow(@yum_cache).to receive(:installed_version).with("vim", nil).and_return("0.9") @provider.load_current_resource expect(@provider).to receive(:yum_command).with( "-d0 -e0 -y install cups-1.2.4-11.19.el5.x86_64 vim-1.0" ) - @provider.install_package(["cups", "vim"], ["1.2.4-11.19.el5", '1.0']) + @provider.install_package(["cups", "vim"], ["1.2.4-11.19.el5", "1.0"]) end end diff --git a/spec/unit/provider/package/zypper_spec.rb b/spec/unit/provider/package/zypper_spec.rb index 5fb3abe875..0f39fde5cf 100644 --- a/spec/unit/provider/package/zypper_spec.rb +++ b/spec/unit/provider/package/zypper_spec.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require 'spec_helper' +require "spec_helper" describe Chef::Provider::Package::Zypper do let!(:new_resource) { Chef::Resource::ZypperPackage.new("cups") } |