summaryrefslogtreecommitdiff
path: root/spec/unit/provider
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-01-14 14:08:03 +0000
committerThom May <thom@chef.io>2016-01-14 14:08:03 +0000
commit51cfbdc4d16739caac4d946fadbe678444aafe34 (patch)
tree56dfd8f1cd9fd933de27268b32402e955a43ac2b /spec/unit/provider
parent05064423057d4cf46f4713b81b08829cf6d20af6 (diff)
downloadchef-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')
-rw-r--r--spec/unit/provider/breakpoint_spec.rb2
-rw-r--r--spec/unit/provider/cookbook_file/content_spec.rb14
-rw-r--r--spec/unit/provider/cookbook_file_spec.rb16
-rw-r--r--spec/unit/provider/cron/unix_spec.rb10
-rw-r--r--spec/unit/provider/cron_spec.rb124
-rw-r--r--spec/unit/provider/deploy/revision_spec.rb2
-rw-r--r--spec/unit/provider/deploy/timestamped_spec.rb2
-rw-r--r--spec/unit/provider/deploy_spec.rb12
-rw-r--r--spec/unit/provider/directory_spec.rb12
-rw-r--r--spec/unit/provider/dsc_resource_spec.rb42
-rw-r--r--spec/unit/provider/dsc_script_spec.rb88
-rw-r--r--spec/unit/provider/env/windows_spec.rb30
-rw-r--r--spec/unit/provider/env_spec.rb2
-rw-r--r--spec/unit/provider/erl_call_spec.rb4
-rw-r--r--spec/unit/provider/execute_spec.rb2
-rw-r--r--spec/unit/provider/file/content_spec.rb2
-rw-r--r--spec/unit/provider/file_spec.rb10
-rw-r--r--spec/unit/provider/git_spec.rb56
-rw-r--r--spec/unit/provider/group/dscl_spec.rb10
-rw-r--r--spec/unit/provider/group/gpasswd_spec.rb2
-rw-r--r--spec/unit/provider/group/groupadd_spec.rb2
-rw-r--r--spec/unit/provider/group/groupmod_spec.rb2
-rw-r--r--spec/unit/provider/group/pw_spec.rb2
-rw-r--r--spec/unit/provider/group/usermod_spec.rb2
-rw-r--r--spec/unit/provider/group/windows_spec.rb4
-rw-r--r--spec/unit/provider/group_spec.rb6
-rw-r--r--spec/unit/provider/http_request_spec.rb4
-rw-r--r--spec/unit/provider/ifconfig/aix_spec.rb4
-rw-r--r--spec/unit/provider/ifconfig/debian_spec.rb4
-rw-r--r--spec/unit/provider/ifconfig/redhat_spec.rb4
-rw-r--r--spec/unit/provider/ifconfig_spec.rb4
-rw-r--r--spec/unit/provider/link_spec.rb20
-rw-r--r--spec/unit/provider/log_spec.rb2
-rw-r--r--spec/unit/provider/mdadm_spec.rb14
-rw-r--r--spec/unit/provider/mount/aix_spec.rb6
-rw-r--r--spec/unit/provider/mount/mount_spec.rb20
-rw-r--r--spec/unit/provider/mount/solaris_spec.rb46
-rw-r--r--spec/unit/provider/mount/windows_spec.rb2
-rw-r--r--spec/unit/provider/mount_spec.rb6
-rw-r--r--spec/unit/provider/ohai_spec.rb16
-rw-r--r--spec/unit/provider/osx_profile_spec.rb98
-rw-r--r--spec/unit/provider/package/aix_spec.rb2
-rw-r--r--spec/unit/provider/package/apt_spec.rb10
-rw-r--r--spec/unit/provider/package/chocolatey_spec.rb2
-rw-r--r--spec/unit/provider/package/dpkg_spec.rb22
-rw-r--r--spec/unit/provider/package/easy_install_spec.rb6
-rw-r--r--spec/unit/provider/package/freebsd/pkg_spec.rb8
-rw-r--r--spec/unit/provider/package/freebsd/pkgng_spec.rb20
-rw-r--r--spec/unit/provider/package/freebsd/port_spec.rb14
-rw-r--r--spec/unit/provider/package/homebrew_spec.rb274
-rw-r--r--spec/unit/provider/package/ips_spec.rb8
-rw-r--r--spec/unit/provider/package/macports_spec.rb2
-rw-r--r--spec/unit/provider/package/openbsd_spec.rb58
-rw-r--r--spec/unit/provider/package/pacman_spec.rb2
-rw-r--r--spec/unit/provider/package/paludis_spec.rb4
-rw-r--r--spec/unit/provider/package/portage_spec.rb2
-rw-r--r--spec/unit/provider/package/rpm_spec.rb6
-rw-r--r--spec/unit/provider/package/rubygems_spec.rb254
-rw-r--r--spec/unit/provider/package/smartos_spec.rb10
-rw-r--r--spec/unit/provider/package/solaris_spec.rb2
-rw-r--r--spec/unit/provider/package/windows/exe_spec.rb24
-rw-r--r--spec/unit/provider/package/windows/msi_spec.rb24
-rw-r--r--spec/unit/provider/package/windows_spec.rb56
-rw-r--r--spec/unit/provider/package/yum_spec.rb234
-rw-r--r--spec/unit/provider/package/zypper_spec.rb2
-rw-r--r--spec/unit/provider/package_spec.rb176
-rw-r--r--spec/unit/provider/powershell_script_spec.rb34
-rw-r--r--spec/unit/provider/registry_key_spec.rb2
-rw-r--r--spec/unit/provider/remote_directory_spec.rb82
-rw-r--r--spec/unit/provider/remote_file/cache_control_data_spec.rb14
-rw-r--r--spec/unit/provider/remote_file/content_spec.rb2
-rw-r--r--spec/unit/provider/remote_file/fetcher_spec.rb2
-rw-r--r--spec/unit/provider/remote_file/ftp_spec.rb2
-rw-r--r--spec/unit/provider/remote_file/http_spec.rb2
-rw-r--r--spec/unit/provider/remote_file/local_file_spec.rb2
-rw-r--r--spec/unit/provider/remote_file/network_file_spec.rb2
-rw-r--r--spec/unit/provider/remote_file_spec.rb12
-rw-r--r--spec/unit/provider/route_spec.rb42
-rw-r--r--spec/unit/provider/ruby_block_spec.rb2
-rw-r--r--spec/unit/provider/script_spec.rb16
-rw-r--r--spec/unit/provider/service/aix_service_spec.rb8
-rw-r--r--spec/unit/provider/service/aixinit_service_spec.rb24
-rw-r--r--spec/unit/provider/service/arch_service_spec.rb12
-rw-r--r--spec/unit/provider/service/debian_service_spec.rb4
-rw-r--r--spec/unit/provider/service/freebsd_service_spec.rb2
-rw-r--r--spec/unit/provider/service/gentoo_service_spec.rb2
-rw-r--r--spec/unit/provider/service/init_service_spec.rb4
-rw-r--r--spec/unit/provider/service/insserv_service_spec.rb2
-rw-r--r--spec/unit/provider/service/invokercd_service_spec.rb4
-rw-r--r--spec/unit/provider/service/macosx_spec.rb26
-rw-r--r--spec/unit/provider/service/openbsd_service_spec.rb40
-rw-r--r--spec/unit/provider/service/redhat_spec.rb4
-rw-r--r--spec/unit/provider/service/simple_service_spec.rb2
-rw-r--r--spec/unit/provider/service/solaris_smf_service_spec.rb76
-rw-r--r--spec/unit/provider/service/systemd_service_spec.rb6
-rw-r--r--spec/unit/provider/service/upstart_service_spec.rb20
-rw-r--r--spec/unit/provider/service/windows_spec.rb12
-rw-r--r--spec/unit/provider/service_spec.rb2
-rw-r--r--spec/unit/provider/subversion_spec.rb34
-rw-r--r--spec/unit/provider/template/content_spec.rb36
-rw-r--r--spec/unit/provider/template_spec.rb24
-rw-r--r--spec/unit/provider/user/dscl_spec.rb64
-rw-r--r--spec/unit/provider/user/pw_spec.rb12
-rw-r--r--spec/unit/provider/user/solaris_spec.rb54
-rw-r--r--spec/unit/provider/user/useradd_spec.rb14
-rw-r--r--spec/unit/provider/user/windows_spec.rb8
-rw-r--r--spec/unit/provider/user_spec.rb30
-rw-r--r--spec/unit/provider/whyrun_safe_ruby_block_spec.rb2
108 files changed, 1338 insertions, 1338 deletions
diff --git a/spec/unit/provider/breakpoint_spec.rb b/spec/unit/provider/breakpoint_spec.rb
index 386e5a1d17..58dc4649c4 100644
--- a/spec/unit/provider/breakpoint_spec.rb
+++ b/spec/unit/provider/breakpoint_spec.rb
@@ -17,7 +17,7 @@
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Breakpoint do
before do
diff --git a/spec/unit/provider/cookbook_file/content_spec.rb b/spec/unit/provider/cookbook_file/content_spec.rb
index 6946966153..8c66f3fcc4 100644
--- a/spec/unit/provider/cookbook_file/content_spec.rb
+++ b/spec/unit/provider/cookbook_file/content_spec.rb
@@ -16,24 +16,24 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::CookbookFile::Content do
- let(:new_resource) { double('Chef::Resource::CookbookFile (new)', :cookbook_name => 'apache2', :cookbook => 'apache2') }
+ let(:new_resource) { double("Chef::Resource::CookbookFile (new)", :cookbook_name => "apache2", :cookbook => "apache2") }
let(:content) do
- @run_context = double('Chef::RunContext')
- @current_resource = double('Chef::Resource::CookbookFile (current)')
+ @run_context = double("Chef::RunContext")
+ @current_resource = double("Chef::Resource::CookbookFile (current)")
Chef::Provider::CookbookFile::Content.new(new_resource, @current_resource, @run_context)
end
it "prefers the explicit cookbook name on the resource to the implicit one" do
- allow(new_resource).to receive(:cookbook).and_return('nginx')
- expect(content.send(:resource_cookbook)).to eq('nginx')
+ allow(new_resource).to receive(:cookbook).and_return("nginx")
+ expect(content.send(:resource_cookbook)).to eq("nginx")
end
it "falls back to the implicit cookbook name on the resource" do
- expect(content.send(:resource_cookbook)).to eq('apache2')
+ expect(content.send(:resource_cookbook)).to eq("apache2")
end
end
diff --git a/spec/unit/provider/cookbook_file_spec.rb b/spec/unit/provider/cookbook_file_spec.rb
index a7cbba97cb..bc52cf2f00 100644
--- a/spec/unit/provider/cookbook_file_spec.rb
+++ b/spec/unit/provider/cookbook_file_spec.rb
@@ -17,15 +17,15 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
-require 'support/shared/unit/provider/file'
+require "support/shared/unit/provider/file"
describe Chef::Provider::CookbookFile 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(:enclosing_directory) {
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
}
@@ -44,12 +44,12 @@ describe Chef::Provider::CookbookFile do
let(:resource) do
resource = Chef::Resource::CookbookFile.new("seattle", @run_context)
resource.path(resource_path)
- resource.cookbook_name = 'apache2'
+ resource.cookbook_name = "apache2"
resource
end
let(:content) do
- content = double('Chef::Provider::CookbookFile::Content')
+ content = double("Chef::Provider::CookbookFile::Content")
end
it_behaves_like Chef::Provider::File
diff --git a/spec/unit/provider/cron/unix_spec.rb b/spec/unit/provider/cron/unix_spec.rb
index 3d7a5675fc..615ae608f2 100644
--- a/spec/unit/provider/cron/unix_spec.rb
+++ b/spec/unit/provider/cron/unix_spec.rb
@@ -18,7 +18,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Cron::Unix do
@@ -37,9 +37,9 @@ describe Chef::Provider::Cron::Unix do
end
end
- let(:status) { double('Process::Status', :exitstatus => exitstatus) }
+ let(:status) { double("Process::Status", :exitstatus => exitstatus) }
let(:exitstatus) { 0 }
- let(:shell_out) { double('Mixlib::ShellOut', :status => status, :stdout => stdout, :stderr => stderr) }
+ let(:shell_out) { double("Mixlib::ShellOut", :status => status, :stdout => stdout, :stderr => stderr) }
it "is a Chef::Provider:Cron" do
expect(provider).to be_a(Chef::Provider::Cron)
@@ -61,12 +61,12 @@ describe Chef::Provider::Cron::Unix do
before do
allow(Chef::Log).to receive(:debug)
allow(shell_out).to receive(:format_for_exception).and_return("formatted command output")
- allow(provider).to receive(:shell_out).with('/usr/bin/crontab -l', :user => username).and_return(shell_out)
+ allow(provider).to receive(:shell_out).with("/usr/bin/crontab -l", :user => username).and_return(shell_out)
end
it "should call crontab -l with the user" do
provider.send(:read_crontab)
- expect(provider).to have_received(:shell_out).with('/usr/bin/crontab -l', :user => username)
+ expect(provider).to have_received(:shell_out).with("/usr/bin/crontab -l", :user => username)
end
it "should return the contents of the crontab" do
diff --git a/spec/unit/provider/cron_spec.rb b/spec/unit/provider/cron_spec.rb
index 7a917a4f27..cf9680775c 100644
--- a/spec/unit/provider/cron_spec.rb
+++ b/spec/unit/provider/cron_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Cron do
describe "when with special time string" do
@@ -56,7 +56,7 @@ CRONTAB
it "should pull the details out of the cron line" do
cron = @provider.load_current_resource
expect(cron.time).to eq(:reboot)
- expect(cron.command).to eq('/bin/true param1 param2')
+ expect(cron.command).to eq("/bin/true param1 param2")
end
it "should pull env vars out" do
@@ -75,12 +75,12 @@ HOME=/home/foo
# Another comment
CRONTAB
cron = @provider.load_current_resource
- expect(cron.mailto).to eq('foo@example.com')
- expect(cron.shell).to eq('/bin/foosh')
- expect(cron.path).to eq('/bin:/foo')
- expect(cron.home).to eq('/home/foo')
+ expect(cron.mailto).to eq("foo@example.com")
+ expect(cron.shell).to eq("/bin/foosh")
+ expect(cron.path).to eq("/bin:/foo")
+ expect(cron.home).to eq("/home/foo")
expect(cron.time).to eq(:reboot)
- expect(cron.command).to eq('/bin/true param1 param2')
+ expect(cron.command).to eq("/bin/true param1 param2")
end
it "should parse and load generic and standard environment variables from cron entry" do
@@ -227,13 +227,13 @@ CRONTAB
it "should pull the details out of the cron line" do
cron = @provider.load_current_resource
- expect(cron.minute).to eq('*')
- expect(cron.hour).to eq('5')
- expect(cron.day).to eq('*')
- expect(cron.month).to eq('1')
- expect(cron.weekday).to eq('*')
+ expect(cron.minute).to eq("*")
+ expect(cron.hour).to eq("5")
+ expect(cron.day).to eq("*")
+ expect(cron.month).to eq("1")
+ expect(cron.weekday).to eq("*")
expect(cron.time).to eq(nil)
- expect(cron.command).to eq('/bin/true param1 param2')
+ expect(cron.command).to eq("/bin/true param1 param2")
end
it "should pull env vars out" do
@@ -252,17 +252,17 @@ HOME=/home/foo
# Another comment
CRONTAB
cron = @provider.load_current_resource
- expect(cron.mailto).to eq('foo@example.com')
- expect(cron.shell).to eq('/bin/foosh')
- expect(cron.path).to eq('/bin:/foo')
- expect(cron.home).to eq('/home/foo')
- expect(cron.minute).to eq('*')
- expect(cron.hour).to eq('5')
- expect(cron.day).to eq('*')
- expect(cron.month).to eq('1')
- expect(cron.weekday).to eq('*')
+ expect(cron.mailto).to eq("foo@example.com")
+ expect(cron.shell).to eq("/bin/foosh")
+ expect(cron.path).to eq("/bin:/foo")
+ expect(cron.home).to eq("/home/foo")
+ expect(cron.minute).to eq("*")
+ expect(cron.hour).to eq("5")
+ expect(cron.day).to eq("*")
+ expect(cron.month).to eq("1")
+ expect(cron.weekday).to eq("*")
expect(cron.time).to eq(nil)
- expect(cron.command).to eq('/bin/true param1 param2')
+ expect(cron.command).to eq("/bin/true param1 param2")
end
it "should parse and load generic and standard environment variables from cron entry" do
@@ -290,8 +290,8 @@ ENVIRONMENT=production
CRONTAB
cron = @provider.load_current_resource
- expect(cron.minute).to eq('*')
- expect(cron.hour).to eq('5')
+ expect(cron.minute).to eq("*")
+ expect(cron.hour).to eq("5")
expect(cron.environment).to eq({"MINUTE" => "40", "HOUR" => "midnight", "TEST" => "lol", "ENVIRONMENT" => "production"})
end
@@ -323,12 +323,12 @@ CRONTAB
it "should pull the details out of the cron line" do
cron = @provider.load_current_resource
- expect(cron.minute).to eq('*')
- expect(cron.hour).to eq('5')
- expect(cron.day).to eq('*')
- expect(cron.month).to eq('Jan')
- expect(cron.weekday).to eq('Mon')
- expect(cron.command).to eq('/bin/true param1 param2')
+ expect(cron.minute).to eq("*")
+ expect(cron.hour).to eq("5")
+ expect(cron.day).to eq("*")
+ expect(cron.month).to eq("Jan")
+ expect(cron.weekday).to eq("Mon")
+ expect(cron.command).to eq("/bin/true param1 param2")
end
it "should report the match" do
@@ -346,11 +346,11 @@ CRONTAB
CRONTAB
cron = @provider.load_current_resource
expect(@provider.cron_exists).to eq(true)
- expect(cron.minute).to eq('*')
- expect(cron.hour).to eq('*')
- expect(cron.day).to eq('*')
- expect(cron.month).to eq('*')
- expect(cron.weekday).to eq('*')
+ expect(cron.minute).to eq("*")
+ expect(cron.hour).to eq("*")
+ expect(cron.day).to eq("*")
+ expect(cron.month).to eq("*")
+ expect(cron.weekday).to eq("*")
expect(cron.time).to eq(nil)
expect(cron.command).to eq(nil)
end
@@ -364,11 +364,11 @@ CRONTAB
CRONTAB
cron = @provider.load_current_resource
expect(@provider.cron_exists).to eq(true)
- expect(cron.minute).to eq('*')
- expect(cron.hour).to eq('*')
- expect(cron.day).to eq('*')
- expect(cron.month).to eq('*')
- expect(cron.weekday).to eq('*')
+ expect(cron.minute).to eq("*")
+ expect(cron.hour).to eq("*")
+ expect(cron.day).to eq("*")
+ expect(cron.month).to eq("*")
+ expect(cron.weekday).to eq("*")
expect(cron.time).to eq(nil)
expect(cron.command).to eq(nil)
end
@@ -386,11 +386,11 @@ CRONTAB
CRONTAB
cron = @provider.load_current_resource
expect(@provider.cron_exists).to eq(true)
- expect(cron.minute).to eq('*')
- expect(cron.hour).to eq('*')
- expect(cron.day).to eq('*')
- expect(cron.month).to eq('*')
- expect(cron.weekday).to eq('*')
+ expect(cron.minute).to eq("*")
+ expect(cron.hour).to eq("*")
+ expect(cron.day).to eq("*")
+ expect(cron.month).to eq("*")
+ expect(cron.weekday).to eq("*")
expect(cron.time).to eq(nil)
expect(cron.command).to eq(nil)
end
@@ -455,10 +455,10 @@ CRONTAB
end
it "should include env variables that are set" do
- @new_resource.mailto 'foo@example.com'
- @new_resource.path '/usr/bin:/my/custom/path'
- @new_resource.shell '/bin/foosh'
- @new_resource.home '/home/foo'
+ @new_resource.mailto "foo@example.com"
+ @new_resource.path "/usr/bin:/my/custom/path"
+ @new_resource.shell "/bin/foosh"
+ @new_resource.home "/home/foo"
@new_resource.environment "TEST" => "LOL"
expect(@provider).to receive(:write_crontab).with(<<-ENDCRON)
# Chef Name: cronhole some stuff
@@ -511,10 +511,10 @@ TEST=LOL
end
it "should include env variables that are set" do
- @new_resource.mailto 'foo@example.com'
- @new_resource.path '/usr/bin:/my/custom/path'
- @new_resource.shell '/bin/foosh'
- @new_resource.home '/home/foo'
+ @new_resource.mailto "foo@example.com"
+ @new_resource.path "/usr/bin:/my/custom/path"
+ @new_resource.shell "/bin/foosh"
+ @new_resource.home "/home/foo"
@new_resource.environment "TEST" => "LOL"
expect(@provider).to receive(:write_crontab).with(<<-ENDCRON)
0 2 * * * /some/other/command
@@ -576,10 +576,10 @@ TEST=LOL
end
it "should include env variables that are set" do
- @new_resource.mailto 'foo@example.com'
- @new_resource.path '/usr/bin:/my/custom/path'
- @new_resource.shell '/bin/foosh'
- @new_resource.home '/home/foo'
+ @new_resource.mailto "foo@example.com"
+ @new_resource.path "/usr/bin:/my/custom/path"
+ @new_resource.shell "/bin/foosh"
+ @new_resource.home "/home/foo"
@new_resource.environment "TEST" => "LOL"
expect(@provider).to receive(:write_crontab).with(<<-ENDCRON)
0 2 * * * /some/other/command
@@ -671,10 +671,10 @@ HOME=/home/foo
# Another comment
CRONTAB
- @new_resource.mailto 'foo@example.com'
- @new_resource.path '/usr/bin:/my/custom/path'
- @new_resource.shell '/bin/foosh'
- @new_resource.home '/home/foo'
+ @new_resource.mailto "foo@example.com"
+ @new_resource.path "/usr/bin:/my/custom/path"
+ @new_resource.shell "/bin/foosh"
+ @new_resource.home "/home/foo"
expect(@provider).to receive(:write_crontab).with(<<-ENDCRON)
0 2 * * * /some/other/command
diff --git a/spec/unit/provider/deploy/revision_spec.rb b/spec/unit/provider/deploy/revision_spec.rb
index caa60878e1..1b77c472e0 100644
--- a/spec/unit/provider/deploy/revision_spec.rb
+++ b/spec/unit/provider/deploy/revision_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Deploy::Revision do
diff --git a/spec/unit/provider/deploy/timestamped_spec.rb b/spec/unit/provider/deploy/timestamped_spec.rb
index b189d33502..b665ac3101 100644
--- a/spec/unit/provider/deploy/timestamped_spec.rb
+++ b/spec/unit/provider/deploy/timestamped_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Deploy::Timestamped do
diff --git a/spec/unit/provider/deploy_spec.rb b/spec/unit/provider/deploy_spec.rb
index adcb9431eb..a7f7375752 100644
--- a/spec/unit/provider/deploy_spec.rb
+++ b/spec/unit/provider/deploy_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Deploy do
@@ -163,9 +163,9 @@ describe Chef::Provider::Deploy do
end
it "dont care by default if error happens on deploy" do
- allow(@provider).to receive(:all_releases).and_return(['previous_release'])
+ allow(@provider).to receive(:all_releases).and_return(["previous_release"])
allow(@provider).to receive(:deploy){ raise "Unexpected error" }
- allow(@provider).to receive(:previous_release_path).and_return('previous_release')
+ allow(@provider).to receive(:previous_release_path).and_return("previous_release")
expect(@provider).not_to receive(:rollback)
expect {
@provider.run_action(:deploy)
@@ -174,9 +174,9 @@ describe Chef::Provider::Deploy do
it "rollbacks to previous release if error happens on deploy" do
@resource.rollback_on_error true
- allow(@provider).to receive(:all_releases).and_return(['previous_release'])
+ allow(@provider).to receive(:all_releases).and_return(["previous_release"])
allow(@provider).to receive(:deploy){ raise "Unexpected error" }
- allow(@provider).to receive(:previous_release_path).and_return('previous_release')
+ allow(@provider).to receive(:previous_release_path).and_return("previous_release")
expect(@provider).to receive(:rollback)
expect {
@provider.run_action(:deploy)
@@ -552,7 +552,7 @@ describe Chef::Provider::Deploy do
expect(@provider).to receive(:execute).with("iGoToHell4this").and_return(mock_execution)
@resource.user("notCoolMan")
@resource.group("Ggroup")
- @resource.environment("APP_ENV" => 'staging')
+ @resource.environment("APP_ENV" => "staging")
@resource.deploy_to("/my/app")
expect(mock_execution).to receive(:user).with("notCoolMan")
expect(mock_execution).to receive(:group).with("Ggroup")
diff --git a/spec/unit/provider/directory_spec.rb b/spec/unit/provider/directory_spec.rb
index 4fad8c8906..6157c6c200 100644
--- a/spec/unit/provider/directory_spec.rb
+++ b/spec/unit/provider/directory_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tmpdir'
+require "spec_helper"
+require "tmpdir"
describe Chef::Provider::Directory do
let(:tmp_dir) { Dir.mktmpdir }
@@ -200,14 +200,14 @@ describe Chef::Provider::Directory do
describe "on OS X" do
before do
- allow(node).to receive(:[]).with("platform").and_return('mac_os_x')
+ allow(node).to receive(:[]).with("platform").and_return("mac_os_x")
new_resource.path "/usr/bin/chef_test"
new_resource.recursive false
allow_any_instance_of(Chef::Provider::File).to receive(:do_selinux)
end
it "os x 10.10 can write to sip locations" do
- allow(node).to receive(:[]).with("platform_version").and_return('10.10')
+ allow(node).to receive(:[]).with("platform_version").and_return("10.10")
allow(Dir).to receive(:mkdir).and_return([true], [])
allow(::File).to receive(:directory?).and_return(true)
allow(Chef::FileAccessControl).to receive(:writable?).and_return(true)
@@ -216,7 +216,7 @@ describe Chef::Provider::Directory do
end
it "os x 10.11 cannot write to sip locations" do
- allow(node).to receive(:[]).with("platform_version").and_return('10.11')
+ allow(node).to receive(:[]).with("platform_version").and_return("10.11")
allow(::File).to receive(:directory?).and_return(true)
allow(Chef::FileAccessControl).to receive(:writable?).and_return(false)
expect {directory.run_action(:create) }.to raise_error(Chef::Exceptions::InsufficientPermissions)
@@ -224,7 +224,7 @@ describe Chef::Provider::Directory do
it "os x 10.11 can write to sip exlcusions" do
new_resource.path "/usr/local/chef_test"
- allow(node).to receive(:[]).with("platform_version").and_return('10.11')
+ allow(node).to receive(:[]).with("platform_version").and_return("10.11")
allow(::File).to receive(:directory?).and_return(true)
allow(Dir).to receive(:mkdir).and_return([true], [])
allow(Chef::FileAccessControl).to receive(:writable?).and_return(false)
diff --git a/spec/unit/provider/dsc_resource_spec.rb b/spec/unit/provider/dsc_resource_spec.rb
index 46cdbd93a6..afa8ce3975 100644
--- a/spec/unit/provider/dsc_resource_spec.rb
+++ b/spec/unit/provider/dsc_resource_spec.rb
@@ -16,8 +16,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef'
-require 'spec_helper'
+require "chef"
+require "spec_helper"
describe Chef::Provider::DscResource do
let (:events) { Chef::EventDispatch::Dispatcher.new }
@@ -27,41 +27,41 @@ describe Chef::Provider::DscResource do
Chef::Provider::DscResource.new(resource, run_context)
end
- context 'when Powershell does not support Invoke-DscResource' do
+ context "when Powershell does not support Invoke-DscResource" do
let (:node) {
node = Chef::Node.new
- node.automatic[:languages][:powershell][:version] = '4.0'
+ node.automatic[:languages][:powershell][:version] = "4.0"
node
}
- it 'raises a ProviderNotFound exception' do
+ it "raises a ProviderNotFound exception" do
expect(provider).not_to receive(:meta_configuration)
expect{provider.run_action(:run)}.to raise_error(
Chef::Exceptions::ProviderNotFound, /5\.0\.10018\.0/)
end
end
- context 'when Powershell supports Invoke-DscResource' do
+ context "when Powershell supports Invoke-DscResource" do
- context 'when RefreshMode is not set to Disabled' do
- context 'and the WMF 5 is a preview release' do
+ context "when RefreshMode is not set to Disabled" do
+ context "and the WMF 5 is a preview release" do
let (:node) {
node = Chef::Node.new
- node.automatic[:languages][:powershell][:version] = '5.0.10018.0'
+ node.automatic[:languages][:powershell][:version] = "5.0.10018.0"
node
}
- it 'raises an exception' do
+ it "raises an exception" do
expect(provider).to receive(:dsc_refresh_mode_disabled?).and_return(false)
expect { provider.run_action(:run) }.to raise_error(
Chef::Exceptions::ProviderNotFound, /Disabled/)
end
end
- context 'and the WMF is 5 RTM or newer' do
+ context "and the WMF is 5 RTM or newer" do
let (:node) {
node = Chef::Node.new
- node.automatic[:languages][:powershell][:version] = '5.0.10586.0'
+ node.automatic[:languages][:powershell][:version] = "5.0.10586.0"
node
}
- it 'does not raises an exception' do
+ it "does not raises an exception" do
expect(provider).to receive(:test_resource)
expect(provider).to receive(:set_resource)
expect(provider).to receive(:reboot_if_required)
@@ -71,21 +71,21 @@ describe Chef::Provider::DscResource do
end
end
- context 'when the LCM supports Invoke-DscResource' do
+ context "when the LCM supports Invoke-DscResource" do
let (:node) {
node = Chef::Node.new
- node.automatic[:languages][:powershell][:version] = '5.0.10018.0'
+ node.automatic[:languages][:powershell][:version] = "5.0.10018.0"
node
}
- it 'does not update the resource if it is up to date' do
+ it "does not update the resource if it is up to date" do
expect(provider).to receive(:dsc_refresh_mode_disabled?).and_return(true)
expect(provider).to receive(:test_resource).and_return(true)
provider.run_action(:run)
expect(resource).not_to be_updated
end
- it 'converges the resource if it is not up to date' do
+ it "converges the resource if it is not up to date" do
expect(provider).to receive(:dsc_refresh_mode_disabled?).and_return(true)
expect(provider).to receive(:test_resource).and_return(false)
expect(provider).to receive(:set_resource)
@@ -93,21 +93,21 @@ describe Chef::Provider::DscResource do
expect(resource).to be_updated
end
- it 'flags the resource as reboot required when required' do
+ it "flags the resource as reboot required when required" do
expect(provider).to receive(:dsc_refresh_mode_disabled?).and_return(true)
expect(provider).to receive(:test_resource).and_return(false)
expect(provider).to receive(:invoke_resource).
- and_return(double(:stdout => '', :return_value =>nil))
+ and_return(double(:stdout => "", :return_value =>nil))
expect(provider).to receive(:return_dsc_resource_result).and_return(true)
expect(provider).to receive(:create_reboot_resource)
provider.run_action(:run)
end
- it 'does not flag the resource as reboot required when not required' do
+ it "does not flag the resource as reboot required when not required" do
expect(provider).to receive(:dsc_refresh_mode_disabled?).and_return(true)
expect(provider).to receive(:test_resource).and_return(false)
expect(provider).to receive(:invoke_resource).
- and_return(double(:stdout => '', :return_value =>nil))
+ and_return(double(:stdout => "", :return_value =>nil))
expect(provider).to receive(:return_dsc_resource_result).and_return(false)
expect(provider).to_not receive(:create_reboot_resource)
provider.run_action(:run)
diff --git a/spec/unit/provider/dsc_script_spec.rb b/spec/unit/provider/dsc_script_spec.rb
index 76589e71c1..ebde817010 100644
--- a/spec/unit/provider/dsc_script_spec.rb
+++ b/spec/unit/provider/dsc_script_spec.rb
@@ -17,15 +17,15 @@
# limitations under the License.
#
-require 'chef'
-require 'chef/util/dsc/resource_info'
-require 'spec_helper'
+require "chef"
+require "chef/util/dsc/resource_info"
+require "spec_helper"
describe Chef::Provider::DscScript do
- context 'when DSC is available' do
+ context "when DSC is available" do
let (:node) {
node = Chef::Node.new
- node.automatic[:languages][:powershell][:version] = '4.0'
+ node.automatic[:languages][:powershell][:version] = "4.0"
node
}
let (:events) { Chef::EventDispatch::Dispatcher.new }
@@ -39,75 +39,75 @@ describe Chef::Provider::DscScript do
it "describes the resource as converged if there were 0 DSC resources" do
allow(provider).to receive(:run_configuration).with(:test).and_return([])
provider.load_current_resource
- expect(provider.instance_variable_get('@resource_converged')).to be_truthy
+ expect(provider.instance_variable_get("@resource_converged")).to be_truthy
end
it "describes the resource as not converged if there is 1 DSC resources that is converged" do
- dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resource', false, ['nothing will change something'])
+ dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resource", false, ["nothing will change something"])
allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info])
provider.load_current_resource
- expect(provider.instance_variable_get('@resource_converged')).to be_truthy
+ expect(provider.instance_variable_get("@resource_converged")).to be_truthy
end
it "describes the resource as not converged if there is 1 DSC resources that is not converged" do
- dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resource', true, ['will change something'])
+ dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resource", true, ["will change something"])
allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info])
provider.load_current_resource
- expect(provider.instance_variable_get('@resource_converged')).to be_falsey
+ expect(provider.instance_variable_get("@resource_converged")).to be_falsey
end
it "describes the resource as not converged if there are any DSC resources that are not converged" do
- dsc_resource_info1 = Chef::Util::DSC::ResourceInfo.new('resource', true, ['will change something'])
- dsc_resource_info2 = Chef::Util::DSC::ResourceInfo.new('resource', false, ['nothing will change something'])
+ dsc_resource_info1 = Chef::Util::DSC::ResourceInfo.new("resource", true, ["will change something"])
+ dsc_resource_info2 = Chef::Util::DSC::ResourceInfo.new("resource", false, ["nothing will change something"])
allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info1, dsc_resource_info2])
provider.load_current_resource
- expect(provider.instance_variable_get('@resource_converged')).to be_falsey
+ expect(provider.instance_variable_get("@resource_converged")).to be_falsey
end
it "describes the resource as converged if all DSC resources that are converged" do
- dsc_resource_info1 = Chef::Util::DSC::ResourceInfo.new('resource', false, ['nothing will change something'])
- dsc_resource_info2 = Chef::Util::DSC::ResourceInfo.new('resource', false, ['nothing will change something'])
+ dsc_resource_info1 = Chef::Util::DSC::ResourceInfo.new("resource", false, ["nothing will change something"])
+ dsc_resource_info2 = Chef::Util::DSC::ResourceInfo.new("resource", false, ["nothing will change something"])
allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info1, dsc_resource_info2])
provider.load_current_resource
- expect(provider.instance_variable_get('@resource_converged')).to be_truthy
+ expect(provider.instance_variable_get("@resource_converged")).to be_truthy
end
end
describe '#generate_configuration_document' do
# I think integration tests should cover these cases
- it 'uses configuration_document_from_script_path when a dsc script file is given' do
+ it "uses configuration_document_from_script_path when a dsc script file is given" do
allow(provider).to receive(:load_current_resource)
resource.command("path_to_script")
- generator = double('Chef::Util::DSC::ConfigurationGenerator')
+ generator = double("Chef::Util::DSC::ConfigurationGenerator")
expect(generator).to receive(:configuration_document_from_script_path)
allow(Chef::Util::DSC::ConfigurationGenerator).to receive(:new).and_return(generator)
- provider.send(:generate_configuration_document, 'tmp', nil)
+ provider.send(:generate_configuration_document, "tmp", nil)
end
- it 'uses configuration_document_from_script_code when a the dsc resource is given' do
+ it "uses configuration_document_from_script_code when a the dsc resource is given" do
allow(provider).to receive(:load_current_resource)
resource.code("ImADSCResource{}")
- generator = double('Chef::Util::DSC::ConfigurationGenerator')
+ generator = double("Chef::Util::DSC::ConfigurationGenerator")
expect(generator).to receive(:configuration_document_from_script_code)
allow(Chef::Util::DSC::ConfigurationGenerator).to receive(:new).and_return(generator)
- provider.send(:generate_configuration_document, 'tmp', nil)
+ provider.send(:generate_configuration_document, "tmp", nil)
end
- it 'should noop if neither code or command are provided' do
+ it "should noop if neither code or command are provided" do
allow(provider).to receive(:load_current_resource)
- generator = double('Chef::Util::DSC::ConfigurationGenerator')
- expect(generator).to receive(:configuration_document_from_script_code).with('', anything(), anything(), anything())
+ generator = double("Chef::Util::DSC::ConfigurationGenerator")
+ expect(generator).to receive(:configuration_document_from_script_code).with("", anything(), anything(), anything())
allow(Chef::Util::DSC::ConfigurationGenerator).to receive(:new).and_return(generator)
- provider.send(:generate_configuration_document, 'tmp', nil)
+ provider.send(:generate_configuration_document, "tmp", nil)
end
end
- describe 'action_run' do
- it 'should converge the script if it is not converged' do
- dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resource', true, ['will change something'])
+ describe "action_run" do
+ it "should converge the script if it is not converged" do
+ dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resource", true, ["will change something"])
allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info])
allow(provider).to receive(:run_configuration).with(:set)
@@ -115,7 +115,7 @@ describe Chef::Provider::DscScript do
expect(resource).to be_updated
end
- it 'should not converge if the script is already converged' do
+ it "should not converge if the script is already converged" do
allow(provider).to receive(:run_configuration).with(:test).and_return([])
provider.run_action(:run)
@@ -124,35 +124,35 @@ describe Chef::Provider::DscScript do
end
describe '#generate_description' do
- it 'removes the resource name from the beginning of any log line from the LCM' do
- dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resourcename', true, ['resourcename doing something', 'lastline'])
- provider.instance_variable_set('@dsc_resources_info', [dsc_resource_info])
+ it "removes the resource name from the beginning of any log line from the LCM" do
+ dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resourcename", true, ["resourcename doing something", "lastline"])
+ provider.instance_variable_set("@dsc_resources_info", [dsc_resource_info])
expect(provider.send(:generate_description)[1]).to match(/converge DSC resource resourcename by doing something/)
end
- it 'ignores the last line' do
- dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resourcename', true, ['resourcename doing something', 'lastline'])
- provider.instance_variable_set('@dsc_resources_info', [dsc_resource_info])
+ it "ignores the last line" do
+ dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resourcename", true, ["resourcename doing something", "lastline"])
+ provider.instance_variable_set("@dsc_resources_info", [dsc_resource_info])
expect(provider.send(:generate_description)[1]).not_to match(/lastline/)
end
- it 'reports a dsc resource has not been changed if the LCM reported no change was required' do
- dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resourcename', false, ['resourcename does nothing', 'lastline'])
- provider.instance_variable_set('@dsc_resources_info', [dsc_resource_info])
+ it "reports a dsc resource has not been changed if the LCM reported no change was required" do
+ dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resourcename", false, ["resourcename does nothing", "lastline"])
+ provider.instance_variable_set("@dsc_resources_info", [dsc_resource_info])
expect(provider.send(:generate_description)[1]).to match(/converge DSC resource resourcename by doing nothing/)
end
end
end
- context 'when Dsc is not available' do
+ context "when Dsc is not available" do
let (:node) { Chef::Node.new }
let (:events) { Chef::EventDispatch::Dispatcher.new }
let (:run_context) { Chef::RunContext.new(node, {}, events) }
- let (:resource) { Chef::Resource::DscScript.new('script', run_context) }
+ let (:resource) { Chef::Resource::DscScript.new("script", run_context) }
let (:provider) { Chef::Provider::DscScript.new(resource, run_context) }
- describe 'action_run' do
- ['1.0', '2.0', '3.0'].each do |version|
+ describe "action_run" do
+ ["1.0", "2.0", "3.0"].each do |version|
it "raises an exception for powershell version '#{version}'" do
node.automatic[:languages][:powershell][:version] = version
@@ -162,7 +162,7 @@ describe Chef::Provider::DscScript do
end
end
- it 'raises an exception if Powershell is not present' do
+ it "raises an exception if Powershell is not present" do
expect {
provider.run_action(:run)
}.to raise_error(Chef::Exceptions::ProviderNotFound)
diff --git a/spec/unit/provider/env/windows_spec.rb b/spec/unit/provider/env/windows_spec.rb
index 99f33d392a..b72e41884f 100644
--- a/spec/unit/provider/env/windows_spec.rb
+++ b/spec/unit/provider/env/windows_spec.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Env::Windows, :windows_only do
let(:node) { Chef::Node.new }
let(:events) {Chef::EventDispatch::Dispatcher.new }
let(:run_context) { Chef::RunContext.new(node, {}, events) }
- context 'when environment variable is not PATH' do
+ context "when environment variable is not PATH" do
let(:new_resource) {
new_resource = Chef::Resource::Env.new("CHEF_WINDOWS_ENV_TEST")
new_resource.value("foo")
@@ -31,71 +31,71 @@ describe Chef::Provider::Env::Windows, :windows_only do
}
let(:provider) {
provider = Chef::Provider::Env::Windows.new(new_resource, run_context)
- allow(provider).to receive(:env_obj).and_return(double('null object').as_null_object)
+ allow(provider).to receive(:env_obj).and_return(double("null object").as_null_object)
provider
}
describe "action_create" do
before do
- ENV.delete('CHEF_WINDOWS_ENV_TEST')
+ ENV.delete("CHEF_WINDOWS_ENV_TEST")
provider.key_exists = false
end
it "should update the ruby ENV object when it creates the key" do
provider.action_create
- expect(ENV['CHEF_WINDOWS_ENV_TEST']).to eql('foo')
+ expect(ENV["CHEF_WINDOWS_ENV_TEST"]).to eql("foo")
end
end
describe "action_modify" do
before do
- ENV['CHEF_WINDOWS_ENV_TEST'] = 'foo'
+ ENV["CHEF_WINDOWS_ENV_TEST"] = "foo"
end
it "should update the ruby ENV object when it updates the value" do
expect(provider).to receive(:requires_modify_or_create?).and_return(true)
new_resource.value("foobar")
provider.action_modify
- expect(ENV['CHEF_WINDOWS_ENV_TEST']).to eql('foobar')
+ expect(ENV["CHEF_WINDOWS_ENV_TEST"]).to eql("foobar")
end
describe "action_delete" do
before do
- ENV['CHEF_WINDOWS_ENV_TEST'] = 'foo'
+ ENV["CHEF_WINDOWS_ENV_TEST"] = "foo"
end
it "should update the ruby ENV object when it deletes the key" do
provider.action_delete
- expect(ENV['CHEF_WINDOWS_ENV_TEST']).to eql(nil)
+ expect(ENV["CHEF_WINDOWS_ENV_TEST"]).to eql(nil)
end
end
end
end
- context 'when environment is PATH' do
+ context "when environment is PATH" do
describe "for PATH" do
- let(:system_root) {'%SystemRoot%'}
+ let(:system_root) {"%SystemRoot%"}
let(:system_root_value) { 'D:\Windows' }
let(:new_resource) {
- new_resource = Chef::Resource::Env.new('PATH')
+ new_resource = Chef::Resource::Env.new("PATH")
new_resource.value(system_root)
new_resource
}
let(:provider) {
provider = Chef::Provider::Env::Windows.new(new_resource, run_context)
- allow(provider).to receive(:env_obj).and_return(double('null object').as_null_object)
+ allow(provider).to receive(:env_obj).and_return(double("null object").as_null_object)
provider
}
before do
- stub_const('ENV', {'PATH' => ''})
+ stub_const("ENV", {"PATH" => ""})
end
it "replaces Windows system variables" do
expect(provider).to receive(:requires_modify_or_create?).and_return(true)
expect(provider).to receive(:expand_path).with(system_root).and_return(system_root_value)
provider.action_modify
- expect(ENV['PATH']).to eql(system_root_value)
+ expect(ENV["PATH"]).to eql(system_root_value)
end
end
diff --git a/spec/unit/provider/env_spec.rb b/spec/unit/provider/env_spec.rb
index 230603dcb3..f0e74f347f 100644
--- a/spec/unit/provider/env_spec.rb
+++ b/spec/unit/provider/env_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Env do
diff --git a/spec/unit/provider/erl_call_spec.rb b/spec/unit/provider/erl_call_spec.rb
index 2fb7e5b737..6526de0087 100644
--- a/spec/unit/provider/erl_call_spec.rb
+++ b/spec/unit/provider/erl_call_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::ErlCall do
before(:each) do
@@ -33,7 +33,7 @@ describe Chef::Provider::ErlCall do
allow(@provider).to receive(:popen4).and_return(@status)
@stdin = StringIO.new
- @stdout = StringIO.new('{ok, woohoo}')
+ @stdout = StringIO.new("{ok, woohoo}")
@stderr = StringIO.new
@pid = 2342999
end
diff --git a/spec/unit/provider/execute_spec.rb b/spec/unit/provider/execute_spec.rb
index 8a55025d9e..c656607ca7 100644
--- a/spec/unit/provider/execute_spec.rb
+++ b/spec/unit/provider/execute_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Execute do
diff --git a/spec/unit/provider/file/content_spec.rb b/spec/unit/provider/file/content_spec.rb
index 0a45d15bc9..7271772e2c 100644
--- a/spec/unit/provider/file/content_spec.rb
+++ b/spec/unit/provider/file/content_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::File::Content do
diff --git a/spec/unit/provider/file_spec.rb b/spec/unit/provider/file_spec.rb
index 504ae045d9..4e8b4507ba 100644
--- a/spec/unit/provider/file_spec.rb
+++ b/spec/unit/provider/file_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'support/shared/unit/provider/file'
+require "support/shared/unit/provider/file"
describe Chef::Provider::File do
@@ -29,12 +29,12 @@ describe Chef::Provider::File do
end
let(:content) do
- content = double('Chef::Provider::File::Content')
+ content = double("Chef::Provider::File::Content")
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(: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(:enclosing_directory) {
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
}
diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb
index 41536a450f..4ec0439092 100644
--- a/spec/unit/provider/git_spec.rb
+++ b/spec/unit/provider/git_spec.rb
@@ -17,7 +17,7 @@
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Git do
before(:each) do
@@ -59,7 +59,7 @@ describe Chef::Provider::Git do
it "determines the current revision when there is one" do
expect(::File).to receive(:exist?).with("/my/deploy/dir/.git").and_return(true)
@stdout = "9b4d8dc38dd471246e7cfb1c3c1ad14b0f2bee13\n"
- expect(@provider).to receive(:shell_out!).with('git rev-parse HEAD', {:cwd => '/my/deploy/dir', :returns => [0,128]}).and_return(double("ShellOut result", :stdout => @stdout))
+ expect(@provider).to receive(:shell_out!).with("git rev-parse HEAD", {:cwd => "/my/deploy/dir", :returns => [0,128]}).and_return(double("ShellOut result", :stdout => @stdout))
expect(@provider.find_current_revision).to eql("9b4d8dc38dd471246e7cfb1c3c1ad14b0f2bee13")
end
@@ -67,7 +67,7 @@ describe Chef::Provider::Git do
expect(::File).to receive(:exist?).with("/my/deploy/dir/.git").and_return(true)
@stderr = "fatal: Not a git repository (or any of the parent directories): .git"
@stdout = ""
- expect(@provider).to receive(:shell_out!).with('git rev-parse HEAD', :cwd => '/my/deploy/dir', :returns => [0,128]).and_return(double("ShellOut result", :stdout => "", :stderr => @stderr))
+ expect(@provider).to receive(:shell_out!).with("git rev-parse HEAD", :cwd => "/my/deploy/dir", :returns => [0,128]).and_return(double("ShellOut result", :stdout => "", :stderr => @stderr))
expect(@provider.find_current_revision).to be_nil
end
end
@@ -206,7 +206,7 @@ d7b9957f67236fa54e660cc3ab45ffecd6e0ba38\trefs/tags/0.7.8
b7d19519a1c15f1c1a324e2683bd728b6198ce5a\trefs/tags/0.7.8^{}
ebc1b392fe7e8f0fbabc305c299b4d365d2b4d9b\trefs/tags/chef-server-package
SHAS
- @resource.revision ''
+ @resource.revision ""
expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"HEAD\"", {:log_tag=>"git[web2.0 app]"}).and_return(double("ShellOut result", :stdout => @stdout))
expect(@provider.target_revision).to eql("28af684d8460ba4793eda3e7ac238c864a5d029a")
end
@@ -284,8 +284,8 @@ SHAS
it "compiles a clone command using --depth for shallow cloning" do
@resource.depth 5
expected_cmd = "git clone --depth 5 \"git://github.com/opscode/chef.git\" \"/my/deploy/dir\""
- version_response = double('shell_out')
- allow(version_response).to receive(:stdout) { 'git version 1.7.9' }
+ version_response = double("shell_out")
+ allow(version_response).to receive(:stdout) { "git version 1.7.9" }
expect(@provider).to receive(:shell_out!).with("git --version",
:log_tag => "git[web2.0 app]").and_return(version_response)
expect(@provider).to receive(:shell_out!).with(expected_cmd, :log_tag => "git[web2.0 app]")
@@ -295,8 +295,8 @@ SHAS
it "compiles a clone command using --no-single-branch for shallow cloning when git >= 1.7.10" do
@resource.depth 5
expected_cmd = "git clone --depth 5 --no-single-branch \"git://github.com/opscode/chef.git\" \"/my/deploy/dir\""
- version_response = double('shell_out')
- allow(version_response).to receive(:stdout) { 'git version 1.7.10' }
+ version_response = double("shell_out")
+ allow(version_response).to receive(:stdout) { "git version 1.7.10" }
expect(@provider).to receive(:shell_out!).with("git --version",
:log_tag => "git[web2.0 app]").and_return(version_response)
expect(@provider).to receive(:shell_out!).with(expected_cmd, :log_tag => "git[web2.0 app]")
@@ -311,9 +311,9 @@ SHAS
end
it "runs a checkout command with default options" do
- expect(@provider).to receive(:shell_out!).with('git branch -f deploy d35af14d41ae22b19da05d7d03a0bafc321b244c', :cwd => "/my/deploy/dir",
+ expect(@provider).to receive(:shell_out!).with("git branch -f deploy d35af14d41ae22b19da05d7d03a0bafc321b244c", :cwd => "/my/deploy/dir",
:log_tag => "git[web2.0 app]").ordered
- expect(@provider).to receive(:shell_out!).with('git checkout deploy', :cwd => "/my/deploy/dir",
+ expect(@provider).to receive(:shell_out!).with("git checkout deploy", :cwd => "/my/deploy/dir",
:log_tag => "git[web2.0 app]").ordered
@provider.checkout
end
@@ -372,7 +372,7 @@ SHAS
context "configuring remote tracking branches" do
it "checks if a remote with this name already exists" do
- command_response = double('shell_out')
+ command_response = double("shell_out")
allow(command_response).to receive(:exitstatus) { 1 }
expected_command = "git config --get remote.#{@resource.remote}.url"
expect(@provider).to receive(:shell_out!).with(expected_command,
@@ -390,7 +390,7 @@ SHAS
@resource.user("whois")
@resource.group("thisis")
allow(Etc).to receive(:getpwnam).and_return(double("Struct::Passwd", :name => @resource.user, :dir => "/home/whois"))
- command_response = double('shell_out')
+ command_response = double("shell_out")
allow(command_response).to receive(:exitstatus) { 1 }
expected_command = "git config --get remote.#{@resource.remote}.url"
expect(@provider).to receive(:shell_out!).with(expected_command,
@@ -412,7 +412,7 @@ SHAS
describe "when a remote with a given name hasn't been configured yet" do
it "adds a new remote " do
- command_response = double('shell_out')
+ command_response = double("shell_out")
allow(command_response).to receive(:exitstatus) { 1 }
check_remote_command = "git config --get remote.#{@resource.remote}.url"
expect(@provider).to receive(:shell_out!).with(check_remote_command,
@@ -429,7 +429,7 @@ SHAS
describe "when a remote with a given name has already been configured" do
it "updates remote url when the url is different" do
- command_response = double('shell_out')
+ command_response = double("shell_out")
allow(command_response).to receive(:exitstatus) { 0 }
allow(command_response).to receive(:stdout) { "some_other_url" }
check_remote_command = "git config --get remote.#{@resource.remote}.url"
@@ -445,7 +445,7 @@ SHAS
end
it "doesn't update remote url when the url is the same" do
- command_response = double('shell_out')
+ command_response = double("shell_out")
allow(command_response).to receive(:exitstatus) { 0 }
allow(command_response).to receive(:stdout) { @resource.repository }
check_remote_command = "git config --get remote.#{@resource.remote}.url"
@@ -461,7 +461,7 @@ SHAS
end
it "resets remote url when it has multiple values" do
- command_response = double('shell_out')
+ command_response = double("shell_out")
allow(command_response).to receive(:exitstatus) { 2 }
check_remote_command = "git config --get remote.#{@resource.remote}.url"
expect(@provider).to receive(:shell_out!).with(check_remote_command,
@@ -488,7 +488,7 @@ SHAS
allow(::File).to receive(:exist?).with("/my/deploy/dir").and_return(true)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
- allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return(['.','..'])
+ allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return([".",".."])
expect(@provider).to receive(:clone)
expect(@provider).to receive(:checkout)
expect(@provider).to receive(:enable_submodules)
@@ -504,7 +504,7 @@ SHAS
allow(::File).to receive(:exist?).with("/my/deploy/dir").and_return(true)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
- allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return(['.','..'])
+ allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return([".",".."])
@resource.enable_checkout false
expect(@provider).to receive(:clone)
@@ -519,7 +519,7 @@ SHAS
allow(::File).to receive(:exist?).with("/my/deploy/dir/.git").and_return(false)
allow(::File).to receive(:exist?).with("/my/deploy/dir").and_return(false)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
- allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return(['..','.'])
+ allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return(["..","."])
expect(@provider).to receive(:clone)
expect(@provider).to receive(:checkout)
expect(@provider).to receive(:enable_submodules)
@@ -534,7 +534,7 @@ SHAS
allow(::File).to receive(:exist?).with("/my/deploy/dir").and_return(true)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
- allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return(['.','..','foo','bar'])
+ allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return([".","..","foo","bar"])
expect(@provider).not_to receive(:clone)
expect(@provider).not_to receive(:checkout)
expect(@provider).not_to receive(:enable_submodules)
@@ -546,7 +546,7 @@ SHAS
it "syncs the code by updating the source when the repo has already been checked out" do
expect(::File).to receive(:exist?).with("/my/deploy/dir/.git").and_return(true)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
- expect(@provider).to receive(:find_current_revision).exactly(1).and_return('d35af14d41ae22b19da05d7d03a0bafc321b244c')
+ expect(@provider).to receive(:find_current_revision).exactly(1).and_return("d35af14d41ae22b19da05d7d03a0bafc321b244c")
expect(@provider).not_to receive(:fetch_updates)
expect(@provider).to receive(:add_remotes)
@provider.run_action(:sync)
@@ -557,8 +557,8 @@ SHAS
expect(::File).to receive(:exist?).with("/my/deploy/dir/.git").and_return(true)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
# invoked twice - first time from load_current_resource
- expect(@provider).to receive(:find_current_revision).exactly(1).and_return('d35af14d41ae22b19da05d7d03a0bafc321b244c')
- allow(@provider).to receive(:target_revision).and_return('28af684d8460ba4793eda3e7ac238c864a5d029a')
+ expect(@provider).to receive(:find_current_revision).exactly(1).and_return("d35af14d41ae22b19da05d7d03a0bafc321b244c")
+ allow(@provider).to receive(:target_revision).and_return("28af684d8460ba4793eda3e7ac238c864a5d029a")
expect(@provider).to receive(:fetch_updates)
expect(@provider).to receive(:enable_submodules)
expect(@provider).to receive(:add_remotes)
@@ -569,8 +569,8 @@ SHAS
it "does not fetch any updates if the remote revision matches the current revision" do
expect(::File).to receive(:exist?).with("/my/deploy/dir/.git").and_return(true)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
- allow(@provider).to receive(:find_current_revision).and_return('d35af14d41ae22b19da05d7d03a0bafc321b244c')
- allow(@provider).to receive(:target_revision).and_return('d35af14d41ae22b19da05d7d03a0bafc321b244c')
+ allow(@provider).to receive(:find_current_revision).and_return("d35af14d41ae22b19da05d7d03a0bafc321b244c")
+ allow(@provider).to receive(:target_revision).and_return("d35af14d41ae22b19da05d7d03a0bafc321b244c")
expect(@provider).not_to receive(:fetch_updates)
expect(@provider).to receive(:add_remotes)
@provider.run_action(:sync)
@@ -609,7 +609,7 @@ SHAS
@resource.additional_remotes({:opscode => "opscode_repo_url",
:another_repo => "some_other_repo_url"})
allow(STDOUT).to receive(:tty?).and_return(false)
- command_response = double('shell_out')
+ command_response = double("shell_out")
allow(command_response).to receive(:exitstatus) { 0 }
@resource.additional_remotes.each_pair do |remote_name, remote_url|
expect(@provider).to receive(:setup_remote_tracking_branches).with(remote_name, remote_url)
@@ -620,7 +620,7 @@ SHAS
describe "calling multiple_remotes?" do
before(:each) do
- @command_response = double('shell_out')
+ @command_response = double("shell_out")
end
describe "when check remote command returns with status 2" do
@@ -647,7 +647,7 @@ SHAS
describe "calling remote_matches?" do
before(:each) do
- @command_response = double('shell_out')
+ @command_response = double("shell_out")
end
describe "when output of the check remote command matches the repository url" do
diff --git a/spec/unit/provider/group/dscl_spec.rb b/spec/unit/provider/group/dscl_spec.rb
index d84e4e1d57..1a61fc2383 100644
--- a/spec/unit/provider/group/dscl_spec.rb
+++ b/spec/unit/provider/group/dscl_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Group::Dscl do
before do
@@ -293,7 +293,7 @@ describe Chef::Provider::Group::Dscl do
end
end
-describe 'Test DSCL loading' do
+describe "Test DSCL loading" do
before do
@node = Chef::Node.new
@events = Chef::EventDispatch::Dispatcher.new
@@ -320,12 +320,12 @@ EOF
end
- it 'should parse gid properly' do
+ it "should parse gid properly" do
allow(File).to receive(:exists?).and_return(true)
expect(@current_resource.gid).to eq("999")
end
- it 'should parse members properly' do
+ it "should parse members properly" do
allow(File).to receive(:exists?).and_return(true)
- expect(@current_resource.members).to eq(['waka', 'bar'])
+ expect(@current_resource.members).to eq(["waka", "bar"])
end
end
diff --git a/spec/unit/provider/group/gpasswd_spec.rb b/spec/unit/provider/group/gpasswd_spec.rb
index 55d978fa7e..a24424182d 100644
--- a/spec/unit/provider/group/gpasswd_spec.rb
+++ b/spec/unit/provider/group/gpasswd_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Group::Gpasswd, "modify_group_members" do
before do
diff --git a/spec/unit/provider/group/groupadd_spec.rb b/spec/unit/provider/group/groupadd_spec.rb
index 47021a9af3..8cdc096c68 100644
--- a/spec/unit/provider/group/groupadd_spec.rb
+++ b/spec/unit/provider/group/groupadd_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Group::Groupadd, "set_options" do
before do
diff --git a/spec/unit/provider/group/groupmod_spec.rb b/spec/unit/provider/group/groupmod_spec.rb
index 496d1e28fa..a69774a309 100644
--- a/spec/unit/provider/group/groupmod_spec.rb
+++ b/spec/unit/provider/group/groupmod_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Group::Groupmod do
before do
diff --git a/spec/unit/provider/group/pw_spec.rb b/spec/unit/provider/group/pw_spec.rb
index 531d0a52a2..ed1f06efe0 100644
--- a/spec/unit/provider/group/pw_spec.rb
+++ b/spec/unit/provider/group/pw_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Group::Pw do
before do
diff --git a/spec/unit/provider/group/usermod_spec.rb b/spec/unit/provider/group/usermod_spec.rb
index 6c4c4d2e07..cd532f8b8d 100644
--- a/spec/unit/provider/group/usermod_spec.rb
+++ b/spec/unit/provider/group/usermod_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Group::Usermod do
before do
diff --git a/spec/unit/provider/group/windows_spec.rb b/spec/unit/provider/group/windows_spec.rb
index 23dfa8315f..4f071f3b94 100644
--- a/spec/unit/provider/group/windows_spec.rb
+++ b/spec/unit/provider/group/windows_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class Chef
class Util
@@ -94,7 +94,7 @@ describe Chef::Provider::Group::Windows, "NetGroup" do
@new_resource = Chef::Resource::Group.new("Creating a new group")
@new_resource.group_name "Remote Desktop Users"
end
- it 'sets group_name correctly' do
+ it "sets group_name correctly" do
expect(Chef::Util::Windows::NetGroup).to receive(:new).with("Remote Desktop Users")
Chef::Provider::Group::Windows.new(@new_resource, @run_context)
end
diff --git a/spec/unit/provider/group_spec.rb b/spec/unit/provider/group_spec.rb
index 55a2f97aa5..957e7b14df 100644
--- a/spec/unit/provider/group_spec.rb
+++ b/spec/unit/provider/group_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::User do
@@ -41,7 +41,7 @@ describe Chef::Provider::User do
:gid => 20,
:mem => [ "root", "aj" ],
)
- allow(Etc).to receive(:getgrnam).with('wheel').and_return(@pw_group)
+ allow(Etc).to receive(:getgrnam).with("wheel").and_return(@pw_group)
end
it "assumes the group exists by default" do
@@ -52,7 +52,7 @@ describe Chef::Provider::User do
it "sets the group name of the current resource to the group name of the new resource" do
@provider.load_current_resource
- expect(@provider.current_resource.group_name).to eq('wheel')
+ expect(@provider.current_resource.group_name).to eq("wheel")
end
it "does not modify the desired gid if set" do
diff --git a/spec/unit/provider/http_request_spec.rb b/spec/unit/provider/http_request_spec.rb
index 980458abd3..33c9167c33 100644
--- a/spec/unit/provider/http_request_spec.rb
+++ b/spec/unit/provider/http_request_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::HttpRequest do
before(:each) do
@@ -24,7 +24,7 @@ describe Chef::Provider::HttpRequest do
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
- @new_resource = Chef::Resource::HttpRequest.new('adam')
+ @new_resource = Chef::Resource::HttpRequest.new("adam")
@new_resource.name "adam"
@new_resource.url "http://www.opscode.com/"
@new_resource.message "is cool"
diff --git a/spec/unit/provider/ifconfig/aix_spec.rb b/spec/unit/provider/ifconfig/aix_spec.rb
index 0b6fa33614..6213de4803 100644
--- a/spec/unit/provider/ifconfig/aix_spec.rb
+++ b/spec/unit/provider/ifconfig/aix_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/exceptions'
+require "spec_helper"
+require "chef/exceptions"
describe Chef::Provider::Ifconfig::Aix do
diff --git a/spec/unit/provider/ifconfig/debian_spec.rb b/spec/unit/provider/ifconfig/debian_spec.rb
index 0c02ae9cd4..b116ecf127 100644
--- a/spec/unit/provider/ifconfig/debian_spec.rb
+++ b/spec/unit/provider/ifconfig/debian_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/exceptions'
+require "spec_helper"
+require "chef/exceptions"
describe Chef::Provider::Ifconfig::Debian do
diff --git a/spec/unit/provider/ifconfig/redhat_spec.rb b/spec/unit/provider/ifconfig/redhat_spec.rb
index 620fd341d7..bdcaa57330 100644
--- a/spec/unit/provider/ifconfig/redhat_spec.rb
+++ b/spec/unit/provider/ifconfig/redhat_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/exceptions'
+require "spec_helper"
+require "chef/exceptions"
describe Chef::Provider::Ifconfig::Redhat do
before do
diff --git a/spec/unit/provider/ifconfig_spec.rb b/spec/unit/provider/ifconfig_spec.rb
index 90109ca1c0..e4335ed3e7 100644
--- a/spec/unit/provider/ifconfig_spec.rb
+++ b/spec/unit/provider/ifconfig_spec.rb
@@ -17,8 +17,8 @@
#
#require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))
-require 'spec_helper'
-require 'chef/exceptions'
+require "spec_helper"
+require "chef/exceptions"
describe Chef::Provider::Ifconfig do
before do
diff --git a/spec/unit/provider/link_spec.rb b/spec/unit/provider/link_spec.rb
index 0f95ce997e..80ebc62f2a 100644
--- a/spec/unit/provider/link_spec.rb
+++ b/spec/unit/provider/link_spec.rb
@@ -17,12 +17,12 @@
# limitations under the License.
#
-require 'ostruct'
+require "ostruct"
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/win32/file' #probably need this in spec_helper
+ require "chef/win32/file" #probably need this in spec_helper
end
describe Chef::Resource::Link, :not_supported_on_win2k3 do
@@ -39,7 +39,7 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
end
def canonicalize(path)
- Chef::Platform.windows? ? path.gsub('/', '\\') : path
+ Chef::Platform.windows? ? path.gsub("/", '\\') : path
end
describe "when the target is a symlink" do
@@ -80,13 +80,13 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
# We test create in unit tests because there is no other way to ensure
# it does no work. Other create and delete scenarios are covered in
# the functional tests for links.
- context 'when the desired state is identical' do
+ context "when the desired state is identical" do
let(:new_resource) do
result = Chef::Resource::Link.new("#{CHEF_SPEC_DATA}/fofile-link")
result.to "#{CHEF_SPEC_DATA}/fofile"
result
end
- it 'create does no work' do
+ it "create does no work" do
expect(provider.access_controls).not_to receive(:set_all)
provider.run_action(:create)
end
@@ -164,7 +164,7 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
expect(provider.current_resource.target_file).to eq("#{CHEF_SPEC_DATA}/fofile-link")
end
it "should update the current source of the existing link with an empty string" do
- expect(provider.current_resource.to).to eq('')
+ expect(provider.current_resource.to).to eq("")
end
it "should not set the owner" do
expect(provider.current_resource.owner).to eq(nil)
@@ -191,7 +191,7 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
expect(provider.current_resource.target_file).to eq("#{CHEF_SPEC_DATA}/fofile-link")
end
it "should update the current source of the existing link with an empty string" do
- expect(provider.current_resource.to).to eq('')
+ expect(provider.current_resource.to).to eq("")
end
it "should not set the owner" do
expect(provider.current_resource.owner).to eq(nil)
@@ -233,14 +233,14 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
# We test create in unit tests because there is no other way to ensure
# it does no work. Other create and delete scenarios are covered in
# the functional tests for links.
- context 'when the desired state is identical' do
+ context "when the desired state is identical" do
let(:new_resource) do
result = Chef::Resource::Link.new("#{CHEF_SPEC_DATA}/fofile-link")
result.to "#{CHEF_SPEC_DATA}/fofile"
result.link_type :hard
result
end
- it 'create does no work' do
+ it "create does no work" do
expect(provider.file_class).not_to receive(:symlink)
expect(provider.file_class).not_to receive(:link)
expect(provider.access_controls).not_to receive(:set_all)
diff --git a/spec/unit/provider/log_spec.rb b/spec/unit/provider/log_spec.rb
index 1ecc633ce1..5aadcbf7cd 100644
--- a/spec/unit/provider/log_spec.rb
+++ b/spec/unit/provider/log_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Log::ChefLog do
diff --git a/spec/unit/provider/mdadm_spec.rb b/spec/unit/provider/mdadm_spec.rb
index 38401b7225..ec5f6237d1 100644
--- a/spec/unit/provider/mdadm_spec.rb
+++ b/spec/unit/provider/mdadm_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Provider::Mdadm do
@@ -25,7 +25,7 @@ describe Chef::Provider::Mdadm do
@node = Chef::Node.new
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
- @new_resource = Chef::Resource::Mdadm.new('/dev/md1')
+ @new_resource = Chef::Resource::Mdadm.new("/dev/md1")
@new_resource.devices ["/dev/sdz1","/dev/sdz2","/dev/sdz3"]
@provider = Chef::Provider::Mdadm.new(@new_resource, @run_context)
end
@@ -34,8 +34,8 @@ describe Chef::Provider::Mdadm do
it "should set the current resources mount point to the new resources mount point" do
allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:status => 0))
@provider.load_current_resource
- expect(@provider.current_resource.name).to eq('/dev/md1')
- expect(@provider.current_resource.raid_device).to eq('/dev/md1')
+ expect(@provider.current_resource.name).to eq("/dev/md1")
+ expect(@provider.current_resource.raid_device).to eq("/dev/md1")
end
it "determines that the metadevice exists when mdadm exit code is zero" do
@@ -53,7 +53,7 @@ describe Chef::Provider::Mdadm do
describe "after the metadevice status is known" do
before(:each) do
- @current_resource = Chef::Resource::Mdadm.new('/dev/md1')
+ @current_resource = Chef::Resource::Mdadm.new("/dev/md1")
@new_resource.level 5
allow(@provider).to receive(:load_current_resource).and_return(true)
@provider.current_resource = @current_resource
@@ -69,7 +69,7 @@ describe Chef::Provider::Mdadm do
it "should specify a bitmap only if set" do
@current_resource.exists(false)
- @new_resource.bitmap('grow')
+ @new_resource.bitmap("grow")
expected_command = "yes | mdadm --create /dev/md1 --level 5 --chunk=16 --metadata=0.90 --bitmap=grow --raid-devices 3 /dev/sdz1 /dev/sdz2 /dev/sdz3"
expect(@provider).to receive(:shell_out!).with(expected_command)
@provider.run_action(:create)
diff --git a/spec/unit/provider/mount/aix_spec.rb b/spec/unit/provider/mount/aix_spec.rb
index e232592275..1aa64967af 100644
--- a/spec/unit/provider/mount/aix_spec.rb
+++ b/spec/unit/provider/mount/aix_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Provider::Mount::Aix do
@@ -114,7 +114,7 @@ ENABLED
expect(@provider.current_resource.mounted).to be_truthy
expect(@provider.current_resource.mount_point).to eql(@new_resource.mount_point)
expect(@provider.current_resource.fstype).to eql("jfs2")
- expect(@provider.current_resource.options).to eql(['rw'])
+ expect(@provider.current_resource.options).to eql(["rw"])
end
describe "mount_fs" do
diff --git a/spec/unit/provider/mount/mount_spec.rb b/spec/unit/provider/mount/mount_spec.rb
index 124d51b367..c267dc706c 100644
--- a/spec/unit/provider/mount/mount_spec.rb
+++ b/spec/unit/provider/mount/mount_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Provider::Mount::Mount do
before(:each) do
@@ -42,15 +42,15 @@ describe Chef::Provider::Mount::Mount do
describe "when discovering the current fs state" do
before do
- allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => ''))
+ allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => ""))
allow(::File).to receive(:foreach).with("/etc/fstab")
end
it "should create a current resource with the same mount point and device" do
@provider.load_current_resource
- expect(@provider.current_resource.name).to eq('/tmp/foo')
- expect(@provider.current_resource.mount_point).to eq('/tmp/foo')
- expect(@provider.current_resource.device).to eq('/dev/sdz1')
+ expect(@provider.current_resource.name).to eq("/tmp/foo")
+ expect(@provider.current_resource.mount_point).to eq("/tmp/foo")
+ expect(@provider.current_resource.device).to eq("/dev/sdz1")
end
it "should accecpt device_type :uuid", :not_supported_on_solaris do
@@ -134,7 +134,7 @@ describe Chef::Provider::Mount::Mount do
it "should set mounted true if the symlink target of the device is found in the mounts list" do
# expand the target path to correct specs on Windows
- target = ::File.expand_path('/dev/mapper/target')
+ target = ::File.expand_path("/dev/mapper/target")
allow(::File).to receive(:symlink?).with("#{@new_resource.device}").and_return(true)
allow(::File).to receive(:readlink).with("#{@new_resource.device}").and_return(target)
@@ -266,7 +266,7 @@ describe Chef::Provider::Mount::Mount do
fstab = "#{@new_resource.device} #{@new_resource.mount_point} #{@new_resource.fstype} #{options} 1 2\n"
allow(::File).to receive(:foreach).with("/etc/fstab").and_yield fstab
@provider.load_current_resource
- expect(@provider.current_resource.options).to eq(options.split(','))
+ expect(@provider.current_resource.options).to eq(options.split(","))
end
it "should not mangle the mount options if the symlink target is in fstab" do
@@ -279,7 +279,7 @@ describe Chef::Provider::Mount::Mount do
fstab = "#{target} #{@new_resource.mount_point} #{@new_resource.fstype} #{options} 1 2\n"
allow(::File).to receive(:foreach).with("/etc/fstab").and_yield fstab
@provider.load_current_resource
- expect(@provider.current_resource.options).to eq(options.split(','))
+ expect(@provider.current_resource.options).to eq(options.split(","))
end
end
@@ -311,7 +311,7 @@ describe Chef::Provider::Mount::Mount do
@new_resource.device "d21afe51-a0fe-4dc6-9152-ac733763ae0a"
@new_resource.device_type :uuid
allow(@provider).to receive(:shell_out).with("/sbin/findfs UUID=d21afe51-a0fe-4dc6-9152-ac733763ae0a").and_return(status)
- @stdout_mock = double('stdout mock')
+ @stdout_mock = double("stdout mock")
allow(@stdout_mock).to receive(:each).and_yield("#{@new_resource.device} on #{@new_resource.mount_point}")
expect(@provider).to receive(:shell_out!).with("mount -t #{@new_resource.fstype} -o defaults -U #{@new_resource.device} #{@new_resource.mount_point}").and_return(@stdout_mock)
@provider.mount_fs()
diff --git a/spec/unit/provider/mount/solaris_spec.rb b/spec/unit/provider/mount/solaris_spec.rb
index 9a9b09b531..707a06ceee 100644
--- a/spec/unit/provider/mount/solaris_spec.rb
+++ b/spec/unit/provider/mount/solaris_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
# Do not run these tests on windows because some path handling
# code is not implemented to handle windows paths.
@@ -57,7 +57,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
}
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
@@ -84,7 +84,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
}
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t0d0s0 on / type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200000 on Tue Jul 31 22:34:46 2012
/dev/dsk/c0t2d0s7 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
EOF
@@ -215,7 +215,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when loading a normal UFS filesystem with noauto, don't mount at boot" do
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
@@ -245,12 +245,12 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the device is an smbfs mount" do
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
//solarsystem/tmp on /mnt type smbfs read/write/setuid/devices/dev=5080000 on Tue Mar 29 11:40:18 2011
EOF
}
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
//WORKGROUP;username:password@host/share - /mountpoint smbfs - no fileperms=0777,dirperms=0777
EOF
}
@@ -264,13 +264,13 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the device is an NFS mount" do
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
cartman:/share2 on /cartman type nfs rsize=32768,wsize=32768,NFSv4,dev=4000004 on Tue Mar 29 11:40:18 2011
EOF
}
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
cartman:/share2 - /cartman nfs - yes rw,soft
EOF
}
@@ -335,13 +335,13 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
let(:target) { "/dev/mapper/target" }
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
#{target} on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
EOF
}
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
#{target} /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
EOF
}
@@ -372,13 +372,13 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
let(:absolute_target) { File.expand_path(target, File.dirname(device)) }
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
#{absolute_target} on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
EOF
}
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
#{absolute_target} /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
EOF
}
@@ -405,7 +405,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the matching mount point is last in the mounts list" do
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t0d0s0 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200000 on Tue Jul 31 22:34:46 2012
/dev/dsk/c0t2d0s7 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
EOF
@@ -418,7 +418,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the matching mount point is not last in the mounts list" do
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s7 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
/dev/dsk/c0t0d0s0 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200000 on Tue Jul 31 22:34:46 2012
EOF
@@ -431,7 +431,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the matching mount point is not in the mounts list (mountpoint wrong)" do
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s7 on /mnt/foob type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
EOF
}
@@ -443,7 +443,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the matching mount point is not in the mounts list (raw device wrong)" do
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s72 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
EOF
}
@@ -455,7 +455,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the mount point is last in fstab" do
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s72 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
EOF
@@ -469,7 +469,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the mount point is not last in fstab and is a substring of another mount" do
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
/dev/dsk/c0t2d0s72 /dev/rdsk/c0t2d0s7 /mnt/foo/bar ufs 2 yes -
EOF
@@ -483,7 +483,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the mount point is not last in fstab" do
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
/dev/dsk/c0t2d0s72 /dev/rdsk/c0t2d0s72 /mnt/foo ufs 2 yes -
EOF
@@ -497,7 +497,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the mount point is not in fstab, but the mountpoint is a substring of one that is" do
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foob ufs 2 yes -
EOF
}
@@ -510,7 +510,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the mount point is not in fstab, but the device is a substring of one that is" do
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s72 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
EOF
}
@@ -523,7 +523,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the mountpoint line is commented out" do
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
#/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
EOF
}
diff --git a/spec/unit/provider/mount/windows_spec.rb b/spec/unit/provider/mount/windows_spec.rb
index 2de6f11d43..c3c1934fa0 100644
--- a/spec/unit/provider/mount/windows_spec.rb
+++ b/spec/unit/provider/mount/windows_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class Chef
class Util
diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb
index cc2a456440..3d36a921b3 100644
--- a/spec/unit/provider/mount_spec.rb
+++ b/spec/unit/provider/mount_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Mount do
@@ -28,7 +28,7 @@ describe Chef::Provider::Mount do
let(:run_context) { Chef::RunContext.new(node, {}, events) }
let(:new_resource) do
- new_resource = Chef::Resource::Mount.new('/tmp/foo')
+ new_resource = Chef::Resource::Mount.new("/tmp/foo")
new_resource.device "/dev/sdz1"
new_resource.name "/tmp/foo"
new_resource.mount_point "/tmp/foo"
@@ -38,7 +38,7 @@ describe Chef::Provider::Mount do
let(:current_resource) do
# this abstract superclass has no load_current_resource to call
- current_resource = Chef::Resource::Mount.new('/tmp/foo')
+ current_resource = Chef::Resource::Mount.new("/tmp/foo")
current_resource.device "/dev/sdz1"
current_resource.name "/tmp/foo"
current_resource.mount_point "/tmp/foo"
diff --git a/spec/unit/provider/ohai_spec.rb b/spec/unit/provider/ohai_spec.rb
index 4072487f35..b5ce1e8fc5 100644
--- a/spec/unit/provider/ohai_spec.rb
+++ b/spec/unit/provider/ohai_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'chef/run_context'
+require "chef/run_context"
describe Chef::Provider::Ohai do
before(:each) do
@@ -63,22 +63,22 @@ describe Chef::Provider::Ohai do
describe "when reloading ohai" do
before do
- @node.automatic_attrs[:origdata] = 'somevalue'
+ @node.automatic_attrs[:origdata] = "somevalue"
end
it "applies updated ohai data to the node" do
- expect(@node[:origdata]).to eq('somevalue')
+ expect(@node[:origdata]).to eq("somevalue")
expect(@node[:newdata]).to be_nil
@provider.run_action(:reload)
- expect(@node[:origdata]).to eq('somevalue')
- expect(@node[:newdata]).to eq('somevalue')
+ expect(@node[:origdata]).to eq("somevalue")
+ expect(@node[:newdata]).to eq("somevalue")
end
it "should reload a specific plugin and cause node to pick up new values" do
@new_resource.plugin "someplugin"
@provider.run_action(:reload)
- expect(@node[:origdata]).to eq('somevalue')
- expect(@node[:newdata]).to eq('somevalue')
+ expect(@node[:origdata]).to eq("somevalue")
+ expect(@node[:newdata]).to eq("somevalue")
end
end
end
diff --git a/spec/unit/provider/osx_profile_spec.rb b/spec/unit/provider/osx_profile_spec.rb
index 2e87faeb48..76bfc3b4eb 100644
--- a/spec/unit/provider/osx_profile_spec.rb
+++ b/spec/unit/provider/osx_profile_spec.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::OsxProfile do
let(:shell_out_success) do
- double('shell_out', :exitstatus => 0, :error? => false)
+ double("shell_out", :exitstatus => 0, :error? => false)
end
- describe 'action_create' do
+ describe "action_create" do
let(:node) { Chef::Node.new }
let(:events) { Chef::EventDispatch::Dispatcher.new }
let(:run_context) { Chef::RunContext.new(node, {}, events) }
@@ -74,28 +74,28 @@ describe Chef::Provider::OsxProfile do
# ProfileUUID in all_profiles to match the new config specific UUID
let(:test_profile) do
{
- 'PayloadIdentifier' => 'com.testprofile.screensaver',
- 'PayloadRemovalDisallowed' => false,
- 'PayloadScope' => 'System',
- 'PayloadType' => 'Configuration',
- 'PayloadUUID' => '1781fbec-3325-565f-9022-8aa28135c3cc',
- 'PayloadOrganization' => 'Chef',
- 'PayloadVersion' => 1,
- 'PayloadDisplayName' => 'Screensaver Settings',
- 'PayloadContent'=> [
+ "PayloadIdentifier" => "com.testprofile.screensaver",
+ "PayloadRemovalDisallowed" => false,
+ "PayloadScope" => "System",
+ "PayloadType" => "Configuration",
+ "PayloadUUID" => "1781fbec-3325-565f-9022-8aa28135c3cc",
+ "PayloadOrganization" => "Chef",
+ "PayloadVersion" => 1,
+ "PayloadDisplayName" => "Screensaver Settings",
+ "PayloadContent"=> [
{
- 'PayloadType' => 'com.apple.ManagedClient.preferences',
- 'PayloadVersion' => 1,
- 'PayloadIdentifier' => 'com.testprofile.screensaver',
- 'PayloadUUID' => '73fc30e0-1e57-0131-c32d-000c2944c108',
- 'PayloadEnabled' => true,
- 'PayloadDisplayName' => 'com.apple.screensaver',
- 'PayloadContent' => {
- 'com.apple.screensaver' => {
- 'Forced' => [
+ "PayloadType" => "com.apple.ManagedClient.preferences",
+ "PayloadVersion" => 1,
+ "PayloadIdentifier" => "com.testprofile.screensaver",
+ "PayloadUUID" => "73fc30e0-1e57-0131-c32d-000c2944c108",
+ "PayloadEnabled" => true,
+ "PayloadDisplayName" => "com.apple.screensaver",
+ "PayloadContent" => {
+ "com.apple.screensaver" => {
+ "Forced" => [
{
- 'mcx_preference_settings' => {
- 'idleTime' => 0
+ "mcx_preference_settings" => {
+ "idleTime" => 0
}
},
]
@@ -111,16 +111,16 @@ describe Chef::Provider::OsxProfile do
before(:each) do
allow(provider).to receive(:cookbook_file_available?).and_return(true)
- allow(provider).to receive(:cache_cookbook_profile).and_return('/tmp/test.mobileconfig.remote')
+ allow(provider).to receive(:cache_cookbook_profile).and_return("/tmp/test.mobileconfig.remote")
allow(provider).to receive(:get_new_profile_hash).and_return(test_profile)
allow(provider).to receive(:get_installed_profiles).and_return(all_profiles)
allow(provider).to receive(:read_plist).and_return(all_profiles)
allow(::File).to receive(:unlink).and_return(true)
end
- it 'should build the get all profiles shellout command correctly' do
- profile_name = 'com.testprofile.screensaver.mobileconfig'
- tempfile = '/tmp/allprofiles.plist'
+ it "should build the get all profiles shellout command correctly" do
+ profile_name = "com.testprofile.screensaver.mobileconfig"
+ tempfile = "/tmp/allprofiles.plist"
new_resource.profile_name profile_name
allow(provider).to receive(:generate_tempfile).and_return(tempfile)
allow(provider).to receive(:get_installed_profiles).and_call_original
@@ -129,29 +129,29 @@ describe Chef::Provider::OsxProfile do
provider.load_current_resource
end
- it 'should use profile name as profile when no profile is set' do
- profile_name = 'com.testprofile.screensaver.mobileconfig'
+ it "should use profile name as profile when no profile is set" do
+ profile_name = "com.testprofile.screensaver.mobileconfig"
new_resource.profile_name profile_name
provider.load_current_resource
expect(new_resource.profile_name).to eql(profile_name)
end
- it 'should use identifier from specified profile' do
+ it "should use identifier from specified profile" do
new_resource.profile test_profile
provider.load_current_resource
expect(
provider.instance_variable_get(:@new_profile_identifier)
- ).to eql(test_profile['PayloadIdentifier'])
+ ).to eql(test_profile["PayloadIdentifier"])
end
- it 'should install when not installed' do
+ it "should install when not installed" do
new_resource.profile test_profile
allow(provider).to receive(:get_installed_profiles).and_return(no_profiles)
provider.load_current_resource
expect { provider.run_action(:install) }.to_not raise_error
end
- it 'does not install if the profile is already installed' do
+ it "does not install if the profile is already installed" do
new_resource.profile test_profile
allow(provider).to receive(:get_installed_profiles).and_return(all_profiles)
provider.load_current_resource
@@ -159,40 +159,40 @@ describe Chef::Provider::OsxProfile do
expect { provider.action_install }.to_not raise_error
end
- it 'should install when installed but uuid differs' do
+ it "should install when installed but uuid differs" do
new_resource.profile test_profile
- all_profiles['_computerlevel'][1]['ProfileUUID'] = '1781fbec-3325-565f-9022-9bb39245d4dd'
+ all_profiles["_computerlevel"][1]["ProfileUUID"] = "1781fbec-3325-565f-9022-9bb39245d4dd"
provider.load_current_resource
expect { provider.run_action(:install) }.to_not raise_error
end
- it 'should build the shellout install command correctly' do
- profile_path = '/tmp/test.mobileconfig'
+ it "should build the shellout install command correctly" do
+ profile_path = "/tmp/test.mobileconfig"
new_resource.profile test_profile
# Change the profile so it triggers an install
- all_profiles['_computerlevel'][1]['ProfileUUID'] = '1781fbec-3325-565f-9022-9bb39245d4dd'
+ all_profiles["_computerlevel"][1]["ProfileUUID"] = "1781fbec-3325-565f-9022-9bb39245d4dd"
provider.load_current_resource
allow(provider).to receive(:write_profile_to_disk).and_return(profile_path)
expect(provider).to receive(:shell_out).with("profiles -I -F '#{profile_path}'").and_return(shell_out_success)
provider.action_install()
end
- it 'should fail if there is no identifier inside the profile' do
- test_profile.delete('PayloadIdentifier')
+ it "should fail if there is no identifier inside the profile" do
+ test_profile.delete("PayloadIdentifier")
new_resource.profile test_profile
- error_message = 'The specified profile does not seem to be valid'
+ error_message = "The specified profile does not seem to be valid"
expect{provider.run_action(:install)}.to raise_error(RuntimeError, error_message)
end
end
- describe 'action_remove' do
+ describe "action_remove" do
let(:node) { Chef::Node.new }
let(:events) { Chef::EventDispatch::Dispatcher.new }
let(:run_context) { Chef::RunContext.new(node, {}, events) }
let(:new_resource) { Chef::Resource::OsxProfile.new("Profile Test", run_context) }
let(:provider) { Chef::Provider::OsxProfile.new(new_resource, run_context) }
- let(:current_resource) { Chef::Resource::OsxProfile.new('Profile Test') }
+ let(:current_resource) { Chef::Resource::OsxProfile.new("Profile Test") }
let(:all_profiles) do
{"_computerlevel"=>
[{"ProfileDisplayName"=>"ScreenSaver Settings",
@@ -240,24 +240,24 @@ describe Chef::Provider::OsxProfile do
allow(provider).to receive(:get_installed_profiles).and_return(all_profiles)
end
- it 'should use resource name for identifier when not specified' do
- new_resource.profile_name 'com.testprofile.screensaver'
+ it "should use resource name for identifier when not specified" do
+ new_resource.profile_name "com.testprofile.screensaver"
new_resource.action(:remove)
provider.load_current_resource
expect(provider.instance_variable_get(:@new_profile_identifier)
).to eql(new_resource.profile_name)
end
- it 'should use specified identifier' do
- new_resource.identifier 'com.testprofile.screensaver'
+ it "should use specified identifier" do
+ new_resource.identifier "com.testprofile.screensaver"
new_resource.action(:remove)
provider.load_current_resource
expect(provider.instance_variable_get(:@new_profile_identifier)
).to eql(new_resource.identifier)
end
- it 'should build the shellout remove command correctly' do
- new_resource.identifier 'com.testprofile.screensaver'
+ it "should build the shellout remove command correctly" do
+ new_resource.identifier "com.testprofile.screensaver"
new_resource.action(:remove)
provider.load_current_resource
expect(provider).to receive(:shell_out).with("profiles -R -p '#{new_resource.identifier}'").and_return(shell_out_success)
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") }
diff --git a/spec/unit/provider/package_spec.rb b/spec/unit/provider/package_spec.rb
index cf905aeab7..ca2e545358 100644
--- a/spec/unit/provider/package_spec.rb
+++ b/spec/unit/provider/package_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Package do
let(:node) do
@@ -27,8 +27,8 @@ describe Chef::Provider::Package do
end
let(:events) { Chef::EventDispatch::Dispatcher.new }
let(:run_context) { Chef::RunContext.new(node, {}, events) }
- let(:new_resource) { Chef::Resource::Package.new('emacs') }
- let(:current_resource) { Chef::Resource::Package.new('emacs') }
+ let(:new_resource) { Chef::Resource::Package.new("emacs") }
+ let(:current_resource) { Chef::Resource::Package.new("emacs") }
let(:candidate_version) { "1.0" }
let(:provider) do
provider = Chef::Provider::Package.new(new_resource, run_context)
@@ -44,8 +44,8 @@ describe Chef::Provider::Package do
end
it "raises a Chef::Exceptions::InvalidResourceSpecification if both multipackage and source are provided" do
- new_resource.package_name(['a', 'b'])
- new_resource.source('foo')
+ new_resource.package_name(["a", "b"])
+ new_resource.source("foo")
expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::InvalidResourceSpecification)
end
@@ -187,12 +187,12 @@ describe Chef::Provider::Package do
describe "When removing the package" do
before(:each) do
allow(provider).to receive(:remove_package).and_return(true)
- current_resource.version '1.4.2'
+ current_resource.version "1.4.2"
end
it "should remove the package if it is installed" do
expect(provider).to be_removing_package
- expect(provider).to receive(:remove_package).with('emacs', nil)
+ expect(provider).to receive(:remove_package).with("emacs", nil)
provider.run_action(:remove)
expect(new_resource).to be_updated
expect(new_resource).to be_updated_by_last_action
@@ -201,7 +201,7 @@ describe Chef::Provider::Package do
it "should remove the package at a specific version if it is installed at that version" do
new_resource.version "1.4.2"
expect(provider).to be_removing_package
- expect(provider).to receive(:remove_package).with('emacs', '1.4.2')
+ expect(provider).to receive(:remove_package).with("emacs", "1.4.2")
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
@@ -231,12 +231,12 @@ describe Chef::Provider::Package do
describe "When purging the package" do
before(:each) do
allow(provider).to receive(:purge_package).and_return(true)
- current_resource.version '1.4.2'
+ current_resource.version "1.4.2"
end
it "should purge the package if it is installed" do
expect(provider).to be_removing_package
- expect(provider).to receive(:purge_package).with('emacs', nil)
+ expect(provider).to receive(:purge_package).with("emacs", nil)
provider.run_action(:purge)
expect(new_resource).to be_updated
expect(new_resource).to be_updated_by_last_action
@@ -245,7 +245,7 @@ describe Chef::Provider::Package do
it "should purge the package at a specific version if it is installed at that version" do
new_resource.version "1.4.2"
expect(provider).to be_removing_package
- expect(provider).to receive(:purge_package).with('emacs', '1.4.2')
+ expect(provider).to receive(:purge_package).with("emacs", "1.4.2")
provider.run_action(:purge)
expect(new_resource).to be_updated_by_last_action
end
@@ -280,9 +280,9 @@ describe Chef::Provider::Package do
end
it "should info log, reconfigure the package and update the resource" do
- allow(current_resource).to receive(:version).and_return('1.0')
+ allow(current_resource).to receive(:version).and_return("1.0")
allow(new_resource).to receive(:response_file).and_return(true)
- expect(provider).to receive(:get_preseed_file).and_return('/var/cache/preseed-test')
+ expect(provider).to receive(:get_preseed_file).and_return("/var/cache/preseed-test")
allow(provider).to receive(:preseed_package).and_return(true)
allow(provider).to receive(:reconfig_package).and_return(true)
expect(Chef::Log).to receive(:info).with("package[emacs] reconfigured")
@@ -301,7 +301,7 @@ describe Chef::Provider::Package do
end
it "should debug log and not reconfigure the package if no response_file is given" do
- allow(current_resource).to receive(:version).and_return('1.0')
+ allow(current_resource).to receive(:version).and_return("1.0")
allow(new_resource).to receive(:response_file).and_return(nil)
expect(Chef::Log).to receive(:debug).with("package[emacs] no response_file provided - nothing to do")
expect(provider).not_to receive(:reconfig_package)
@@ -310,7 +310,7 @@ describe Chef::Provider::Package do
end
it "should debug log and not reconfigure the package if the response_file has not changed" do
- allow(current_resource).to receive(:version).and_return('1.0')
+ allow(current_resource).to receive(:version).and_return("1.0")
allow(new_resource).to receive(:response_file).and_return(true)
expect(provider).to receive(:get_preseed_file).and_return(false)
allow(provider).to receive(:preseed_package).and_return(false)
@@ -323,19 +323,19 @@ describe Chef::Provider::Package do
describe "when running commands to be implemented by subclasses" do
it "should raises UnsupportedAction for install" do
- expect { provider.install_package('emacs', '1.4.2') }.to raise_error(Chef::Exceptions::UnsupportedAction)
+ expect { provider.install_package("emacs", "1.4.2") }.to raise_error(Chef::Exceptions::UnsupportedAction)
end
it "should raises UnsupportedAction for upgrade" do
- expect { provider.upgrade_package('emacs', '1.4.2') }.to raise_error(Chef::Exceptions::UnsupportedAction)
+ expect { provider.upgrade_package("emacs", "1.4.2") }.to raise_error(Chef::Exceptions::UnsupportedAction)
end
it "should raises UnsupportedAction for remove" do
- expect { provider.remove_package('emacs', '1.4.2') }.to raise_error(Chef::Exceptions::UnsupportedAction)
+ expect { provider.remove_package("emacs", "1.4.2") }.to raise_error(Chef::Exceptions::UnsupportedAction)
end
it "should raises UnsupportedAction for purge" do
- expect { provider.purge_package('emacs', '1.4.2') }.to raise_error(Chef::Exceptions::UnsupportedAction)
+ expect { provider.purge_package("emacs", "1.4.2") }.to raise_error(Chef::Exceptions::UnsupportedAction)
end
it "should raise UnsupportedAction for preseed_package" do
@@ -344,7 +344,7 @@ describe Chef::Provider::Package do
end
it "should raise UnsupportedAction for reconfig" do
- expect { provider.reconfig_package('emacs', '1.4.2') }.to raise_error(Chef::Exceptions::UnsupportedAction)
+ expect { provider.reconfig_package("emacs", "1.4.2") }.to raise_error(Chef::Exceptions::UnsupportedAction)
end
end
@@ -360,52 +360,52 @@ describe Chef::Provider::Package do
end
let(:run_context) { Chef::RunContext.new(node, cookbook_collection, events) }
let(:new_resource) do
- new_resource = Chef::Resource::Package.new('emacs')
- new_resource.response_file('java.response')
- new_resource.cookbook_name = 'java'
+ new_resource = Chef::Resource::Package.new("emacs")
+ new_resource.response_file("java.response")
+ new_resource.cookbook_name = "java"
new_resource
end
describe "creating the cookbook file resource to fetch the response file" do
before do
- expect(Chef::FileCache).to receive(:create_cache_path).with('preseed/java').and_return("/tmp/preseed/java")
+ expect(Chef::FileCache).to receive(:create_cache_path).with("preseed/java").and_return("/tmp/preseed/java")
end
it "sets the preseed resource's runcontext to its own run context" do
allow(Chef::FileCache).to receive(:create_cache_path).and_return("/tmp/preseed/java")
- expect(provider.preseed_resource('java', '6').run_context).not_to be_nil
- expect(provider.preseed_resource('java', '6').run_context).to equal(provider.run_context)
+ expect(provider.preseed_resource("java", "6").run_context).not_to be_nil
+ expect(provider.preseed_resource("java", "6").run_context).to equal(provider.run_context)
end
it "should set the cookbook name of the remote file to the new resources cookbook name" do
- expect(provider.preseed_resource('java', '6').cookbook_name).to eq('java')
+ expect(provider.preseed_resource("java", "6").cookbook_name).to eq("java")
end
it "should set remote files source to the new resources response file" do
- expect(provider.preseed_resource('java', '6').source).to eq('java.response')
+ expect(provider.preseed_resource("java", "6").source).to eq("java.response")
end
it "should never back up the cached response file" do
- expect(provider.preseed_resource('java', '6').backup).to be_falsey
+ expect(provider.preseed_resource("java", "6").backup).to be_falsey
end
it "sets the install path of the resource to $file_cache/$cookbook/$pkg_name-$pkg_version.seed" do
- expect(provider.preseed_resource('java', '6').path).to eq('/tmp/preseed/java/java-6.seed')
+ expect(provider.preseed_resource("java", "6").path).to eq("/tmp/preseed/java/java-6.seed")
end
end
describe "when installing the preseed file to the cache location" do
- let(:response_file_destination) { Dir.tmpdir + '/preseed--java--java-6.seed' }
+ let(:response_file_destination) { Dir.tmpdir + "/preseed--java--java-6.seed" }
let(:response_file_resource) {
response_file_resource = Chef::Resource::CookbookFile.new(response_file_destination, run_context)
- response_file_resource.cookbook_name = 'java'
+ response_file_resource.cookbook_name = "java"
response_file_resource.backup(false)
- response_file_resource.source('java.response')
+ response_file_resource.source("java.response")
response_file_resource
}
before do
- expect(provider).to receive(:preseed_resource).with('java', '6').and_return(response_file_resource)
+ expect(provider).to receive(:preseed_resource).with("java", "6").and_return(response_file_resource)
end
after do
@@ -547,7 +547,7 @@ describe "Subclass with use_multipackage_api" do
current_resource.package_name "vim"
current_resource.version [ "1.0" ]
allow(new_resource).to receive(:response_file).and_return(true)
- expect(provider).to receive(:get_preseed_file).and_return('/var/cache/preseed-test')
+ expect(provider).to receive(:get_preseed_file).and_return("/var/cache/preseed-test")
allow(provider).to receive(:preseed_package).and_return(true)
allow(provider).to receive(:reconfig_package).and_return(true)
expect(provider).to receive(:reconfig_package).with(
@@ -563,8 +563,8 @@ describe "Chef::Provider::Package - Multi" do
let(:node) { Chef::Node.new }
let(:events) { Chef::EventDispatch::Dispatcher.new }
let(:run_context) { Chef::RunContext.new(node, {}, events) }
- let(:new_resource) { Chef::Resource::Package.new(['emacs', 'vi']) }
- let(:current_resource) { Chef::Resource::Package.new(['emacs', 'vi']) }
+ let(:new_resource) { Chef::Resource::Package.new(["emacs", "vi"]) }
+ let(:current_resource) { Chef::Resource::Package.new(["emacs", "vi"]) }
let(:candidate_version) { [ "1.0", "6.2" ] }
let(:provider) do
provider = Chef::Provider::Package.new(new_resource, run_context)
@@ -590,30 +590,30 @@ describe "Chef::Provider::Package - Multi" do
it "installs the candidate versions when some are installed" do
expect(provider).to receive(:install_package).with(
- [ 'vi' ],
- [ '6.2' ],
+ [ "vi" ],
+ [ "6.2" ],
).and_return(true)
- current_resource.version(['1.0', nil])
+ current_resource.version(["1.0", nil])
provider.run_action(:install)
expect(new_resource).to be_updated
end
it "installs the specified version when some are out of date" do
- current_resource.version(['1.0', '6.2'])
- new_resource.version(['1.0', '6.1'])
+ current_resource.version(["1.0", "6.2"])
+ new_resource.version(["1.0", "6.1"])
provider.run_action(:install)
expect(new_resource).to be_updated
end
it "does not install any version if all are installed at the right version" do
- current_resource.version(['1.0', '6.2'])
- new_resource.version(['1.0', '6.2'])
+ current_resource.version(["1.0", "6.2"])
+ new_resource.version(["1.0", "6.2"])
provider.run_action(:install)
expect(new_resource).not_to be_updated_by_last_action
end
it "does not install any version if all are installed, and no version was specified" do
- current_resource.version(['1.0', '6.2'])
+ current_resource.version(["1.0", "6.2"])
provider.run_action(:install)
expect(new_resource).not_to be_updated_by_last_action
end
@@ -625,42 +625,42 @@ describe "Chef::Provider::Package - Multi" do
end
it "raises an exception if one is not installed and no candidates are available" do
- current_resource.version(['1.0', nil])
- provider.candidate_version = ['1.0', nil]
+ current_resource.version(["1.0", nil])
+ provider.candidate_version = ["1.0", nil]
expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
end
it "does not raise an exception if the packages are installed or have a candidate" do
- current_resource.version(['1.0', nil])
- provider.candidate_version = [nil, '6.2']
+ current_resource.version(["1.0", nil])
+ provider.candidate_version = [nil, "6.2"]
expect { provider.run_action(:install) }.not_to raise_error
end
it "raises an exception if an explicit version is asked for, an old version is installed, but no candidate" do
- new_resource.version ['1.0', '6.2']
- current_resource.version(['1.0', '6.1'])
- provider.candidate_version = ['1.0', nil]
+ new_resource.version ["1.0", "6.2"]
+ current_resource.version(["1.0", "6.1"])
+ provider.candidate_version = ["1.0", nil]
expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
end
it "does not raise an exception if an explicit version is asked for, and is installed, but no candidate" do
- new_resource.version ['1.0', '6.2']
- current_resource.version(['1.0', '6.2'])
- provider.candidate_version = ['1.0', nil]
+ new_resource.version ["1.0", "6.2"]
+ current_resource.version(["1.0", "6.2"])
+ provider.candidate_version = ["1.0", nil]
expect { provider.run_action(:install) }.not_to raise_error
end
it "raise an exception if an explicit version is asked for, and is not installed, and no candidate" do
- new_resource.version ['1.0', '6.2']
- current_resource.version(['1.0', nil])
- provider.candidate_version = ['1.0', nil]
+ new_resource.version ["1.0", "6.2"]
+ current_resource.version(["1.0", nil])
+ provider.candidate_version = ["1.0", nil]
expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
end
it "does not raise an exception if an explicit version is asked for, and is not installed, and there is a candidate" do
- new_resource.version ['1.0', '6.2']
- current_resource.version(['1.0', nil])
- provider.candidate_version = ['1.0', '6.2']
+ new_resource.version ["1.0", "6.2"]
+ current_resource.version(["1.0", nil])
+ provider.candidate_version = ["1.0", "6.2"]
expect { provider.run_action(:install) }.not_to raise_error
end
end
@@ -672,7 +672,7 @@ describe "Chef::Provider::Package - Multi" do
end
it "should upgrade the package if the current versions are not the candidate version" do
- current_resource.version ['0.9', '6.1']
+ current_resource.version ["0.9", "6.1"]
expect(provider).to receive(:upgrade_package).with(
new_resource.package_name,
provider.candidate_version,
@@ -682,7 +682,7 @@ describe "Chef::Provider::Package - Multi" do
end
it "should upgrade the package if some of current versions are not the candidate versions" do
- current_resource.version ['1.0', '6.1']
+ current_resource.version ["1.0", "6.1"]
expect(provider).to receive(:upgrade_package).with(
["vi"],
["6.2"],
@@ -692,7 +692,7 @@ describe "Chef::Provider::Package - Multi" do
end
it "should not install the package if the current versions are the candidate version" do
- current_resource.version ['1.0', '6.2']
+ current_resource.version ["1.0", "6.2"]
expect(provider).not_to receive(:upgrade_package)
provider.run_action(:upgrade)
expect(new_resource).not_to be_updated_by_last_action
@@ -705,20 +705,20 @@ describe "Chef::Provider::Package - Multi" do
end
it "should raise an exception if one is not installed and no candidates are available" do
- current_resource.version(['1.0', nil])
- provider.candidate_version = ['1.0', nil]
+ current_resource.version(["1.0", nil])
+ provider.candidate_version = ["1.0", nil]
expect { provider.run_action(:upgrade) }.to raise_error(Chef::Exceptions::Package)
end
it "should not raise an exception if the packages are installed or have a candidate" do
- current_resource.version(['1.0', nil])
- provider.candidate_version = [nil, '6.2']
+ current_resource.version(["1.0", nil])
+ provider.candidate_version = [nil, "6.2"]
expect { provider.run_action(:upgrade) }.not_to raise_error
end
it "should not raise an exception if the packages are installed or have a candidate" do
- current_resource.version(['1.0', nil])
- provider.candidate_version = [nil, '6.2']
+ current_resource.version(["1.0", nil])
+ provider.candidate_version = [nil, "6.2"]
expect { provider.run_action(:upgrade) }.not_to raise_error
end
end
@@ -726,44 +726,44 @@ describe "Chef::Provider::Package - Multi" do
describe "When removing multiple packages " do
before(:each) do
allow(provider).to receive(:remove_package).and_return(true)
- current_resource.version ['1.0', '6.2']
+ current_resource.version ["1.0", "6.2"]
end
it "should remove the packages if all are installed" do
expect(provider).to be_removing_package
- expect(provider).to receive(:remove_package).with(['emacs', 'vi'], nil)
+ expect(provider).to receive(:remove_package).with(["emacs", "vi"], nil)
provider.run_action(:remove)
expect(new_resource).to be_updated
expect(new_resource).to be_updated_by_last_action
end
it "should remove the packages if some are installed" do
- current_resource.version ['1.0', nil]
+ current_resource.version ["1.0", nil]
expect(provider).to be_removing_package
- expect(provider).to receive(:remove_package).with(['emacs', 'vi'], nil)
+ expect(provider).to receive(:remove_package).with(["emacs", "vi"], nil)
provider.run_action(:remove)
expect(new_resource).to be_updated
expect(new_resource).to be_updated_by_last_action
end
it "should remove the packages at a specific version if they are installed at that version" do
- new_resource.version ['1.0', '6.2']
+ new_resource.version ["1.0", "6.2"]
expect(provider).to be_removing_package
- expect(provider).to receive(:remove_package).with(['emacs', 'vi'], ['1.0', '6.2'])
+ expect(provider).to receive(:remove_package).with(["emacs", "vi"], ["1.0", "6.2"])
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
it "should remove the packages at a specific version any are is installed at that version" do
- new_resource.version ['0.5', '6.2']
+ new_resource.version ["0.5", "6.2"]
expect(provider).to be_removing_package
- expect(provider).to receive(:remove_package).with(['emacs', 'vi'], ['0.5', '6.2'])
+ expect(provider).to receive(:remove_package).with(["emacs", "vi"], ["0.5", "6.2"])
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
it "should not remove the packages at a specific version if they are not installed at that version" do
- new_resource.version ['0.5', '6.0']
+ new_resource.version ["0.5", "6.0"]
expect(provider).not_to be_removing_package
expect(provider).not_to receive(:remove_package)
provider.run_action(:remove)
@@ -782,44 +782,44 @@ describe "Chef::Provider::Package - Multi" do
describe "When purging multiple packages " do
before(:each) do
allow(provider).to receive(:purge_package).and_return(true)
- current_resource.version ['1.0', '6.2']
+ current_resource.version ["1.0", "6.2"]
end
it "should purge the packages if all are installed" do
expect(provider).to be_removing_package
- expect(provider).to receive(:purge_package).with(['emacs', 'vi'], nil)
+ expect(provider).to receive(:purge_package).with(["emacs", "vi"], nil)
provider.run_action(:purge)
expect(new_resource).to be_updated
expect(new_resource).to be_updated_by_last_action
end
it "should purge the packages if some are installed" do
- current_resource.version ['1.0', nil]
+ current_resource.version ["1.0", nil]
expect(provider).to be_removing_package
- expect(provider).to receive(:purge_package).with(['emacs', 'vi'], nil)
+ expect(provider).to receive(:purge_package).with(["emacs", "vi"], nil)
provider.run_action(:purge)
expect(new_resource).to be_updated
expect(new_resource).to be_updated_by_last_action
end
it "should purge the packages at a specific version if they are installed at that version" do
- new_resource.version ['1.0', '6.2']
+ new_resource.version ["1.0", "6.2"]
expect(provider).to be_removing_package
- expect(provider).to receive(:purge_package).with(['emacs', 'vi'], ['1.0', '6.2'])
+ expect(provider).to receive(:purge_package).with(["emacs", "vi"], ["1.0", "6.2"])
provider.run_action(:purge)
expect(new_resource).to be_updated_by_last_action
end
it "should purge the packages at a specific version any are is installed at that version" do
- new_resource.version ['0.5', '6.2']
+ new_resource.version ["0.5", "6.2"]
expect(provider).to be_removing_package
- expect(provider).to receive(:purge_package).with(['emacs', 'vi'], ['0.5', '6.2'])
+ expect(provider).to receive(:purge_package).with(["emacs", "vi"], ["0.5", "6.2"])
provider.run_action(:purge)
expect(new_resource).to be_updated_by_last_action
end
it "should not purge the packages at a specific version if they are not installed at that version" do
- new_resource.version ['0.5', '6.0']
+ new_resource.version ["0.5", "6.0"]
expect(provider).not_to be_removing_package
expect(provider).not_to receive(:purge_package)
provider.run_action(:purge)
diff --git a/spec/unit/provider/powershell_script_spec.rb b/spec/unit/provider/powershell_script_spec.rb
index 121973763d..c4a712d69a 100644
--- a/spec/unit/provider/powershell_script_spec.rb
+++ b/spec/unit/provider/powershell_script_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::PowershellScript, "action_run" do
let(:powershell_version) { nil }
@@ -33,12 +33,12 @@ describe Chef::Provider::PowershellScript, "action_run" do
let(:provider) {
empty_events = Chef::EventDispatch::Dispatcher.new
run_context = Chef::RunContext.new(node, {}, empty_events)
- new_resource = Chef::Resource::PowershellScript.new('run some powershell code', run_context)
+ new_resource = Chef::Resource::PowershellScript.new("run some powershell code", run_context)
Chef::Provider::PowershellScript.new(new_resource, run_context)
}
- context 'when setting interpreter flags' do
- context 'on nano' do
+ context "when setting interpreter flags" do
+ context "on nano" do
before(:each) do
allow(Chef::Platform).to receive(:windows_nano_server?).and_return(true)
allow(provider).to receive(:is_forced_32bit).and_return(false)
@@ -48,12 +48,12 @@ describe Chef::Provider::PowershellScript, "action_run" do
end
it "sets the -Command flag as the last flag" do
- flags = provider.command.split(' ').keep_if { |flag| flag =~ /^-/ }
+ flags = provider.command.split(" ").keep_if { |flag| flag =~ /^-/ }
expect(flags.pop).to eq("-Command")
end
end
- context 'not on nano' do
+ context "not on nano" do
before(:each) do
allow(Chef::Platform).to receive(:windows_nano_server?).and_return(false)
allow(provider).to receive(:is_forced_32bit).and_return(false)
@@ -63,36 +63,36 @@ describe Chef::Provider::PowershellScript, "action_run" do
end
it "sets the -File flag as the last flag" do
- flags = provider.command.split(' ').keep_if { |flag| flag =~ /^-/ }
+ flags = provider.command.split(" ").keep_if { |flag| flag =~ /^-/ }
expect(flags.pop).to eq("-File")
end
let(:execution_policy_flag) do
execution_policy_index = 0
- provider_flags = provider.flags.split(' ')
+ provider_flags = provider.flags.split(" ")
execution_policy_specified = false
provider_flags.find do | value |
execution_policy_index += 1
- execution_policy_specified = value.downcase == '-ExecutionPolicy'.downcase
+ execution_policy_specified = value.downcase == "-ExecutionPolicy".downcase
end
execution_policy = execution_policy_specified ? provider_flags[execution_policy_index] : nil
end
- context 'when running with an unspecified PowerShell version' do
+ context "when running with an unspecified PowerShell version" do
let(:powershell_version) { nil }
it "sets the -ExecutionPolicy flag to 'Unrestricted' by default" do
- expect(execution_policy_flag.downcase).to eq('unrestricted'.downcase)
+ expect(execution_policy_flag.downcase).to eq("unrestricted".downcase)
end
end
- { '2.0' => 'Unrestricted',
- '2.5' => 'Unrestricted',
- '3.0' => 'Bypass',
- '3.6' => 'Bypass',
- '4.0' => 'Bypass',
- '5.0' => 'Bypass' }.each do | version_policy |
+ { "2.0" => "Unrestricted",
+ "2.5" => "Unrestricted",
+ "3.0" => "Bypass",
+ "3.6" => "Bypass",
+ "4.0" => "Bypass",
+ "5.0" => "Bypass" }.each do | version_policy |
let(:powershell_version) { version_policy[0].to_f }
context "when running PowerShell version #{version_policy[0]}" do
let(:powershell_version) { version_policy[0].to_f }
diff --git a/spec/unit/provider/registry_key_spec.rb b/spec/unit/provider/registry_key_spec.rb
index 47543ffe39..ef03ec4012 100644
--- a/spec/unit/provider/registry_key_spec.rb
+++ b/spec/unit/provider/registry_key_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
shared_examples_for "a registry key" do
before(:each) do
diff --git a/spec/unit/provider/remote_directory_spec.rb b/spec/unit/provider/remote_directory_spec.rb
index 6426dafd79..0103169e84 100644
--- a/spec/unit/provider/remote_directory_spec.rb
+++ b/spec/unit/provider/remote_directory_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'digest/md5'
-require 'tmpdir'
-require 'chef/mixin/file_class'
+require "spec_helper"
+require "digest/md5"
+require "tmpdir"
+require "chef/mixin/file_class"
class Chef::CFCCheck
include Chef::Mixin::FileClass
@@ -32,7 +32,7 @@ describe Chef::Provider::RemoteDirectory do
@resource = Chef::Resource::RemoteDirectory.new(File.join(Dir.tmpdir, "tafty"))
# in CHEF_SPEC_DATA/cookbooks/openldap/files/default/remotedir
@resource.source "remotedir"
- @resource.cookbook('openldap')
+ @resource.cookbook("openldap")
@cookbook_repo = ::File.expand_path(::File.join(CHEF_SPEC_DATA, "cookbooks"))
Chef::Cookbook::FileVendor.fetch_from_disk(@cookbook_repo)
@@ -121,12 +121,12 @@ describe Chef::Provider::RemoteDirectory do
it "transfers the directory with all contents" do
@provider.run_action(:create)
- expect(::File.exist?(@destination_dir + '/remote_dir_file1.txt')).to be_truthy
- expect(::File.exist?(@destination_dir + '/remote_dir_file2.txt')).to be_truthy
- expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')).to be_truthy
- expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file2.txt')).to be_truthy
- expect(::File.exist?(@destination_dir + '/remotesubdir/.a_dotfile')).to be_truthy
- expect(::File.exist?(@destination_dir + '/.a_dotdir/.a_dotfile_in_a_dotdir')).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remote_dir_file1.txt")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remote_dir_file2.txt")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remotesubdir/remote_subdir_file1.txt")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remotesubdir/remote_subdir_file2.txt")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remotesubdir/.a_dotfile")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/.a_dotdir/.a_dotfile_in_a_dotdir")).to be_truthy
end
describe "only if it is missing" do
@@ -134,15 +134,15 @@ describe Chef::Provider::RemoteDirectory do
@resource.overwrite(true)
@provider.run_action(:create)
- File.open(@destination_dir + '/remote_dir_file1.txt', 'a') {|f| f.puts "blah blah blah" }
- File.open(@destination_dir + '/remotesubdir/remote_subdir_file1.txt', 'a') {|f| f.puts "blah blah blah" }
- file1md5 = Digest::MD5.hexdigest(File.read(@destination_dir + '/remote_dir_file1.txt'))
- subdirfile1md5 = Digest::MD5.hexdigest(File.read(@destination_dir + '/remotesubdir/remote_subdir_file1.txt'))
+ File.open(@destination_dir + "/remote_dir_file1.txt", "a") {|f| f.puts "blah blah blah" }
+ File.open(@destination_dir + "/remotesubdir/remote_subdir_file1.txt", "a") {|f| f.puts "blah blah blah" }
+ file1md5 = Digest::MD5.hexdigest(File.read(@destination_dir + "/remote_dir_file1.txt"))
+ subdirfile1md5 = Digest::MD5.hexdigest(File.read(@destination_dir + "/remotesubdir/remote_subdir_file1.txt"))
@provider.run_action(:create_if_missing)
- expect(file1md5.eql?(Digest::MD5.hexdigest(File.read(@destination_dir + '/remote_dir_file1.txt')))).to be_truthy
- expect(subdirfile1md5.eql?(Digest::MD5.hexdigest(File.read(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')))).to be_truthy
+ expect(file1md5.eql?(Digest::MD5.hexdigest(File.read(@destination_dir + "/remote_dir_file1.txt")))).to be_truthy
+ expect(subdirfile1md5.eql?(Digest::MD5.hexdigest(File.read(@destination_dir + "/remotesubdir/remote_subdir_file1.txt")))).to be_truthy
end
end
@@ -151,35 +151,35 @@ describe Chef::Provider::RemoteDirectory do
it "removes existing files if purge is true" do
@provider.run_action(:create)
- FileUtils.touch(@destination_dir + '/marked_for_death.txt')
- FileUtils.touch(@destination_dir + '/remotesubdir/marked_for_death_again.txt')
+ FileUtils.touch(@destination_dir + "/marked_for_death.txt")
+ FileUtils.touch(@destination_dir + "/remotesubdir/marked_for_death_again.txt")
@provider.run_action(:create)
- expect(::File.exist?(@destination_dir + '/remote_dir_file1.txt')).to be_truthy
- expect(::File.exist?(@destination_dir + '/remote_dir_file2.txt')).to be_truthy
- expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')).to be_truthy
- expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file2.txt')).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remote_dir_file1.txt")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remote_dir_file2.txt")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remotesubdir/remote_subdir_file1.txt")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remotesubdir/remote_subdir_file2.txt")).to be_truthy
- expect(::File.exist?(@destination_dir + '/marked_for_death.txt')).to be_falsey
- expect(::File.exist?(@destination_dir + '/remotesubdir/marked_for_death_again.txt')).to be_falsey
+ expect(::File.exist?(@destination_dir + "/marked_for_death.txt")).to be_falsey
+ expect(::File.exist?(@destination_dir + "/remotesubdir/marked_for_death_again.txt")).to be_falsey
end
it "removes files in subdirectories before files above" do
@provider.run_action(:create)
- FileUtils.mkdir_p(@destination_dir + '/a/multiply/nested/directory/')
- FileUtils.touch(@destination_dir + '/a/foo.txt')
- FileUtils.touch(@destination_dir + '/a/multiply/bar.txt')
- FileUtils.touch(@destination_dir + '/a/multiply/nested/baz.txt')
- FileUtils.touch(@destination_dir + '/a/multiply/nested/directory/qux.txt')
+ FileUtils.mkdir_p(@destination_dir + "/a/multiply/nested/directory/")
+ FileUtils.touch(@destination_dir + "/a/foo.txt")
+ FileUtils.touch(@destination_dir + "/a/multiply/bar.txt")
+ FileUtils.touch(@destination_dir + "/a/multiply/nested/baz.txt")
+ FileUtils.touch(@destination_dir + "/a/multiply/nested/directory/qux.txt")
@provider.run_action(:create)
- expect(::File.exist?(@destination_dir + '/a/foo.txt')).to be_falsey
- expect(::File.exist?(@destination_dir + '/a/multiply/bar.txt')).to be_falsey
- expect(::File.exist?(@destination_dir + '/a/multiply/nested/baz.txt')).to be_falsey
- expect(::File.exist?(@destination_dir + '/a/multiply/nested/directory/qux.txt')).to be_falsey
+ expect(::File.exist?(@destination_dir + "/a/foo.txt")).to be_falsey
+ expect(::File.exist?(@destination_dir + "/a/multiply/bar.txt")).to be_falsey
+ expect(::File.exist?(@destination_dir + "/a/multiply/nested/baz.txt")).to be_falsey
+ expect(::File.exist?(@destination_dir + "/a/multiply/nested/directory/qux.txt")).to be_falsey
end
it "removes directory symlinks properly", :not_supported_on_win2k3 do
- symlinked_dir_path = @destination_dir + '/symlinked_dir'
+ symlinked_dir_path = @destination_dir + "/symlinked_dir"
@provider.action = :create
@provider.run_action
@@ -207,13 +207,13 @@ describe Chef::Provider::RemoteDirectory do
it "leaves modifications alone" do
@provider.run_action(:create)
- ::File.open(@destination_dir + '/remote_dir_file1.txt', 'a') {|f| f.puts "blah blah blah" }
- ::File.open(@destination_dir + '/remotesubdir/remote_subdir_file1.txt', 'a') {|f| f.puts "blah blah blah" }
- file1md5 = Digest::MD5.hexdigest(::File.read(@destination_dir + '/remote_dir_file1.txt'))
- subdirfile1md5 = Digest::MD5.hexdigest(::File.read(@destination_dir + '/remotesubdir/remote_subdir_file1.txt'))
+ ::File.open(@destination_dir + "/remote_dir_file1.txt", "a") {|f| f.puts "blah blah blah" }
+ ::File.open(@destination_dir + "/remotesubdir/remote_subdir_file1.txt", "a") {|f| f.puts "blah blah blah" }
+ file1md5 = Digest::MD5.hexdigest(::File.read(@destination_dir + "/remote_dir_file1.txt"))
+ subdirfile1md5 = Digest::MD5.hexdigest(::File.read(@destination_dir + "/remotesubdir/remote_subdir_file1.txt"))
@provider.run_action(:create)
- expect(file1md5.eql?(Digest::MD5.hexdigest(::File.read(@destination_dir + '/remote_dir_file1.txt')))).to be_truthy
- expect(subdirfile1md5.eql?(Digest::MD5.hexdigest(::File.read(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')))).to be_truthy
+ expect(file1md5.eql?(Digest::MD5.hexdigest(::File.read(@destination_dir + "/remote_dir_file1.txt")))).to be_truthy
+ expect(subdirfile1md5.eql?(Digest::MD5.hexdigest(::File.read(@destination_dir + "/remotesubdir/remote_subdir_file1.txt")))).to be_truthy
end
end
diff --git a/spec/unit/provider/remote_file/cache_control_data_spec.rb b/spec/unit/provider/remote_file/cache_control_data_spec.rb
index c154c4228e..a0c200bc79 100644
--- a/spec/unit/provider/remote_file/cache_control_data_spec.rb
+++ b/spec/unit/provider/remote_file/cache_control_data_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'uri'
+require "spec_helper"
+require "uri"
CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH = 64
CACHE_FILE_CHECKSUM_HEX_LENGTH = 32
@@ -136,7 +136,7 @@ describe Chef::Provider::RemoteFile::CacheControlData do
end
context "and it still is valid JSON" do
- let(:cache_json_data) { '' }
+ let(:cache_json_data) { "" }
it "returns empty cache control data" do
expect(cache_control_data.etag).to be_nil
@@ -214,16 +214,16 @@ describe Chef::Provider::RemoteFile::CacheControlData do
# local file system path limits resulting in exceptions from
# file system API's on both Windows and Unix systems.
context "and the URI results in a file cache path that exceeds #{CACHE_FILE_PATH_LIMIT} characters in length" do
- let(:long_remote_path) { "http://www.bing.com/" + ('0' * (CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH * 2 )) }
+ let(:long_remote_path) { "http://www.bing.com/" + ("0" * (CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH * 2 )) }
let(:uri) { URI.parse(long_remote_path) }
let(:truncated_remote_uri) { URI.parse(long_remote_path[0...CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH]) }
let(:truncated_file_cache_path) do
cache_control_data_truncated = Chef::Provider::RemoteFile::CacheControlData.load_and_validate(truncated_remote_uri, current_file_checksum)
- cache_control_data_truncated.send('sanitized_cache_file_basename')[0...CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH]
+ cache_control_data_truncated.send("sanitized_cache_file_basename")[0...CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH]
end
it "truncates the file cache path to 102 characters" do
- normalized_cache_path = cache_control_data.send('sanitized_cache_file_basename')
+ normalized_cache_path = cache_control_data.send("sanitized_cache_file_basename")
expect(Chef::FileCache).to receive(:store).with("remote_file/" + normalized_cache_path, cache_control_data.json_data)
@@ -233,7 +233,7 @@ describe Chef::Provider::RemoteFile::CacheControlData do
end
it "uses a file cache path that starts with the first #{CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH} characters of the URI" do
- normalized_cache_path = cache_control_data.send('sanitized_cache_file_basename')
+ normalized_cache_path = cache_control_data.send("sanitized_cache_file_basename")
expect(truncated_file_cache_path.length).to eq(CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH)
expect(normalized_cache_path.start_with?(truncated_file_cache_path)).to eq(true)
diff --git a/spec/unit/provider/remote_file/content_spec.rb b/spec/unit/provider/remote_file/content_spec.rb
index 2639c39faa..c1e827887a 100644
--- a/spec/unit/provider/remote_file/content_spec.rb
+++ b/spec/unit/provider/remote_file/content_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::RemoteFile::Content do
diff --git a/spec/unit/provider/remote_file/fetcher_spec.rb b/spec/unit/provider/remote_file/fetcher_spec.rb
index 8bd3b7c625..10742bc671 100644
--- a/spec/unit/provider/remote_file/fetcher_spec.rb
+++ b/spec/unit/provider/remote_file/fetcher_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::RemoteFile::Fetcher do
diff --git a/spec/unit/provider/remote_file/ftp_spec.rb b/spec/unit/provider/remote_file/ftp_spec.rb
index dbbddd8e84..4292a744a5 100644
--- a/spec/unit/provider/remote_file/ftp_spec.rb
+++ b/spec/unit/provider/remote_file/ftp_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::RemoteFile::FTP do
let(:enclosing_directory) {
diff --git a/spec/unit/provider/remote_file/http_spec.rb b/spec/unit/provider/remote_file/http_spec.rb
index d9cfaa15eb..a08e65add3 100644
--- a/spec/unit/provider/remote_file/http_spec.rb
+++ b/spec/unit/provider/remote_file/http_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::RemoteFile::HTTP do
diff --git a/spec/unit/provider/remote_file/local_file_spec.rb b/spec/unit/provider/remote_file/local_file_spec.rb
index 575996a540..791d411e03 100644
--- a/spec/unit/provider/remote_file/local_file_spec.rb
+++ b/spec/unit/provider/remote_file/local_file_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::RemoteFile::LocalFile do
diff --git a/spec/unit/provider/remote_file/network_file_spec.rb b/spec/unit/provider/remote_file/network_file_spec.rb
index 3666a47468..38e0acd13f 100644
--- a/spec/unit/provider/remote_file/network_file_spec.rb
+++ b/spec/unit/provider/remote_file/network_file_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::RemoteFile::NetworkFile do
diff --git a/spec/unit/provider/remote_file_spec.rb b/spec/unit/provider/remote_file_spec.rb
index de4a897847..d6381905e9 100644
--- a/spec/unit/provider/remote_file_spec.rb
+++ b/spec/unit/provider/remote_file_spec.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'support/shared/unit/provider/file'
+require "support/shared/unit/provider/file"
describe Chef::Provider::RemoteFile do
@@ -32,12 +32,12 @@ describe Chef::Provider::RemoteFile do
end
let(:content) do
- content = double('Chef::Provider::File::Content::RemoteFile')
+ content = double("Chef::Provider::File::Content::RemoteFile")
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(: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(:enclosing_directory) {
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
}
diff --git a/spec/unit/provider/route_spec.rb b/spec/unit/provider/route_spec.rb
index ff68eea895..0205df430c 100644
--- a/spec/unit/provider/route_spec.rb
+++ b/spec/unit/provider/route_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Route do
before do
@@ -25,9 +25,9 @@ describe Chef::Provider::Route do
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, @cookbook_collection, @events)
- @new_resource = Chef::Resource::Route.new('10.0.0.10')
+ @new_resource = Chef::Resource::Route.new("10.0.0.10")
@new_resource.gateway "10.0.0.9"
- @current_resource = Chef::Resource::Route.new('10.0.0.10')
+ @current_resource = Chef::Resource::Route.new("10.0.0.10")
@current_resource.gateway "10.0.0.9"
@provider = Chef::Provider::Route.new(@new_resource, @run_context)
@@ -36,14 +36,14 @@ describe Chef::Provider::Route do
describe Chef::Provider::Route, "hex2ip" do
it "should return nil if ip address is invalid" do
- expect(@provider.hex2ip('foo')).to be_nil # does not even look like an ip
- expect(@provider.hex2ip('ABCDEFGH')).to be_nil # 8 chars, but invalid
+ expect(@provider.hex2ip("foo")).to be_nil # does not even look like an ip
+ expect(@provider.hex2ip("ABCDEFGH")).to be_nil # 8 chars, but invalid
end
it "should return quad-dotted notation for a valid IP" do
- expect(@provider.hex2ip('01234567')).to eq('103.69.35.1')
- expect(@provider.hex2ip('0064a8c0')).to eq('192.168.100.0')
- expect(@provider.hex2ip('00FFFFFF')).to eq('255.255.255.0')
+ expect(@provider.hex2ip("01234567")).to eq("103.69.35.1")
+ expect(@provider.hex2ip("0064a8c0")).to eq("192.168.100.0")
+ expect(@provider.hex2ip("00FFFFFF")).to eq("255.255.255.0")
end
end
@@ -51,7 +51,7 @@ describe Chef::Provider::Route do
describe Chef::Provider::Route, "load_current_resource" do
context "on linux" do
before do
- @node.automatic_attrs[:os] = 'linux'
+ @node.automatic_attrs[:os] = "linux"
routing_table = "Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT\n" +
"eth0 0064A8C0 0984A8C0 0003 0 0 0 00FFFFFF 0 0 0\n"
route_file = StringIO.new(routing_table)
@@ -59,7 +59,7 @@ describe Chef::Provider::Route do
end
it "should set is_running to false when a route is not detected" do
- resource = Chef::Resource::Route.new('10.10.10.0/24')
+ resource = Chef::Resource::Route.new("10.10.10.0/24")
allow(resource).to receive(:gateway).and_return("10.0.0.1")
allow(resource).to receive(:device).and_return("eth0")
provider = Chef::Provider::Route.new(resource, @run_context)
@@ -69,7 +69,7 @@ describe Chef::Provider::Route do
end
it "should detect existing routes and set is_running attribute correctly" do
- resource = Chef::Resource::Route.new('192.168.100.0/24')
+ resource = Chef::Resource::Route.new("192.168.100.0/24")
allow(resource).to receive(:gateway).and_return("192.168.132.9")
allow(resource).to receive(:device).and_return("eth0")
provider = Chef::Provider::Route.new(resource, @run_context)
@@ -79,7 +79,7 @@ describe Chef::Provider::Route do
end
it "should use gateway value when matching routes" do
- resource = Chef::Resource::Route.new('192.168.100.0/24')
+ resource = Chef::Resource::Route.new("192.168.100.0/24")
allow(resource).to receive(:gateway).and_return("10.10.10.10")
allow(resource).to receive(:device).and_return("eth0")
provider = Chef::Provider::Route.new(resource, @run_context)
@@ -110,11 +110,11 @@ describe Chef::Provider::Route do
end
it "should not delete config file for :add action (CHEF-3332)" do
- @node.automatic_attrs[:platform] = 'centos'
+ @node.automatic_attrs[:platform] = "centos"
route_file = StringIO.new
expect(File).to receive(:new).and_return(route_file)
- @resource_add = Chef::Resource::Route.new('192.168.1.0/24 via 192.168.0.1')
+ @resource_add = Chef::Resource::Route.new("192.168.1.0/24 via 192.168.0.1")
@run_context.resource_collection << @resource_add
allow(@provider).to receive(:run_command).and_return(true)
@@ -145,7 +145,7 @@ describe Chef::Provider::Route do
describe Chef::Provider::Route, "generate_command for action_add" do
it "should include a netmask when a one is specified" do
- allow(@new_resource).to receive(:netmask).and_return('255.255.0.0')
+ allow(@new_resource).to receive(:netmask).and_return("255.255.0.0")
expect(@provider.generate_command(:add)).to match(/\/\d{1,2}\s/)
end
@@ -166,7 +166,7 @@ describe Chef::Provider::Route do
describe Chef::Provider::Route, "generate_command for action_delete" do
it "should include a netmask when a one is specified" do
- allow(@new_resource).to receive(:netmask).and_return('255.255.0.0')
+ allow(@new_resource).to receive(:netmask).and_return("255.255.0.0")
expect(@provider.generate_command(:delete)).to match(/\/\d{1,2}\s/)
end
@@ -187,7 +187,7 @@ describe Chef::Provider::Route do
describe Chef::Provider::Route, "config_file_contents for action_add" do
it "should include a netmask when a one is specified" do
- allow(@new_resource).to receive(:netmask).and_return('255.255.0.0')
+ allow(@new_resource).to receive(:netmask).and_return("255.255.0.0")
expect(@provider.config_file_contents(:add, { :target => @new_resource.target, :netmask => @new_resource.netmask})).to match(/\/\d{1,2}.*\n$/)
end
@@ -224,13 +224,13 @@ describe Chef::Provider::Route do
end
it "should put all routes for a device in a route config file" do
- @node.automatic_attrs[:platform] = 'centos'
+ @node.automatic_attrs[:platform] = "centos"
route_file = StringIO.new
expect(File).to receive(:new).and_return(route_file)
- @run_context.resource_collection << Chef::Resource::Route.new('192.168.1.0/24 via 192.168.0.1')
- @run_context.resource_collection << Chef::Resource::Route.new('192.168.2.0/24 via 192.168.0.1')
- @run_context.resource_collection << Chef::Resource::Route.new('192.168.3.0/24 via 192.168.0.1')
+ @run_context.resource_collection << Chef::Resource::Route.new("192.168.1.0/24 via 192.168.0.1")
+ @run_context.resource_collection << Chef::Resource::Route.new("192.168.2.0/24 via 192.168.0.1")
+ @run_context.resource_collection << Chef::Resource::Route.new("192.168.3.0/24 via 192.168.0.1")
@provider.action = :add
@provider.generate_config
diff --git a/spec/unit/provider/ruby_block_spec.rb b/spec/unit/provider/ruby_block_spec.rb
index 266c943367..c306d0ae9c 100644
--- a/spec/unit/provider/ruby_block_spec.rb
+++ b/spec/unit/provider/ruby_block_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::RubyBlock, "initialize" do
before(:each) do
diff --git a/spec/unit/provider/script_spec.rb b/spec/unit/provider/script_spec.rb
index 7cc5abbd15..e488b0ef79 100644
--- a/spec/unit/provider/script_spec.rb
+++ b/spec/unit/provider/script_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Script, "action_run" do
let(:node) { Chef::Node.new }
@@ -26,9 +26,9 @@ describe Chef::Provider::Script, "action_run" do
let(:run_context) { Chef::RunContext.new(node, {}, events) }
let(:new_resource) {
- new_resource = Chef::Resource::Script.new('run some perl code')
+ new_resource = Chef::Resource::Script.new("run some perl code")
new_resource.code "$| = 1; print 'i like beans'"
- new_resource.interpreter 'perl'
+ new_resource.interpreter "perl"
new_resource
}
@@ -58,9 +58,9 @@ describe Chef::Provider::Script, "action_run" do
context "#set_owner_and_group" do
it "sets the owner and group for the script file" do
- new_resource.user 'toor'
- new_resource.group 'wheel'
- expect(FileUtils).to receive(:chown).with('toor', 'wheel', tempfile.path)
+ new_resource.user "toor"
+ new_resource.group "wheel"
+ expect(FileUtils).to receive(:chown).with("toor", "wheel", tempfile.path)
provider.set_owner_and_group
end
end
@@ -99,13 +99,13 @@ describe Chef::Provider::Script, "action_run" do
expect(provider.command).to eq(%Q{"perl" "#{tempfile.path}"})
end
- it 'should call shell_out! with the command' do
+ it "should call shell_out! with the command" do
expect(provider).to receive(:shell_out!).with(provider.command, default_opts).and_return(true)
provider.action_run
end
it "should set the command to 'interpreter flags tempfile'" do
- new_resource.flags '-f'
+ new_resource.flags "-f"
expect(provider.command).to eq(%Q{"perl" -f "#{tempfile.path}"})
end
end
diff --git a/spec/unit/provider/service/aix_service_spec.rb b/spec/unit/provider/service/aix_service_spec.rb
index 5cca7d6f0a..abfc19d94f 100644
--- a/spec/unit/provider/service/aix_service_spec.rb
+++ b/spec/unit/provider/service/aix_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Aix do
before(:each) do
@@ -133,7 +133,7 @@ describe Chef::Provider::Service::Aix do
end
it "should call the start command for groups" do
- @provider.instance_eval('@is_resource_group = true')
+ @provider.instance_eval("@is_resource_group = true")
expect(@provider).to receive(:shell_out!).with("startsrc -g #{@new_resource.service_name}")
@provider.start_service
@@ -152,7 +152,7 @@ describe Chef::Provider::Service::Aix do
end
it "should call the stop command for groups" do
- @provider.instance_eval('@is_resource_group = true')
+ @provider.instance_eval("@is_resource_group = true")
expect(@provider).to receive(:shell_out!).with("stopsrc -g #{@new_resource.service_name}")
@provider.stop_service
@@ -171,7 +171,7 @@ describe Chef::Provider::Service::Aix do
end
it "should call the reload command for groups" do
- @provider.instance_eval('@is_resource_group = true')
+ @provider.instance_eval("@is_resource_group = true")
expect(@provider).to receive(:shell_out!).with("refresh -g #{@new_resource.service_name}")
@provider.reload_service
diff --git a/spec/unit/provider/service/aixinit_service_spec.rb b/spec/unit/provider/service/aixinit_service_spec.rb
index 9977343daa..9274c3001b 100644
--- a/spec/unit/provider/service/aixinit_service_spec.rb
+++ b/spec/unit/provider/service/aixinit_service_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::AixInit do
before(:each) do
@node = Chef::Node.new
- @node.automatic_attrs[:command] = {:ps => 'fuuuu'}
+ @node.automatic_attrs[:command] = {:ps => "fuuuu"}
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
@@ -102,7 +102,7 @@ describe Chef::Provider::Service::AixInit do
context "when the service doesn't set a priority" do
it "creates symlink with status S" do
- expect(@provider).to receive(:create_symlink).with(2,'S','')
+ expect(@provider).to receive(:create_symlink).with(2,"S","")
@provider.enable_service
end
@@ -114,7 +114,7 @@ describe Chef::Provider::Service::AixInit do
end
it "creates a symlink with status S and a priority" do
- expect(@provider).to receive(:create_symlink).with(2,'S',75)
+ expect(@provider).to receive(:create_symlink).with(2,"S",75)
@provider.enable_service
end
@@ -127,8 +127,8 @@ describe Chef::Provider::Service::AixInit do
end
it "create symlink with status start (S) or stop (K) and a priority " do
- expect(@provider).to receive(:create_symlink).with(2,'S',20)
- expect(@provider).to receive(:create_symlink).with(3,'K',10)
+ expect(@provider).to receive(:create_symlink).with(2,"S",20)
+ expect(@provider).to receive(:create_symlink).with(3,"K",10)
@provider.enable_service
end
@@ -142,7 +142,7 @@ describe Chef::Provider::Service::AixInit do
context "when the service doesn't set a priority" do
it "creates symlinks with status stop (K)" do
- expect(@provider).to receive(:create_symlink).with(2,'K','')
+ expect(@provider).to receive(:create_symlink).with(2,"K","")
@provider.disable_service
end
@@ -154,7 +154,7 @@ describe Chef::Provider::Service::AixInit do
end
it "create symlink with status stop (k) and a priority " do
- expect(@provider).to receive(:create_symlink).with(2,'K',25)
+ expect(@provider).to receive(:create_symlink).with(2,"K",25)
@provider.disable_service
end
@@ -167,7 +167,7 @@ describe Chef::Provider::Service::AixInit do
end
it "create symlink with status stop (k) and a priority " do
- expect(@provider).to receive(:create_symlink).with(3,'K',90)
+ expect(@provider).to receive(:create_symlink).with(3,"K",90)
@provider.disable_service
end
@@ -231,7 +231,7 @@ describe Chef::Provider::Service::AixInit do
it "the service is enabled" do
expect(@provider.current_resource).to receive(:enabled).with(true)
- expect(@provider.current_resource).to receive(:priority).with('')
+ expect(@provider.current_resource).to receive(:priority).with("")
@provider.set_current_resource_attributes
end
@@ -240,7 +240,7 @@ describe Chef::Provider::Service::AixInit do
context "when rc2.d contains only stop script (without priority)" do
before do
files = ["/etc/rc.d/rc2.d/Kapache"]
- @priority = {2 => [:stop, '']}
+ @priority = {2 => [:stop, ""]}
allow(Dir).to receive(:glob).with(["/etc/rc.d/rc2.d/[SK][0-9][0-9]#{@new_resource.service_name}", "/etc/rc.d/rc2.d/[SK]#{@new_resource.service_name}"]).and_return(files)
end
@@ -257,7 +257,7 @@ describe Chef::Provider::Service::AixInit do
files = ["/etc/rc.d/rc2.d/Sapache", "/etc/rc.d/rc2.d/Kapache"]
# FIXME: this is clearly buggy the duplicated keys do not work
#@priority = {2 => [:start, ''], 2 => [:stop, '']}
- @priority = {2 => [:stop, '']}
+ @priority = {2 => [:stop, ""]}
allow(Dir).to receive(:glob).with(["/etc/rc.d/rc2.d/[SK][0-9][0-9]#{@new_resource.service_name}", "/etc/rc.d/rc2.d/[SK]#{@new_resource.service_name}"]).and_return(files)
end
diff --git a/spec/unit/provider/service/arch_service_spec.rb b/spec/unit/provider/service/arch_service_spec.rb
index 49be0e274c..40f87b24bf 100644
--- a/spec/unit/provider/service/arch_service_spec.rb
+++ b/spec/unit/provider/service/arch_service_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
# most of this code has been ripped from init_service_spec.rb
# and is only slightly modified to match "arch" needs.
@@ -45,7 +45,7 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
it "should set the current resources service name to the new resources service name" do
allow(@provider).to receive(:shell_out).and_return(OpenStruct.new(:exitstatus => 0, :stdout => ""))
@provider.load_current_resource
- expect(@provider.current_resource.service_name).to eq('chef')
+ expect(@provider.current_resource.service_name).to eq("chef")
end
end
@@ -155,7 +155,7 @@ RUNNING_PS
it "should return existing entries in DAEMONS array" do
allow(::File).to receive(:read).with("/etc/rc.conf").and_return("DAEMONS=(network !apache ssh)")
- expect(@provider.daemons).to eq(['network', '!apache', 'ssh'])
+ expect(@provider.daemons).to eq(["network", "!apache", "ssh"])
end
context "when the current service status is known" do
@@ -180,7 +180,7 @@ RUNNING_PS
it "should add chef to DAEMONS array" do
allow(::File).to receive(:read).with("/etc/rc.conf").and_return("DAEMONS=(network)")
- expect(@provider).to receive(:update_daemons).with(['network', 'chef'])
+ expect(@provider).to receive(:update_daemons).with(["network", "chef"])
@provider.enable_service()
end
end
@@ -201,7 +201,7 @@ RUNNING_PS
it "should remove chef from DAEMONS array" do
allow(::File).to receive(:read).with("/etc/rc.conf").and_return("DAEMONS=(network chef)")
- expect(@provider).to receive(:update_daemons).with(['network', '!chef'])
+ expect(@provider).to receive(:update_daemons).with(["network", "!chef"])
@provider.disable_service()
end
end
diff --git a/spec/unit/provider/service/debian_service_spec.rb b/spec/unit/provider/service/debian_service_spec.rb
index 346e349db7..79c51d0ea7 100644
--- a/spec/unit/provider/service/debian_service_spec.rb
+++ b/spec/unit/provider/service/debian_service_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Debian do
before(:each) do
@node = Chef::Node.new
- @node.automatic_attrs[:command] = {:ps => 'fuuuu'}
+ @node.automatic_attrs[:command] = {:ps => "fuuuu"}
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
diff --git a/spec/unit/provider/service/freebsd_service_spec.rb b/spec/unit/provider/service/freebsd_service_spec.rb
index cfc28c94d5..5bfa8ff6c0 100644
--- a/spec/unit/provider/service/freebsd_service_spec.rb
+++ b/spec/unit/provider/service/freebsd_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class Chef::Provider::Service::Freebsd
public :service_enable_variable_name
diff --git a/spec/unit/provider/service/gentoo_service_spec.rb b/spec/unit/provider/service/gentoo_service_spec.rb
index b4155f9628..8bfac80002 100644
--- a/spec/unit/provider/service/gentoo_service_spec.rb
+++ b/spec/unit/provider/service/gentoo_service_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Gentoo do
before(:each) do
diff --git a/spec/unit/provider/service/init_service_spec.rb b/spec/unit/provider/service/init_service_spec.rb
index 827a4261e1..2594a732d9 100644
--- a/spec/unit/provider/service/init_service_spec.rb
+++ b/spec/unit/provider/service/init_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Init, "load_current_resource" do
before(:each) do
@@ -48,7 +48,7 @@ PS
it "should set the current resources service name to the new resources service name" do
@provider.load_current_resource
- expect(@current_resource.service_name).to eq('chef')
+ expect(@current_resource.service_name).to eq("chef")
end
describe "when the service supports status" do
diff --git a/spec/unit/provider/service/insserv_service_spec.rb b/spec/unit/provider/service/insserv_service_spec.rb
index 3799daebb4..fccbfac2b3 100644
--- a/spec/unit/provider/service/insserv_service_spec.rb
+++ b/spec/unit/provider/service/insserv_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Insserv do
before(:each) do
diff --git a/spec/unit/provider/service/invokercd_service_spec.rb b/spec/unit/provider/service/invokercd_service_spec.rb
index 81588c80e5..d8d860a291 100644
--- a/spec/unit/provider/service/invokercd_service_spec.rb
+++ b/spec/unit/provider/service/invokercd_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Invokercd, "load_current_resource" do
before(:each) do
@@ -48,7 +48,7 @@ PS
it "should set the current resources service name to the new resources service name" do
@provider.load_current_resource
- expect(@current_resource.service_name).to eq('chef')
+ expect(@current_resource.service_name).to eq("chef")
end
describe "when the service supports status" do
diff --git a/spec/unit/provider/service/macosx_spec.rb b/spec/unit/provider/service/macosx_spec.rb
index 54183bdc3d..c3204700d7 100644
--- a/spec/unit/provider/service/macosx_spec.rb
+++ b/spec/unit/provider/service/macosx_spec.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Macosx do
describe ".gather_plist_dirs" do
context "when HOME directory is set" do
before do
- allow(Chef::Util::PathHelper).to receive(:home).with('Library', 'LaunchAgents').and_yield('/Users/someuser/Library/LaunchAgents')
+ allow(Chef::Util::PathHelper).to receive(:home).with("Library", "LaunchAgents").and_yield("/Users/someuser/Library/LaunchAgents")
end
it "includes users's LaunchAgents folder" do
@@ -32,7 +32,7 @@ describe Chef::Provider::Service::Macosx do
context "when HOME directory is not set" do
before do
- allow(Chef::Util::PathHelper).to receive(:home).with('Library', 'LaunchAgents').and_return(nil)
+ allow(Chef::Util::PathHelper).to receive(:home).with("Library", "LaunchAgents").and_return(nil)
end
it "doesn't include user's LaunchAgents folder" do
@@ -61,20 +61,20 @@ XML
["Daemon", "Agent"].each do |service_type|
["redis-server", "io.redis.redis-server"].each do |service_name|
["10.9", "10.10", "10.11"].each do |platform_version|
- let(:plist) {'/Library/LaunchDaemons/io.redis.redis-server.plist'}
+ let(:plist) {"/Library/LaunchDaemons/io.redis.redis-server.plist"}
let(:session) { StringIO.new }
- if service_type == 'Agent'
- let(:plist) {'/Library/LaunchAgents/io.redis.redis-server.plist'}
- let(:session) {'-S Aqua '}
- let(:su_cmd) {'su -l igor -c'}
+ if service_type == "Agent"
+ let(:plist) {"/Library/LaunchAgents/io.redis.redis-server.plist"}
+ let(:session) {"-S Aqua "}
+ let(:su_cmd) {"su -l igor -c"}
if platform_version == "10.9"
- let(:su_cmd) {'su igor -c'}
+ let(:su_cmd) {"su igor -c"}
end
end
- let(:service_label) {'io.redis.redis-server'}
+ let(:service_label) {"io.redis.redis-server"}
before do
allow(Dir).to receive(:glob).and_return([plist], [])
- allow(Etc).to receive(:getlogin).and_return('igor')
+ allow(Etc).to receive(:getlogin).and_return("igor")
allow(node).to receive(:[]).with("platform_version").and_return(platform_version)
cmd = "launchctl list #{service_label}"
allow(provider).to receive(:shell_out_with_systems_locale).
@@ -263,7 +263,7 @@ SVC_LIST
end
it "starts service via launchctl if service found" do
- cmd = 'launchctl load -w ' + session + plist
+ cmd = "launchctl load -w " + session + plist
expect(provider).to receive(:shell_out_with_systems_locale).
with(/(#{su_cmd} .#{cmd}.|#{cmd})/).
and_return(0)
@@ -295,7 +295,7 @@ SVC_LIST
end
it "stops the service via launchctl if service found" do
- cmd = 'launchctl unload -w '+ plist
+ cmd = "launchctl unload -w "+ plist
expect(provider).to receive(:shell_out_with_systems_locale).
with(/(#{su_cmd} .#{cmd}.|#{cmd})/).
and_return(0)
diff --git a/spec/unit/provider/service/openbsd_service_spec.rb b/spec/unit/provider/service/openbsd_service_spec.rb
index 8118e9b3ee..c08a97e7b1 100644
--- a/spec/unit/provider/service/openbsd_service_spec.rb
+++ b/spec/unit/provider/service/openbsd_service_spec.rb
@@ -18,7 +18,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class Chef::Provider::Service::Openbsd
public :builtin_service_enable_variable_name
@@ -52,8 +52,8 @@ describe Chef::Provider::Service::Openbsd do
let(:provider) do
events = Chef::EventDispatch::Dispatcher.new
run_context = Chef::RunContext.new(node, {}, events)
- allow(::File).to receive(:read).with('/etc/rc.conf').and_return('')
- allow(::File).to receive(:read).with('/etc/rc.conf.local').and_return('')
+ allow(::File).to receive(:read).with("/etc/rc.conf").and_return("")
+ allow(::File).to receive(:read).with("/etc/rc.conf.local").and_return("")
provider = Chef::Provider::Service::Openbsd.new(new_resource,run_context)
provider.action = :start
provider
@@ -80,7 +80,7 @@ describe Chef::Provider::Service::Openbsd do
end
it "should set init_command to nil if it can't find anything" do
- expect(::File).to receive(:exist?).with('/etc/rc.d/sndiod').and_return(false)
+ expect(::File).to receive(:exist?).with("/etc/rc.d/sndiod").and_return(false)
expect(provider.init_command).to be nil
end
end
@@ -381,7 +381,7 @@ describe Chef::Provider::Service::Openbsd do
describe Chef::Provider::Service::Openbsd, "enable_service" do
before do
provider.current_resource = current_resource
- allow(FileUtils).to receive(:touch).with('/etc/rc.conf.local')
+ allow(FileUtils).to receive(:touch).with("/etc/rc.conf.local")
end
context "is builtin and disabled by default" do
before do
@@ -398,10 +398,10 @@ describe Chef::Provider::Service::Openbsd do
end
context "is disabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should enable the service by adding a line to rc.conf.local" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', include("#{provider.builtin_service_enable_variable_name}=\"\""))
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", include("#{provider.builtin_service_enable_variable_name}=\"\""))
expect(provider.is_enabled?).to be false
provider.enable_service
expect(provider.is_enabled?).to be true
@@ -414,7 +414,7 @@ describe Chef::Provider::Service::Openbsd do
end
context "is enabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should not change rc.conf.local since it is already enabled" do
expect(::File).not_to receive(:write)
@@ -426,7 +426,7 @@ describe Chef::Provider::Service::Openbsd do
provider.rc_conf_local = "#{provider.builtin_service_enable_variable_name}=NO"
end
it "should enable the service by removing a line from rc.conf.local" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', /^(?!#{provider.builtin_service_enable_variable_name})$/)
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", /^(?!#{provider.builtin_service_enable_variable_name})$/)
expect(provider.is_enabled?).to be false
provider.enable_service
expect(provider.is_enabled?).to be true
@@ -435,7 +435,7 @@ describe Chef::Provider::Service::Openbsd do
end
context "is not builtin" do
before do
- provider.rc_conf = ''
+ provider.rc_conf = ""
end
context "is enabled" do
before do
@@ -448,10 +448,10 @@ describe Chef::Provider::Service::Openbsd do
end
context "is disabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should enable the service by adding it to the pkg_scripts list" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', "\npkg_scripts=\"#{new_resource.service_name}\"\n")
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", "\npkg_scripts=\"#{new_resource.service_name}\"\n")
expect(provider.is_enabled?).to be false
provider.enable_service
expect(provider.is_enabled?).to be true
@@ -463,7 +463,7 @@ describe Chef::Provider::Service::Openbsd do
describe Chef::Provider::Service::Openbsd, "disable_service" do
before do
provider.current_resource = current_resource
- allow(FileUtils).to receive(:touch).with('/etc/rc.conf.local')
+ allow(FileUtils).to receive(:touch).with("/etc/rc.conf.local")
end
context "is builtin and disabled by default" do
before do
@@ -474,7 +474,7 @@ describe Chef::Provider::Service::Openbsd do
provider.rc_conf_local = "#{provider.builtin_service_enable_variable_name}=\"\""
end
it "should disable the service by removing its line from rc.conf.local" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', /^(?!#{provider.builtin_service_enable_variable_name})$/)
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", /^(?!#{provider.builtin_service_enable_variable_name})$/)
expect(provider.is_enabled?).to be true
provider.disable_service
expect(provider.is_enabled?).to be false
@@ -482,7 +482,7 @@ describe Chef::Provider::Service::Openbsd do
end
context "is disabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should not change rc.conf.local since it is already disabled" do
expect(::File).not_to receive(:write)
@@ -496,10 +496,10 @@ describe Chef::Provider::Service::Openbsd do
end
context "is enabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should disable the service by adding a line to rc.conf.local" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', include("#{provider.builtin_service_enable_variable_name}=\"NO\""))
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", include("#{provider.builtin_service_enable_variable_name}=\"NO\""))
expect(provider.is_enabled?).to be true
provider.disable_service
expect(provider.is_enabled?).to be false
@@ -517,14 +517,14 @@ describe Chef::Provider::Service::Openbsd do
end
context "is not builtin" do
before do
- provider.rc_conf = ''
+ provider.rc_conf = ""
end
context "is enabled" do
before do
provider.rc_conf_local = "pkg_scripts=\"#{new_resource.service_name}\"\n"
end
it "should disable the service by removing it from the pkg_scripts list" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', /^(?!#{new_resource.service_name})$/)
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", /^(?!#{new_resource.service_name})$/)
expect(provider.is_enabled?).to be true
provider.disable_service
expect(provider.is_enabled?).to be false
@@ -532,7 +532,7 @@ describe Chef::Provider::Service::Openbsd do
end
context "is disabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should not change rc.conf.local since it is already disabled" do
expect(::File).not_to receive(:write)
diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb
index 5aaf54d9f5..d79e179898 100644
--- a/spec/unit/provider/service/redhat_spec.rb
+++ b/spec/unit/provider/service/redhat_spec.rb
@@ -17,7 +17,7 @@
#
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "spec_helper"))
-require 'ostruct'
+require "ostruct"
shared_examples_for "define_resource_requirements_common" do
it "should raise an error if /sbin/chkconfig does not exist" do
@@ -44,7 +44,7 @@ describe "Chef::Provider::Service::Redhat" do
before(:each) do
@node = Chef::Node.new
- @node.automatic_attrs[:command] = {:ps => 'foo'}
+ @node.automatic_attrs[:command] = {:ps => "foo"}
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
diff --git a/spec/unit/provider/service/simple_service_spec.rb b/spec/unit/provider/service/simple_service_spec.rb
index 895c559dff..ef5fe55a49 100644
--- a/spec/unit/provider/service/simple_service_spec.rb
+++ b/spec/unit/provider/service/simple_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Simple, "load_current_resource" do
before(:each) do
diff --git a/spec/unit/provider/service/solaris_smf_service_spec.rb b/spec/unit/provider/service/solaris_smf_service_spec.rb
index 4ff3e89ae3..a5f54f0830 100644
--- a/spec/unit/provider/service/solaris_smf_service_spec.rb
+++ b/spec/unit/provider/service/solaris_smf_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Solaris do
before(:each) do
@@ -24,69 +24,69 @@ describe Chef::Provider::Service::Solaris do
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
- @new_resource = Chef::Resource::Service.new('chef')
+ @new_resource = Chef::Resource::Service.new("chef")
- @current_resource = Chef::Resource::Service.new('chef')
+ @current_resource = Chef::Resource::Service.new("chef")
@provider = Chef::Provider::Service::Solaris.new(@new_resource, @run_context)
allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
# enabled / started service (svcs -l chef)
enabled_svc_stdout = [
- 'fmri svc:/application/chef:default',
- 'name chef service',
- 'enabled true',
- 'state online',
- 'next_state none',
- 'state_time April 2, 2015 04:25:19 PM EDT',
- 'logfile /var/svc/log/application-chef:default.log',
- 'restarter svc:/system/svc/restarter:default',
- 'contract_id 1115271',
- 'dependency require_all/error svc:/milestone/multi-user:default (online)',
+ "fmri svc:/application/chef:default",
+ "name chef service",
+ "enabled true",
+ "state online",
+ "next_state none",
+ "state_time April 2, 2015 04:25:19 PM EDT",
+ "logfile /var/svc/log/application-chef:default.log",
+ "restarter svc:/system/svc/restarter:default",
+ "contract_id 1115271",
+ "dependency require_all/error svc:/milestone/multi-user:default (online)",
].join("\n")
# disabled / stopped service (svcs -l chef)
disabled_svc_stdout = [
- 'fmri svc:/application/chef:default',
- 'name chef service',
- 'enabled false',
- 'state disabled',
- 'next_state none',
- 'state_time April 2, 2015 04:25:19 PM EDT',
- 'logfile /var/svc/log/application-chef:default.log',
- 'restarter svc:/system/svc/restarter:default',
- 'contract_id 1115271',
- 'dependency require_all/error svc:/milestone/multi-user:default (online)',
+ "fmri svc:/application/chef:default",
+ "name chef service",
+ "enabled false",
+ "state disabled",
+ "next_state none",
+ "state_time April 2, 2015 04:25:19 PM EDT",
+ "logfile /var/svc/log/application-chef:default.log",
+ "restarter svc:/system/svc/restarter:default",
+ "contract_id 1115271",
+ "dependency require_all/error svc:/milestone/multi-user:default (online)",
].join("\n")
# disabled / stopped service (svcs -l chef)
maintenance_svc_stdout = [
- 'fmri svc:/application/chef:default',
- 'name chef service',
- 'enabled true',
- 'state maintenance',
- 'next_state none',
- 'state_time April 2, 2015 04:25:19 PM EDT',
- 'logfile /var/svc/log/application-chef:default.log',
- 'restarter svc:/system/svc/restarter:default',
- 'contract_id 1115271',
- 'dependency require_all/error svc:/milestone/multi-user:default (online)',
+ "fmri svc:/application/chef:default",
+ "name chef service",
+ "enabled true",
+ "state maintenance",
+ "next_state none",
+ "state_time April 2, 2015 04:25:19 PM EDT",
+ "logfile /var/svc/log/application-chef:default.log",
+ "restarter svc:/system/svc/restarter:default",
+ "contract_id 1115271",
+ "dependency require_all/error svc:/milestone/multi-user:default (online)",
].join("\n")
# shell_out! return value for a service that is running
- @enabled_svc_status = double("Status", :exitstatus => 0, :stdout => enabled_svc_stdout, :stdin => '', :stderr => '')
+ @enabled_svc_status = double("Status", :exitstatus => 0, :stdout => enabled_svc_stdout, :stdin => "", :stderr => "")
# shell_out! return value for a service that is disabled
- @disabled_svc_status = double("Status", :exitstatus => 0, :stdout => disabled_svc_stdout, :stdin => '', :stderr => '')
+ @disabled_svc_status = double("Status", :exitstatus => 0, :stdout => disabled_svc_stdout, :stdin => "", :stderr => "")
# shell_out! return value for a service that is in maintenance mode
- @maintenance_svc_status = double("Status", :exitstatus => 0, :stdout => maintenance_svc_stdout, :stdin => '', :stderr => '')
+ @maintenance_svc_status = double("Status", :exitstatus => 0, :stdout => maintenance_svc_stdout, :stdin => "", :stderr => "")
# shell_out! return value for a service that does not exist
- @no_svc_status = double("Status", :exitstatus => 1, :stdout => '', :stdin => '', :stderr => "svcs: Pattern 'chef' doesn't match any instances\n")
+ @no_svc_status = double("Status", :exitstatus => 1, :stdout => "", :stdin => "", :stderr => "svcs: Pattern 'chef' doesn't match any instances\n")
# shell_out! return value for a successful execution
- @success = double("clear", :exitstatus => 0, :stdout => '', :stdin => '', :stderr => '')
+ @success = double("clear", :exitstatus => 0, :stdout => "", :stdin => "", :stderr => "")
end
it "should raise an error if /bin/svcs and /usr/sbin/svcadm are not executable" do
diff --git a/spec/unit/provider/service/systemd_service_spec.rb b/spec/unit/provider/service/systemd_service_spec.rb
index 90b669a459..3761eb46db 100644
--- a/spec/unit/provider/service/systemd_service_spec.rb
+++ b/spec/unit/provider/service/systemd_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Systemd do
@@ -33,11 +33,11 @@ describe Chef::Provider::Service::Systemd do
let(:provider) { Chef::Provider::Service::Systemd.new(new_resource, run_context) }
let(:shell_out_success) do
- double('shell_out_with_systems_locale', :exitstatus => 0, :error? => false)
+ double("shell_out_with_systems_locale", :exitstatus => 0, :error? => false)
end
let(:shell_out_failure) do
- double('shell_out_with_systems_locale', :exitstatus => 1, :error? => true)
+ double("shell_out_with_systems_locale", :exitstatus => 1, :error? => true)
end
let(:current_resource) { Chef::Resource::Service.new(service_name) }
diff --git a/spec/unit/provider/service/upstart_service_spec.rb b/spec/unit/provider/service/upstart_service_spec.rb
index 6fb1f9fdbf..8a17e04f1a 100644
--- a/spec/unit/provider/service/upstart_service_spec.rb
+++ b/spec/unit/provider/service/upstart_service_spec.rb
@@ -16,18 +16,18 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Upstart do
let(:shell_out_success) do
- double('shell_out_with_systems_locale', :exitstatus => 0, :error? => false)
+ double("shell_out_with_systems_locale", :exitstatus => 0, :error? => false)
end
before(:each) do
@node =Chef::Node.new
- @node.name('upstarter')
- @node.automatic_attrs[:platform] = 'ubuntu'
- @node.automatic_attrs[:platform_version] = '9.10'
+ @node.name("upstarter")
+ @node.automatic_attrs[:platform] = "ubuntu"
+ @node.automatic_attrs[:platform_version] = "9.10"
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
@@ -42,7 +42,7 @@ describe Chef::Provider::Service::Upstart do
end
it "should return /etc/event.d as the upstart job directory when running on Ubuntu 9.04" do
- @node.automatic_attrs[:platform_version] = '9.04'
+ @node.automatic_attrs[:platform_version] = "9.04"
#Chef::Platform.stub(:find_platform_and_version).and_return([ "ubuntu", "9.04" ])
@provider = Chef::Provider::Service::Upstart.new(@new_resource, @run_context)
expect(@provider.instance_variable_get(:@upstart_job_dir)).to eq("/etc/event.d")
@@ -50,14 +50,14 @@ describe Chef::Provider::Service::Upstart do
end
it "should return /etc/init as the upstart job directory when running on Ubuntu 9.10" do
- @node.automatic_attrs[:platform_version] = '9.10'
+ @node.automatic_attrs[:platform_version] = "9.10"
@provider = Chef::Provider::Service::Upstart.new(@new_resource, @run_context)
expect(@provider.instance_variable_get(:@upstart_job_dir)).to eq("/etc/init")
expect(@provider.instance_variable_get(:@upstart_conf_suffix)).to eq(".conf")
end
it "should return /etc/init as the upstart job directory by default" do
- @node.automatic_attrs[:platform_version] = '9000'
+ @node.automatic_attrs[:platform_version] = "9000"
@provider = Chef::Provider::Service::Upstart.new(@new_resource, @run_context)
expect(@provider.instance_variable_get(:@upstart_job_dir)).to eq("/etc/init")
expect(@provider.instance_variable_get(:@upstart_conf_suffix)).to eq(".conf")
@@ -228,7 +228,7 @@ describe Chef::Provider::Service::Upstart do
describe "enable and disable service" do
before(:each) do
- @current_resource = Chef::Resource::Service.new('rsyslog')
+ @current_resource = Chef::Resource::Service.new("rsyslog")
allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
@provider.current_resource = @current_resource
allow(Chef::Util::FileEdit).to receive(:new)
@@ -256,7 +256,7 @@ describe Chef::Provider::Service::Upstart do
describe "start and stop service" do
before(:each) do
- @current_resource = Chef::Resource::Service.new('rsyslog')
+ @current_resource = Chef::Resource::Service.new("rsyslog")
allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
@provider.current_resource = @current_resource
diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb
index 34140fdd7b..d478192c78 100644
--- a/spec/unit/provider/service/windows_spec.rb
+++ b/spec/unit/provider/service/windows_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'mixlib/shellout'
+require "spec_helper"
+require "mixlib/shellout"
describe Chef::Provider::Service::Windows, "load_current_resource" do
include_context "Win32"
@@ -51,14 +51,14 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do
end
after(:each) do
- Win32::Service.send(:remove_const, 'AUTO_START') if defined?(Win32::Service::AUTO_START)
- Win32::Service.send(:remove_const, 'DEMAND_START') if defined?(Win32::Service::DEMAND_START)
- Win32::Service.send(:remove_const, 'DISABLED') if defined?(Win32::Service::DISABLED)
+ Win32::Service.send(:remove_const, "AUTO_START") if defined?(Win32::Service::AUTO_START)
+ Win32::Service.send(:remove_const, "DEMAND_START") if defined?(Win32::Service::DEMAND_START)
+ Win32::Service.send(:remove_const, "DISABLED") if defined?(Win32::Service::DISABLED)
end
it "sets the current resources service name to the new resources service name" do
provider.load_current_resource
- expect(provider.current_resource.service_name).to eq('chef')
+ expect(provider.current_resource.service_name).to eq("chef")
end
it "returns the current resource" do
diff --git a/spec/unit/provider/service_spec.rb b/spec/unit/provider/service_spec.rb
index 17bade55b6..38ac37d294 100644
--- a/spec/unit/provider/service_spec.rb
+++ b/spec/unit/provider/service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service do
before do
diff --git a/spec/unit/provider/subversion_spec.rb b/spec/unit/provider/subversion_spec.rb
index 9d4a8bd218..ff04a63b93 100644
--- a/spec/unit/provider/subversion_spec.rb
+++ b/spec/unit/provider/subversion_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Subversion do
@@ -36,7 +36,7 @@ describe Chef::Provider::Subversion do
it "converts resource attributes to options for run_command and popen4" do
expect(@provider.run_options).to eq({})
- @resource.user 'deployninja'
+ @resource.user "deployninja"
expect(@provider.run_options).to eq({:user => "deployninja"})
end
@@ -64,7 +64,7 @@ describe Chef::Provider::Subversion do
"Last Changed Rev: 11410\n" + # Last Changed Rev is preferred to Revision
"Last Changed Date: 2009-03-25 06:09:56 -0600 (Wed, 25 Mar 2009)\n\n"
expect(::File).to receive(:exist?).at_least(1).times.with("/my/deploy/dir/.svn").and_return(true)
- expected_command = ["svn info", {:cwd => '/my/deploy/dir', :returns => [0,1]}]
+ expected_command = ["svn info", {:cwd => "/my/deploy/dir", :returns => [0,1]}]
expect(@provider).to receive(:shell_out!).with(*expected_command).
and_return(double("ShellOut result", :stdout => example_svn_info, :stderr => ""))
expect(@provider.find_current_revision).to eql("11410")
@@ -73,7 +73,7 @@ describe Chef::Provider::Subversion do
it "gives nil as the current revision if the deploy dir isn't a SVN working copy" do
example_svn_info = "svn: '/tmp/deploydir' is not a working copy\n"
expect(::File).to receive(:exist?).with("/my/deploy/dir/.svn").and_return(true)
- expected_command = ["svn info", {:cwd => '/my/deploy/dir', :returns => [0,1]}]
+ expected_command = ["svn info", {:cwd => "/my/deploy/dir", :returns => [0,1]}]
expect(@provider).to receive(:shell_out!).with(*expected_command).
and_return(double("ShellOut result", :stdout => example_svn_info, :stderr => ""))
expect(@provider.find_current_revision).to be_nil
@@ -119,7 +119,7 @@ describe Chef::Provider::Subversion do
"Last Changed Rev: 11410\n" + # Last Changed Rev is preferred to Revision
"Last Changed Date: 2009-03-25 06:09:56 -0600 (Wed, 25 Mar 2009)\n\n"
@resource.revision "HEAD"
- expected_command = ["svn info http://svn.example.org/trunk/ --no-auth-cache -rHEAD", {:cwd => '/my/deploy/dir', :returns => [0,1]}]
+ expected_command = ["svn info http://svn.example.org/trunk/ --no-auth-cache -rHEAD", {:cwd => "/my/deploy/dir", :returns => [0,1]}]
expect(@provider).to receive(:shell_out!).with(*expected_command).
and_return(double("ShellOut result", :stdout => example_svn_info, :stderr => ""))
expect(@provider.revision_int).to eql("11410")
@@ -128,7 +128,7 @@ describe Chef::Provider::Subversion do
it "returns a helpful message if data from `svn info` can't be parsed" do
example_svn_info = "some random text from an error message\n"
@resource.revision "HEAD"
- expected_command = ["svn info http://svn.example.org/trunk/ --no-auth-cache -rHEAD", {:cwd => '/my/deploy/dir', :returns => [0,1]}]
+ expected_command = ["svn info http://svn.example.org/trunk/ --no-auth-cache -rHEAD", {:cwd => "/my/deploy/dir", :returns => [0,1]}]
expect(@provider).to receive(:shell_out!).with(*expected_command).
and_return(double("ShellOut result", :stdout => example_svn_info, :stderr => ""))
expect {@provider.revision_int}.to raise_error(RuntimeError, "Could not parse `svn info` data: some random text from an error message\n")
@@ -202,7 +202,7 @@ describe Chef::Provider::Subversion do
allow(::File).to receive(:exist?).with("/my/deploy/dir/.svn").and_return(false)
allow(::File).to receive(:exist?).with("/my/deploy/dir").and_return(true)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
- allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return(['.','..','foo','bar'])
+ allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return([".","..","foo","bar"])
expect(@provider).not_to receive(:checkout_command)
@provider.run_action(:checkout)
expect(@resource).not_to be_updated
@@ -246,7 +246,7 @@ describe Chef::Provider::Subversion do
it "does not fetch any updates if the remote revision matches the current revision" do
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
expect(::File).to receive(:exist?).with("/my/deploy/dir/.svn").and_return(true)
- allow(@provider).to receive(:find_current_revision).and_return('12345')
+ allow(@provider).to receive(:find_current_revision).and_return("12345")
allow(@provider).to receive(:current_revision_matches_target_revision?).and_return(true)
@provider.run_action(:sync)
expect(@resource).not_to be_updated
@@ -267,29 +267,29 @@ describe Chef::Provider::Subversion do
it "selects 'svn' as the binary by default" do
@resource.svn_binary nil
allow(ChefConfig).to receive(:windows?) { false }
- expect(@provider).to receive(:svn_binary).and_return('svn')
+ expect(@provider).to receive(:svn_binary).and_return("svn")
expect(@provider.export_command).to eql(
- 'svn export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir')
+ "svn export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir")
end
it "selects an svn binary with an exe extension on windows" do
@resource.svn_binary nil
allow(ChefConfig).to receive(:windows?) { true }
- expect(@provider).to receive(:svn_binary).and_return('svn.exe')
+ expect(@provider).to receive(:svn_binary).and_return("svn.exe")
expect(@provider.export_command).to eql(
- 'svn.exe export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir')
+ "svn.exe export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir")
end
it "uses a custom svn binary as part of the svn command" do
- @resource.svn_binary 'teapot'
- expect(@provider).to receive(:svn_binary).and_return('teapot')
+ @resource.svn_binary "teapot"
+ expect(@provider).to receive(:svn_binary).and_return("teapot")
expect(@provider.export_command).to eql(
- 'teapot export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir')
+ "teapot export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir")
end
it "wraps custom svn binary with quotes if it contains whitespace" do
- @resource.svn_binary 'c:/program files (x86)/subversion/svn.exe'
- expect(@provider).to receive(:svn_binary).and_return('c:/program files (x86)/subversion/svn.exe')
+ @resource.svn_binary "c:/program files (x86)/subversion/svn.exe"
+ expect(@provider).to receive(:svn_binary).and_return("c:/program files (x86)/subversion/svn.exe")
expect(@provider.export_command).to eql(
'"c:/program files (x86)/subversion/svn.exe" export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir')
end
diff --git a/spec/unit/provider/template/content_spec.rb b/spec/unit/provider/template/content_spec.rb
index 509c8cf33b..7a19f59de1 100644
--- a/spec/unit/provider/template/content_spec.rb
+++ b/spec/unit/provider/template/content_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Template::Content do
@@ -30,13 +30,13 @@ describe Chef::Provider::Template::Content do
let(:new_resource) do
double("Chef::Resource::Template (new)",
- :cookbook_name => 'openldap',
- :recipe_name => 'default',
+ :cookbook_name => "openldap",
+ :recipe_name => "default",
:source_line => "/Users/lamont/solo/cookbooks/openldap/recipes/default.rb:2:in `from_file'",
:source_line_file => "/Users/lamont/solo/cookbooks/openldap/recipes/default.rb",
:source_line_number => "2",
- :source => 'openldap_stuff.conf.erb',
- :name => 'openldap_stuff.conf',
+ :source => "openldap_stuff.conf.erb",
+ :name => "openldap_stuff.conf",
:path => resource_path,
:local => false,
:cookbook => nil,
@@ -47,8 +47,8 @@ describe Chef::Provider::Template::Content do
end
let(:rendered_file_locations) {
- [Dir.tmpdir + '/openldap_stuff.conf',
- enclosing_directory + '/openldap_stuff.conf']
+ [Dir.tmpdir + "/openldap_stuff.conf",
+ enclosing_directory + "/openldap_stuff.conf"]
}
let(:run_context) do
@@ -73,20 +73,20 @@ describe Chef::Provider::Template::Content do
end
it "finds the template file in the cookbook cache if it isn't local" do
- expect(content.template_location).to eq(CHEF_SPEC_DATA + '/cookbooks/openldap/templates/default/openldap_stuff.conf.erb')
+ expect(content.template_location).to eq(CHEF_SPEC_DATA + "/cookbooks/openldap/templates/default/openldap_stuff.conf.erb")
end
it "finds the template file locally if it is local" do
allow(new_resource).to receive(:local).and_return(true)
- allow(new_resource).to receive(:source).and_return('/tmp/its_on_disk.erb')
- expect(content.template_location).to eq('/tmp/its_on_disk.erb')
+ allow(new_resource).to receive(:source).and_return("/tmp/its_on_disk.erb")
+ expect(content.template_location).to eq("/tmp/its_on_disk.erb")
end
it "should use the cookbook name if defined in the template resource" do
- allow(new_resource).to receive(:cookbook_name).and_return('apache2')
- allow(new_resource).to receive(:cookbook).and_return('openldap')
+ allow(new_resource).to receive(:cookbook_name).and_return("apache2")
+ allow(new_resource).to receive(:cookbook).and_return("openldap")
allow(new_resource).to receive(:source).and_return("test.erb")
- expect(content.template_location).to eq(CHEF_SPEC_DATA + '/cookbooks/openldap/templates/default/test.erb')
+ expect(content.template_location).to eq(CHEF_SPEC_DATA + "/cookbooks/openldap/templates/default/test.erb")
end
it "returns a tempfile in the tempdir when :file_staging_uses_destdir is not set" do
@@ -130,14 +130,14 @@ describe Chef::Provider::Template::Content do
describe "when using location helpers" do
let(:new_resource) do
double("Chef::Resource::Template (new)",
- :cookbook_name => 'openldap',
- :recipe_name => 'default',
+ :cookbook_name => "openldap",
+ :recipe_name => "default",
:source_line => CHEF_SPEC_DATA + "/cookbooks/openldap/recipes/default.rb:2:in `from_file'",
:source_line_file => CHEF_SPEC_DATA + "/cookbooks/openldap/recipes/default.rb",
:source_line_number => "2",
- :source => 'helpers.erb',
- :name => 'helpers.erb',
- :path => CHEF_SPEC_DATA + '/cookbooks/openldap/templates/default/helpers.erb',
+ :source => "helpers.erb",
+ :name => "helpers.erb",
+ :path => CHEF_SPEC_DATA + "/cookbooks/openldap/templates/default/helpers.erb",
:local => false,
:cookbook => nil,
:variables => {},
diff --git a/spec/unit/provider/template_spec.rb b/spec/unit/provider/template_spec.rb
index 713303d818..5340cc8d12 100644
--- a/spec/unit/provider/template_spec.rb
+++ b/spec/unit/provider/template_spec.rb
@@ -17,17 +17,17 @@
# limitations under the License.
#
-require 'stringio'
-require 'spec_helper'
-require 'etc'
-require 'ostruct'
-require 'support/shared/unit/provider/file'
+require "stringio"
+require "spec_helper"
+require "etc"
+require "ostruct"
+require "support/shared/unit/provider/file"
describe Chef::Provider::Template 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(:enclosing_directory) {
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
}
@@ -50,7 +50,7 @@ describe Chef::Provider::Template do
end
let(:content) do
- content = double('Chef::Provider::File::Content::Template', :template_location => "/foo/bar/baz")
+ content = double("Chef::Provider::File::Content::Template", :template_location => "/foo/bar/baz")
allow(File).to receive(:exists?).with("/foo/bar/baz").and_return(true)
content
end
@@ -59,9 +59,9 @@ describe Chef::Provider::Template do
context "when creating the template" 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(:enclosing_directory) {
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
}
diff --git a/spec/unit/provider/user/dscl_spec.rb b/spec/unit/provider/user/dscl_spec.rb
index a9407a4d7e..8195bdfc25 100644
--- a/spec/unit/provider/user/dscl_spec.rb
+++ b/spec/unit/provider/user/dscl_spec.rb
@@ -18,9 +18,9 @@
ShellCmdResult = Struct.new(:stdout, :stderr, :exitstatus)
-require 'spec_helper'
-require 'ostruct'
-require 'mixlib/shellout'
+require "spec_helper"
+require "ostruct"
+require "mixlib/shellout"
describe Chef::Provider::User::Dscl do
before do
@@ -114,32 +114,32 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
describe "when shelling out to dscl" do
it "should run dscl with the supplied cmd /Path args" do
- shell_return = ShellCmdResult.new('stdout', 'err', 0)
+ shell_return = ShellCmdResult.new("stdout", "err", 0)
expect(provider).to receive(:shell_out).with("dscl . -cmd /Path args").and_return(shell_return)
- expect(provider.run_dscl("cmd /Path args")).to eq('stdout')
+ expect(provider.run_dscl("cmd /Path args")).to eq("stdout")
end
it "returns an empty string from delete commands" do
- shell_return = ShellCmdResult.new('out', 'err', 23)
+ shell_return = ShellCmdResult.new("out", "err", 23)
expect(provider).to receive(:shell_out).with("dscl . -delete /Path args").and_return(shell_return)
expect(provider.run_dscl("delete /Path args")).to eq("")
end
it "should raise an exception for any other command" do
- shell_return = ShellCmdResult.new('out', 'err', 23)
- expect(provider).to receive(:shell_out).with('dscl . -cmd /Path arguments').and_return(shell_return)
+ shell_return = ShellCmdResult.new("out", "err", 23)
+ expect(provider).to receive(:shell_out).with("dscl . -cmd /Path arguments").and_return(shell_return)
expect { provider.run_dscl("cmd /Path arguments") }.to raise_error(Chef::Exceptions::DsclCommandFailed)
end
it "raises an exception when dscl reports 'no such key'" do
- shell_return = ShellCmdResult.new("No such key: ", 'err', 23)
- expect(provider).to receive(:shell_out).with('dscl . -cmd /Path args').and_return(shell_return)
+ shell_return = ShellCmdResult.new("No such key: ", "err", 23)
+ expect(provider).to receive(:shell_out).with("dscl . -cmd /Path args").and_return(shell_return)
expect { provider.run_dscl("cmd /Path args") }.to raise_error(Chef::Exceptions::DsclCommandFailed)
end
it "raises an exception when dscl reports 'eDSRecordNotFound'" do
- shell_return = ShellCmdResult.new("<dscl_cmd> DS Error: -14136 (eDSRecordNotFound)", 'err', -14136)
- expect(provider).to receive(:shell_out).with('dscl . -cmd /Path args').and_return(shell_return)
+ shell_return = ShellCmdResult.new("<dscl_cmd> DS Error: -14136 (eDSRecordNotFound)", "err", -14136)
+ expect(provider).to receive(:shell_out).with("dscl . -cmd /Path args").and_return(shell_return)
expect { provider.run_dscl("cmd /Path args") }.to raise_error(Chef::Exceptions::DsclCommandFailed)
end
end
@@ -197,7 +197,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
end
it "finds a valid, unused uid when none is specified" do
- expect(provider).to receive(:run_dscl).with("list /Users uid").and_return('')
+ expect(provider).to receive(:run_dscl).with("list /Users uid").and_return("")
expect(provider).to receive(:run_dscl).with("create /Users/toor UniqueID 501")
expect(provider).to receive(:get_free_uid).and_return(501)
provider.dscl_set_uid
@@ -207,7 +207,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
it "sets the uid specified in the resource" do
new_resource.uid(1000)
expect(provider).to receive(:run_dscl).with("create /Users/toor UniqueID 1000").and_return(true)
- expect(provider).to receive(:run_dscl).with("list /Users uid").and_return('')
+ expect(provider).to receive(:run_dscl).with("list /Users uid").and_return("")
provider.dscl_set_uid
end
end
@@ -219,7 +219,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
before do
new_resource.supports({ :manage_home => true })
- new_resource.home('/Users/toor')
+ new_resource.home("/Users/toor")
provider.current_resource = current_resource
end
@@ -232,25 +232,25 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
it "raises InvalidHomeDirectory when the resource's home directory doesn't look right" do
- new_resource.home('epic-fail')
+ new_resource.home("epic-fail")
expect { provider.dscl_set_home }.to raise_error(Chef::Exceptions::InvalidHomeDirectory)
end
it "moves the users home to the new location if it exists and the target location is different" do
new_resource.supports(:manage_home => true)
- current_home = CHEF_SPEC_DATA + '/old_home_dir'
- current_home_files = [current_home + '/my-dot-emacs', current_home + '/my-dot-vim']
+ current_home = CHEF_SPEC_DATA + "/old_home_dir"
+ current_home_files = [current_home + "/my-dot-emacs", current_home + "/my-dot-vim"]
current_resource.home(current_home)
new_resource.gid(23)
- allow(::File).to receive(:exists?).with('/old/home/toor').and_return(true)
- allow(::File).to receive(:exists?).with('/Users/toor').and_return(true)
+ allow(::File).to receive(:exists?).with("/old/home/toor").and_return(true)
+ allow(::File).to receive(:exists?).with("/Users/toor").and_return(true)
- expect(FileUtils).to receive(:mkdir_p).with('/Users/toor').and_return(true)
+ expect(FileUtils).to receive(:mkdir_p).with("/Users/toor").and_return(true)
expect(FileUtils).to receive(:rmdir).with(current_home)
expect(::Dir).to receive(:glob).with("#{CHEF_SPEC_DATA}/old_home_dir/*",::File::FNM_DOTMATCH).and_return(current_home_files)
expect(FileUtils).to receive(:mv).with(current_home_files, "/Users/toor", :force => true)
- expect(FileUtils).to receive(:chown_R).with('toor','23','/Users/toor')
+ expect(FileUtils).to receive(:chown_R).with("toor","23","/Users/toor")
expect(provider).to receive(:run_dscl).with("create /Users/toor NFSHomeDirectory '/Users/toor'")
provider.dscl_set_home
@@ -263,7 +263,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
it "should run ditto to copy any missing files from skel to the new home dir" do
expect(::File).to receive(:exists?).with("/System/Library/User\ Template/English.lproj").and_return(true)
- expect(FileUtils).to receive(:chown_R).with('toor', '', '/Users/toor')
+ expect(FileUtils).to receive(:chown_R).with("toor", "", "/Users/toor")
expect(provider).to receive(:shell_out!).with("ditto '/System/Library/User Template/English.lproj' '/Users/toor'")
provider.ditto_home
end
@@ -382,7 +382,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
expect(provider).to receive(:shell_out).with("dscacheutil '-flushcache'")
expect(provider).to receive(:shell_out).with("plutil -convert xml1 -o - /var/db/dslocal/nodes/Default/users/toor.plist") do
if user_plist_file.nil?
- ShellCmdResult.new('Can not find the file', 'Sorry!!', 1)
+ ShellCmdResult.new("Can not find the file", "Sorry!!", 1)
else
ShellCmdResult.new(File.read(File.join(CHEF_SPEC_DATA, "mac_users/#{user_plist_file}.plist.xml")), "", 0)
end
@@ -656,7 +656,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
it "password_shadow_info should have salted-sha-512 format" do
shadow_info = provider.prepare_password_shadow_info
expect(shadow_info).to have_key("SALTED-SHA512")
- info = shadow_info["SALTED-SHA512"].string.unpack('H*').first
+ info = shadow_info["SALTED-SHA512"].string.unpack("H*").first
expect(provider.salted_sha512?(info)).to be_truthy
end
end
@@ -667,7 +667,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
it "password_shadow_info should have salted-sha-512 format" do
shadow_info = provider.prepare_password_shadow_info
expect(shadow_info).to have_key("SALTED-SHA512")
- info = shadow_info["SALTED-SHA512"].string.unpack('H*').first
+ info = shadow_info["SALTED-SHA512"].string.unpack("H*").first
expect(provider.salted_sha512?(info)).to be_truthy
expect(info).to eq(vagrant_sha_512)
end
@@ -689,7 +689,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("entropy")
expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("salt")
expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("iterations")
- info = shadow_info["SALTED-SHA512-PBKDF2"]["entropy"].string.unpack('H*').first
+ info = shadow_info["SALTED-SHA512-PBKDF2"]["entropy"].string.unpack("H*").first
expect(provider.salted_sha512_pbkdf2?(info)).to be_truthy
end
end
@@ -705,7 +705,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("entropy")
expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("salt")
expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("iterations")
- info = shadow_info["SALTED-SHA512-PBKDF2"]["entropy"].string.unpack('H*').first
+ info = shadow_info["SALTED-SHA512-PBKDF2"]["entropy"].string.unpack("H*").first
expect(provider.salted_sha512_pbkdf2?(info)).to be_truthy
expect(info).to eq(vagrant_sha_512_pbkdf2)
end
@@ -791,8 +791,8 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
end
it "should raise an exception when the group does not exist" do
- shell_return = ShellCmdResult.new("<dscl_cmd> DS Error: -14136 (eDSRecordNotFound)", 'err', -14136)
- expect(provider).to receive(:shell_out).with('dscl . -read /Groups/newgroup PrimaryGroupID').and_return(shell_return)
+ shell_return = ShellCmdResult.new("<dscl_cmd> DS Error: -14136 (eDSRecordNotFound)", "err", -14136)
+ expect(provider).to receive(:shell_out).with("dscl . -read /Groups/newgroup PrimaryGroupID").and_return(shell_return)
expect { provider.dscl_set_gid }.to raise_error(Chef::Exceptions::GroupIDNotFound)
end
end
@@ -814,8 +814,8 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
new_resource.username "mud"
new_resource.uid 2342
new_resource.gid 2342
- new_resource.home '/Users/death'
- new_resource.password 'goaway'
+ new_resource.home "/Users/death"
+ new_resource.password "goaway"
end
it "sets the user, comment field, uid, gid, moves the home directory, sets the shell, and sets the password" do
diff --git a/spec/unit/provider/user/pw_spec.rb b/spec/unit/provider/user/pw_spec.rb
index 6683a75f42..4b58fdc58e 100644
--- a/spec/unit/provider/user/pw_spec.rb
+++ b/spec/unit/provider/user/pw_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::User::Pw do
before(:each) do
@@ -48,11 +48,11 @@ describe Chef::Provider::User::Pw do
describe "setting options to the pw command" do
field_list = {
- 'comment' => "-c",
- 'home' => "-d",
- 'gid' => "-g",
- 'uid' => "-u",
- 'shell' => "-s",
+ "comment" => "-c",
+ "home" => "-d",
+ "gid" => "-g",
+ "uid" => "-u",
+ "shell" => "-s",
}
field_list.each do |attribute, option|
it "should check for differences in #{attribute} between the new and current resources" do
diff --git a/spec/unit/provider/user/solaris_spec.rb b/spec/unit/provider/user/solaris_spec.rb
index a3c17a9a56..f3299aaf63 100644
--- a/spec/unit/provider/user/solaris_spec.rb
+++ b/spec/unit/provider/user/solaris_spec.rb
@@ -22,8 +22,8 @@
ShellCmdResult = Struct.new(:stdout, :stderr, :exitstatus)
-require 'mixlib/shellout'
-require 'spec_helper'
+require "mixlib/shellout"
+require "spec_helper"
describe Chef::Provider::User::Solaris do
@@ -73,63 +73,63 @@ describe Chef::Provider::User::Solaris do
end
end
- describe 'when managing user locked status' do
+ describe "when managing user locked status" do
before(:each) do
@node = Chef::Node.new
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
- @new_resource = Chef::Resource::User.new('dave')
+ @new_resource = Chef::Resource::User.new("dave")
@current_resource = @new_resource.dup
@provider = Chef::Provider::User::Solaris.new(@new_resource, @run_context)
@provider.current_resource = @current_resource
end
- describe 'when determining if the user is locked' do
+ describe "when determining if the user is locked" do
# locked shadow lines
[
- 'dave:LK:::::::',
- 'dave:*LK*:::::::',
- 'dave:*LK*foobar:::::::',
- 'dave:*LK*bahamas10:::::::',
- 'dave:*LK*L....:::::::',
+ "dave:LK:::::::",
+ "dave:*LK*:::::::",
+ "dave:*LK*foobar:::::::",
+ "dave:*LK*bahamas10:::::::",
+ "dave:*LK*L....:::::::",
].each do |shadow|
it "should return true if user is locked with #{shadow}" do
- shell_return = ShellCmdResult.new(shadow + "\n", '', 0)
- expect(provider).to receive(:shell_out!).with('getent', 'shadow', @new_resource.username).and_return(shell_return)
+ shell_return = ShellCmdResult.new(shadow + "\n", "", 0)
+ expect(provider).to receive(:shell_out!).with("getent", "shadow", @new_resource.username).and_return(shell_return)
expect(provider.check_lock).to eql(true)
end
end
# unlocked shadow lines
[
- 'dave:NP:::::::',
- 'dave:*NP*:::::::',
- 'dave:foobar:::::::',
- 'dave:bahamas10:::::::',
- 'dave:L...:::::::',
+ "dave:NP:::::::",
+ "dave:*NP*:::::::",
+ "dave:foobar:::::::",
+ "dave:bahamas10:::::::",
+ "dave:L...:::::::",
].each do |shadow|
it "should return false if user is unlocked with #{shadow}" do
- shell_return = ShellCmdResult.new(shadow + "\n", '', 0)
- expect(provider).to receive(:shell_out!).with('getent', 'shadow', @new_resource.username).and_return(shell_return)
+ shell_return = ShellCmdResult.new(shadow + "\n", "", 0)
+ expect(provider).to receive(:shell_out!).with("getent", "shadow", @new_resource.username).and_return(shell_return)
expect(provider.check_lock).to eql(false)
end
end
end
- describe 'when locking the user' do
- it 'should run passwd -l with the new resources username' do
- shell_return = ShellCmdResult.new('', '', 0)
- expect(provider).to receive(:shell_out!).with('passwd', '-l', @new_resource.username).and_return(shell_return)
+ describe "when locking the user" do
+ it "should run passwd -l with the new resources username" do
+ shell_return = ShellCmdResult.new("", "", 0)
+ expect(provider).to receive(:shell_out!).with("passwd", "-l", @new_resource.username).and_return(shell_return)
provider.lock_user
end
end
- describe 'when unlocking the user' do
- it 'should run passwd -u with the new resources username' do
- shell_return = ShellCmdResult.new('', '', 0)
- expect(provider).to receive(:shell_out!).with('passwd', '-u', @new_resource.username).and_return(shell_return)
+ describe "when unlocking the user" do
+ it "should run passwd -u with the new resources username" do
+ shell_return = ShellCmdResult.new("", "", 0)
+ expect(provider).to receive(:shell_out!).with("passwd", "-u", @new_resource.username).and_return(shell_return)
provider.unlock_user
end
end
diff --git a/spec/unit/provider/user/useradd_spec.rb b/spec/unit/provider/user/useradd_spec.rb
index a295dff679..f8bcb13363 100644
--- a/spec/unit/provider/user/useradd_spec.rb
+++ b/spec/unit/provider/user/useradd_spec.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/provider/user/useradd'
+require "spec_helper"
+require "chef/provider/user/useradd"
describe Chef::Provider::User::Useradd do
@@ -30,11 +30,11 @@ describe Chef::Provider::User::Useradd do
end
supported_useradd_options = {
- 'comment' => "-c",
- 'gid' => "-g",
- 'uid' => "-u",
- 'shell' => "-s",
- 'password' => "-p",
+ "comment" => "-c",
+ "gid" => "-g",
+ "uid" => "-u",
+ "shell" => "-s",
+ "password" => "-p",
}
include_examples "a useradd-based user provider", supported_useradd_options
diff --git a/spec/unit/provider/user/windows_spec.rb b/spec/unit/provider/user/windows_spec.rb
index 7e08f971a9..7a8cb29963 100644
--- a/spec/unit/provider/user/windows_spec.rb
+++ b/spec/unit/provider/user/windows_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class Chef
class Util
@@ -104,7 +104,7 @@ describe Chef::Provider::User::Windows do
end
it "marks the home_dir attribute to be updated" do
- expect(@provider.set_options[:home_dir]).to eq('/home/adam')
+ expect(@provider.set_options[:home_dir]).to eq("/home/adam")
end
it "ignores the primary_group_id attribute" do
@@ -116,11 +116,11 @@ describe Chef::Provider::User::Windows do
end
it "marks the script_path attribute to be updated" do
- expect(@provider.set_options[:script_path]).to eq('/usr/bin/zsh')
+ expect(@provider.set_options[:script_path]).to eq("/usr/bin/zsh")
end
it "marks the password attribute to be updated" do
- expect(@provider.set_options[:password]).to eq('abracadabra')
+ expect(@provider.set_options[:password]).to eq("abracadabra")
end
end
end
diff --git a/spec/unit/provider/user_spec.rb b/spec/unit/provider/user_spec.rb
index c38abcc049..043a67df1b 100644
--- a/spec/unit/provider/user_spec.rb
+++ b/spec/unit/provider/user_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
EtcPwnamIsh = Struct.new(:name, :passwd, :uid, :gid, :gecos, :dir, :shell, :change, :uclass, :expire)
EtcGrnamIsh = Struct.new(:name, :passwd, :gid, :mem)
@@ -83,7 +83,7 @@ describe Chef::Provider::User do
it "should create a current resource with the same name as the new resource" do
@provider.load_current_resource
- expect(@provider.current_resource.name).to eq('adam')
+ expect(@provider.current_resource.name).to eq("adam")
end
it "should set the username of the current resource to the username of the new resource" do
@@ -92,7 +92,7 @@ describe Chef::Provider::User do
end
it "should change the encoding of gecos to the encoding of the new resource" do
- @pw_user.gecos.force_encoding('ASCII-8BIT')
+ @pw_user.gecos.force_encoding("ASCII-8BIT")
@provider.load_current_resource
expect(@provider.current_resource.comment.encoding).to eq(@new_resource.comment.encoding)
end
@@ -141,8 +141,8 @@ describe Chef::Provider::User do
describe "and running assertions" do
def self.shadow_lib_unavail?
begin
- require 'rubygems'
- require 'shadow'
+ require "rubygems"
+ require "shadow"
rescue LoadError
skip "ruby-shadow gem not installed for dynamic load test"
true
@@ -165,7 +165,7 @@ describe Chef::Provider::User do
context "and we are root", :requires_root => true do
it "should pass assertions when ruby-shadow can be loaded" do
- @provider.action = 'create'
+ @provider.action = "create"
original_method = @provider.method(:require)
expect(@provider).to receive(:require) { |*args| original_method.call(*args) }
passwd_info = Struct::PasswdEntry.new(:sp_namp => "adm ", :sp_pwdp => "$1$T0N0Q.lc$nyG6pFI3Dpqa5cxUz/57j0", :sp_lstchg => 14861, :sp_min => 0, :sp_max => 99999,
@@ -192,13 +192,13 @@ describe Chef::Provider::User do
describe "compare_user" do
let(:mapping) {
{
- 'username' => ["adam", "Adam"],
- 'comment' => ["Adam Jacob", "adam jacob"],
- 'uid' => [1000, 1001],
- 'gid' => [1000, 1001],
- 'home' => ["/home/adam", "/Users/adam"],
- 'shell'=> ["/usr/bin/zsh", "/bin/bash"],
- 'password'=> ["abcd","12345"],
+ "username" => ["adam", "Adam"],
+ "comment" => ["Adam Jacob", "adam jacob"],
+ "uid" => [1000, 1001],
+ "gid" => [1000, 1001],
+ "home" => ["/home/adam", "/Users/adam"],
+ "shell"=> ["/usr/bin/zsh", "/bin/bash"],
+ "password"=> ["abcd","12345"],
}
}
@@ -441,8 +441,8 @@ describe Chef::Provider::User do
describe "convert_group_name" do
before do
- @new_resource.gid('999')
- @group = EtcGrnamIsh.new('wheel', '*', 999, [])
+ @new_resource.gid("999")
+ @group = EtcGrnamIsh.new("wheel", "*", 999, [])
end
it "should lookup the group name locally" do
diff --git a/spec/unit/provider/whyrun_safe_ruby_block_spec.rb b/spec/unit/provider/whyrun_safe_ruby_block_spec.rb
index 2a4dccdad7..6f8949bba3 100644
--- a/spec/unit/provider/whyrun_safe_ruby_block_spec.rb
+++ b/spec/unit/provider/whyrun_safe_ruby_block_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::WhyrunSafeRubyBlock, "initialize" do
before(:each) do