summaryrefslogtreecommitdiff
path: root/spec/functional/resource
diff options
context:
space:
mode:
Diffstat (limited to 'spec/functional/resource')
-rwxr-xr-xspec/functional/resource/aix_service_spec.rb12
-rwxr-xr-xspec/functional/resource/aixinit_service_spec.rb20
-rw-r--r--spec/functional/resource/bash_spec.rb8
-rw-r--r--spec/functional/resource/batch_spec.rb6
-rw-r--r--spec/functional/resource/bff_spec.rb10
-rw-r--r--spec/functional/resource/cookbook_file_spec.rb14
-rw-r--r--spec/functional/resource/cron_spec.rb22
-rw-r--r--spec/functional/resource/deploy_revision_spec.rb4
-rw-r--r--spec/functional/resource/directory_spec.rb2
-rw-r--r--spec/functional/resource/dpkg_package_spec.rb70
-rw-r--r--spec/functional/resource/dsc_resource_spec.rb30
-rw-r--r--spec/functional/resource/dsc_script_spec.rb146
-rwxr-xr-xspec/functional/resource/env_spec.rb50
-rw-r--r--spec/functional/resource/execute_spec.rb14
-rw-r--r--spec/functional/resource/file_spec.rb8
-rw-r--r--spec/functional/resource/git_spec.rb32
-rw-r--r--spec/functional/resource/group_spec.rb14
-rw-r--r--spec/functional/resource/ifconfig_spec.rb20
-rw-r--r--spec/functional/resource/link_spec.rb262
-rw-r--r--spec/functional/resource/mount_spec.rb22
-rw-r--r--spec/functional/resource/ohai_spec.rb2
-rw-r--r--spec/functional/resource/package_spec.rb8
-rw-r--r--spec/functional/resource/powershell_script_spec.rb40
-rw-r--r--spec/functional/resource/reboot_spec.rb18
-rw-r--r--spec/functional/resource/registry_spec.rb4
-rw-r--r--spec/functional/resource/remote_directory_spec.rb42
-rw-r--r--spec/functional/resource/remote_file_spec.rb28
-rw-r--r--spec/functional/resource/rpm_spec.rb18
-rw-r--r--spec/functional/resource/template_spec.rb10
-rw-r--r--spec/functional/resource/user/dscl_spec.rb4
-rw-r--r--spec/functional/resource/user/useradd_spec.rb20
-rw-r--r--spec/functional/resource/user/windows_spec.rb38
-rw-r--r--spec/functional/resource/windows_package_spec.rb42
-rw-r--r--spec/functional/resource/windows_service_spec.rb2
34 files changed, 521 insertions, 521 deletions
diff --git a/spec/functional/resource/aix_service_spec.rb b/spec/functional/resource/aix_service_spec.rb
index 604c04dad7..e249bd9bc0 100755
--- a/spec/functional/resource/aix_service_spec.rb
+++ b/spec/functional/resource/aix_service_spec.rb
@@ -17,24 +17,24 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "functional/resource/base"
+require "chef/mixin/shell_out"
shared_examples "src service" do
include Chef::Mixin::ShellOut
def service_should_be_started
- expect(shell_out!("lssrc -a | grep #{new_resource.service_name}").stdout.split(' ').last).to eq("active")
+ expect(shell_out!("lssrc -a | grep #{new_resource.service_name}").stdout.split(" ").last).to eq("active")
end
def service_should_be_stopped
- expect(shell_out!("lssrc -a | grep #{new_resource.service_name}").stdout.split(' ').last).to eq("inoperative")
+ expect(shell_out!("lssrc -a | grep #{new_resource.service_name}").stdout.split(" ").last).to eq("inoperative")
end
def get_service_pid
- args = shell_out!("lssrc -a | grep #{new_resource.service_name}").stdout.split(' ')
+ args = shell_out!("lssrc -a | grep #{new_resource.service_name}").stdout.split(" ")
if args.length == 3
args[1]
else
diff --git a/spec/functional/resource/aixinit_service_spec.rb b/spec/functional/resource/aixinit_service_spec.rb
index 3e19a16af0..6b87725c34 100755
--- a/spec/functional/resource/aixinit_service_spec.rb
+++ b/spec/functional/resource/aixinit_service_spec.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
-require 'fileutils'
+require "spec_helper"
+require "functional/resource/base"
+require "chef/mixin/shell_out"
+require "fileutils"
describe Chef::Resource::Service, :requires_root, :aix_only do
@@ -130,7 +130,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
context "when the service doesn't set a priority" do
it "creates symlink with status S" do
new_resource.run_action(:enable)
- valide_symlinks(["/etc/rc.d/rc2.d/Schefinittest"],2,'S')
+ valide_symlinks(["/etc/rc.d/rc2.d/Schefinittest"],2,"S")
end
end
@@ -141,7 +141,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
it "creates a symlink with status S and a priority" do
new_resource.run_action(:enable)
- valide_symlinks(["/etc/rc.d/rc2.d/S75chefinittest"], 2,'S',75)
+ valide_symlinks(["/etc/rc.d/rc2.d/S75chefinittest"], 2,"S",75)
end
end
@@ -153,7 +153,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
it "create symlink with status start (S) or stop (K) and a priority " do
new_resource.run_action(:enable)
- valide_symlinks(["/etc/rc.d/rc2.d/S20chefinittest", "/etc/rc.d/rc3.d/K10chefinittest"], 2,'S',new_resource.priority)
+ valide_symlinks(["/etc/rc.d/rc2.d/S20chefinittest", "/etc/rc.d/rc3.d/K10chefinittest"], 2,"S",new_resource.priority)
end
end
end
@@ -171,7 +171,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
it "creates symlink with status K" do
new_resource.run_action(:disable)
- valide_symlinks(["/etc/rc.d/rc2.d/Kchefinittest"], 2,'K')
+ valide_symlinks(["/etc/rc.d/rc2.d/Kchefinittest"], 2,"K")
end
end
@@ -187,7 +187,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
it "creates a symlink with status K and a priority" do
new_resource.run_action(:disable)
- valide_symlinks(["/etc/rc.d/rc2.d/K25chefinittest"], 2,'K',25)
+ valide_symlinks(["/etc/rc.d/rc2.d/K25chefinittest"], 2,"K",25)
end
end
@@ -204,7 +204,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
it "create symlink with status stop (K) and a priority " do
new_resource.run_action(:disable)
- valide_symlinks(["/etc/rc.d/rc2.d/K80chefinittest"], 2,'K',80)
+ valide_symlinks(["/etc/rc.d/rc2.d/K80chefinittest"], 2,"K",80)
end
end
end
diff --git a/spec/functional/resource/bash_spec.rb b/spec/functional/resource/bash_spec.rb
index 209ec4a12f..0edc415ac1 100644
--- a/spec/functional/resource/bash_spec.rb
+++ b/spec/functional/resource/bash_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
+require "spec_helper"
+require "functional/resource/base"
describe Chef::Resource::Bash, :unix_only do
let(:code) { "echo hello" }
@@ -28,7 +28,7 @@ describe Chef::Resource::Bash, :unix_only do
}
describe "when setting the command attribute" do
- let (:command) { 'wizard racket' }
+ let (:command) { "wizard racket" }
# in Chef-12 the `command` attribute is largely useless, but does set the identity attribute
# so that notifications need to target the value of the command. it will not run the `command`
@@ -81,7 +81,7 @@ describe Chef::Resource::Bash, :unix_only do
end
it "times out when a timeout is set on the resource" do
- resource.code 'sleep 600'
+ resource.code "sleep 600"
resource.timeout 0.1
expect { resource.run_action(:run) }.to raise_error(Mixlib::ShellOut::CommandTimeout)
end
diff --git a/spec/functional/resource/batch_spec.rb b/spec/functional/resource/batch_spec.rb
index 39133fd40b..09d51e8eec 100644
--- a/spec/functional/resource/batch_spec.rb
+++ b/spec/functional/resource/batch_spec.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::WindowsScript::Batch, :windows_only do
include_context Chef::Resource::WindowsScript
- let(:output_command) { ' > ' }
+ let(:output_command) { " > " }
- let (:architecture_command) { '@echo %PROCESSOR_ARCHITECTURE%' }
+ let (:architecture_command) { "@echo %PROCESSOR_ARCHITECTURE%" }
it_behaves_like "a Windows script running on Windows"
diff --git a/spec/functional/resource/bff_spec.rb b/spec/functional/resource/bff_spec.rb
index b969254b6b..a8083b049e 100644
--- a/spec/functional/resource/bff_spec.rb
+++ b/spec/functional/resource/bff_spec.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
+require "functional/resource/base"
+require "chef/mixin/shell_out"
# Run the test only for AIX platform.
-describe Chef::Resource::BffPackage, :requires_root, :external => ohai[:platform] != 'aix' do
+describe Chef::Resource::BffPackage, :requires_root, :external => ohai[:platform] != "aix" do
include Chef::Mixin::ShellOut
let(:new_resource) do
@@ -43,7 +43,7 @@ describe Chef::Resource::BffPackage, :requires_root, :external => ohai[:platform
before(:all) do
@pkg_name = "PkgA.rte"
@pkg_path = "/tmp/PkgA.1.0.0.0.bff"
- FileUtils.cp 'spec/functional/assets/PkgA.1.0.0.0.bff' , @pkg_path
+ FileUtils.cp "spec/functional/assets/PkgA.1.0.0.0.bff" , @pkg_path
end
after(:all) do
@@ -78,7 +78,7 @@ describe Chef::Resource::BffPackage, :requires_root, :external => ohai[:platform
before(:each) do
shell_out("installp -aYF -d #{@pkg_path} #{@pkg_name}")
@pkg_path = "/tmp/PkgA.2.0.0.0.bff"
- FileUtils.cp 'spec/functional/assets/PkgA.2.0.0.0.bff' , @pkg_path
+ FileUtils.cp "spec/functional/assets/PkgA.2.0.0.0.bff" , @pkg_path
end
it "should upgrade package" do
diff --git a/spec/functional/resource/cookbook_file_spec.rb b/spec/functional/resource/cookbook_file_spec.rb
index 6d4c5b4a8f..e91737572b 100644
--- a/spec/functional/resource/cookbook_file_spec.rb
+++ b/spec/functional/resource/cookbook_file_spec.rb
@@ -16,16 +16,16 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::CookbookFile do
include_context Chef::Resource::File
- let(:file_base) { 'cookbook_file_spec' }
- let(:source) { 'java.response' }
- let(:cookbook_name) { 'java' }
+ let(:file_base) { "cookbook_file_spec" }
+ let(:source) { "java.response" }
+ let(:cookbook_name) { "java" }
let(:expected_content) do
- content = File.open(File.join(CHEF_SPEC_DATA, 'cookbooks', 'java', 'files', 'default', 'java.response'), "rb") do |f|
+ content = File.open(File.join(CHEF_SPEC_DATA, "cookbooks", "java", "files", "default", "java.response"), "rb") do |f|
f.read
end
content.force_encoding(Encoding::BINARY) if content.respond_to?(:force_encoding)
@@ -39,7 +39,7 @@ describe Chef::Resource::CookbookFile do
def create_resource
# set up cookbook collection for this run to use, based on our
# spec data.
- cookbook_repo = File.expand_path(File.join(CHEF_SPEC_DATA, 'cookbooks'))
+ cookbook_repo = File.expand_path(File.join(CHEF_SPEC_DATA, "cookbooks"))
Chef::Cookbook::FileVendor.fetch_from_disk(cookbook_repo)
loader = Chef::CookbookLoader.new(cookbook_repo)
loader.load_cookbooks
@@ -66,7 +66,7 @@ describe Chef::Resource::CookbookFile do
# implementation
# stages files in temp.
context "targets a file outside of the system temp directory" do
- let(:windows_non_temp_dir) { File.join(ENV['systemdrive'], make_tmpname(file_base, "non-temp")) }
+ let(:windows_non_temp_dir) { File.join(ENV["systemdrive"], make_tmpname(file_base, "non-temp")) }
let(:path) { File.join(windows_non_temp_dir, make_tmpname(file_base)) }
before do
diff --git a/spec/functional/resource/cron_spec.rb b/spec/functional/resource/cron_spec.rb
index ed30756583..ac13f934ff 100644
--- a/spec/functional/resource/cron_spec.rb
+++ b/spec/functional/resource/cron_spec.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "functional/resource/base"
+require "chef/mixin/shell_out"
describe Chef::Resource::Cron, :requires_root, :unix_only do
@@ -55,17 +55,17 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do
# Actual tests
let(:new_resource) do
new_resource = Chef::Resource::Cron.new("Chef functional test cron", run_context)
- new_resource.user 'root'
+ new_resource.user "root"
# @hourly is not supported on solaris, aix
if ohai[:platform] == "solaris" || ohai[:platform] == "solaris2" || ohai[:platform] == "aix"
new_resource.minute "0 * * * *"
else
- new_resource.minute '@hourly'
+ new_resource.minute "@hourly"
end
- new_resource.hour ''
- new_resource.day ''
- new_resource.month ''
- new_resource.weekday ''
+ new_resource.hour ""
+ new_resource.day ""
+ new_resource.month ""
+ new_resource.weekday ""
new_resource.command "/bin/true"
new_resource
end
@@ -107,7 +107,7 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do
exclude_solaris = ["solaris", "opensolaris", "solaris2", "omnios"].include?(ohai[:platform])
describe "create action with various attributes", :external => exclude_solaris do
def create_and_validate_with_attribute(resource, attribute, value)
- if ohai[:platform] == 'aix'
+ if ohai[:platform] == "aix"
expect {resource.run_action(:create)}.to raise_error(Chef::Exceptions::Cron, /Aix cron entry does not support environment variables. Please set them in script and use script in cron./)
else
resource.run_action(:create)
@@ -117,7 +117,7 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do
end
def cron_attribute_should_exists(cron_name, attribute, value)
- return if ['aix', 'solaris'].include?(ohai[:platform])
+ return if ["aix", "solaris"].include?(ohai[:platform])
# Test if the attribute exists on newly created cron
cron_should_exists(cron_name, "")
expect(shell_out("crontab -l -u #{new_resource.user} | grep \"#{attribute.upcase}=#{value}\"").exitstatus).to eq(0)
diff --git a/spec/functional/resource/deploy_revision_spec.rb b/spec/functional/resource/deploy_revision_spec.rb
index 4bce309a51..8b888ddf6a 100644
--- a/spec/functional/resource/deploy_revision_spec.rb
+++ b/spec/functional/resource/deploy_revision_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tmpdir'
+require "spec_helper"
+require "tmpdir"
# Deploy relies heavily on symlinks, so it doesn't work on windows.
describe Chef::Resource::DeployRevision, :unix_only => true do
diff --git a/spec/functional/resource/directory_spec.rb b/spec/functional/resource/directory_spec.rb
index 88a810964f..2097ad02b7 100644
--- a/spec/functional/resource/directory_spec.rb
+++ b/spec/functional/resource/directory_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Directory do
include_context Chef::Resource::Directory
diff --git a/spec/functional/resource/dpkg_package_spec.rb b/spec/functional/resource/dpkg_package_spec.rb
index aebe2475a5..ebfb1e3ffb 100644
--- a/spec/functional/resource/dpkg_package_spec.rb
+++ b/spec/functional/resource/dpkg_package_spec.rb
@@ -15,8 +15,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "chef/mixin/shell_out"
describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch: "x86_64" do
include Chef::Mixin::ShellOut
@@ -61,7 +61,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
it "installs a package when given only the filename as a name argument (no source)" do
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
+ shell_out!("dpkg -s chef-integration-test")
end
it "installs a package when given the name and a source argument" do
@@ -69,7 +69,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source test1_0
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
+ shell_out!("dpkg -s chef-integration-test")
end
it "installs a package when given a different name and a source argument" do
@@ -77,7 +77,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source test1_0
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
+ shell_out!("dpkg -s chef-integration-test")
end
it "installs a package when given a path as a package_name and no source" do
@@ -85,7 +85,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.package_name test1_0
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
+ shell_out!("dpkg -s chef-integration-test")
end
it "raises an error when the name is not a path and the source is not given" do
@@ -109,15 +109,15 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
shell_out!("dpkg -i #{test1_0}")
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
+ shell_out!("dpkg -s chef-integration-test")
end
it "should handle a multipackage install" do
set_dpkg_package_name [ test1_0, test2_0 ]
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
- shell_out!('dpkg -s chef-integration-test2')
+ shell_out!("dpkg -s chef-integration-test")
+ shell_out!("dpkg -s chef-integration-test2")
end
it "should not update multipackages that are up-to-date" do
@@ -125,8 +125,8 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name [ test1_0, test2_0 ]
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
- shell_out!('dpkg -s chef-integration-test2')
+ shell_out!("dpkg -s chef-integration-test")
+ shell_out!("dpkg -s chef-integration-test2")
end
it "should install the second if the first is installed" do
@@ -134,8 +134,8 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name [ test1_0, test2_0 ]
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
- shell_out!('dpkg -s chef-integration-test2')
+ shell_out!("dpkg -s chef-integration-test")
+ shell_out!("dpkg -s chef-integration-test2")
end
it "should install the first if the second is installed" do
@@ -143,8 +143,8 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name [ test1_0, test2_0 ]
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
- shell_out!('dpkg -s chef-integration-test2')
+ shell_out!("dpkg -s chef-integration-test")
+ shell_out!("dpkg -s chef-integration-test2")
end
end
@@ -191,13 +191,13 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
shell_out!("dpkg -i #{test1_0}")
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should do nothing if the package is not installed when the name is a source" do
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should remove a package that is installed when the name is the package name and source is nil" do
@@ -205,14 +205,14 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name "chef-integration-test"
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should do nothing if the package is not installed when the name is the package name and the source is nil" do
set_dpkg_package_name "chef-integration-test"
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should remove a package that is installed when the name is changed but the source is a package" do
@@ -221,7 +221,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source test1_0
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should do nothing if the package is not installed when the name is changed but the source is a package" do
@@ -229,7 +229,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source test1_0
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should remove a package if the name is a file that does not exist, but the source exists" do
@@ -239,7 +239,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source test1_0
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should do nothing if the package is not installed when the name is a file that does not exist, but the source exists" do
@@ -249,7 +249,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source test1_0
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should remove a package if the package_name is correct, but the source does not exist" do
@@ -259,7 +259,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source File.join(test1_0, "make.it.fail")
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should do nothing if the package_name is correct, but the source does not exist, and the package is not installed" do
@@ -268,7 +268,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source File.join(test1_0, "make.it.fail")
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should remove both packages when called with two" do
@@ -276,8 +276,8 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name [ "chef-integration-test", "chef-integration-test2" ]
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
- should_be_purged_or_removed('chef-integration-test2', action)
+ should_be_purged_or_removed("chef-integration-test")
+ should_be_purged_or_removed("chef-integration-test2", action)
end
it "should remove a package when only the first one is installed" do
@@ -285,8 +285,8 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name [ "chef-integration-test", "chef-integration-test2" ]
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
- should_be_purged_or_removed('chef-integration-test2')
+ should_be_purged_or_removed("chef-integration-test")
+ should_be_purged_or_removed("chef-integration-test2")
end
it "should remove a package when only the second one is installed" do
@@ -294,16 +294,16 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name [ "chef-integration-test", "chef-integration-test2" ]
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
- should_be_purged_or_removed('chef-integration-test2', action)
+ should_be_purged_or_removed("chef-integration-test")
+ should_be_purged_or_removed("chef-integration-test2", action)
end
it "should do nothing when both packages are not installed" do
set_dpkg_package_name [ "chef-integration-test", "chef-integration-test2" ]
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
- should_be_purged_or_removed('chef-integration-test2')
+ should_be_purged_or_removed("chef-integration-test")
+ should_be_purged_or_removed("chef-integration-test2")
end
end
@@ -318,7 +318,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name "chef-integration-test2"
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test2') # its still 'installed'
+ shell_out!("dpkg -s chef-integration-test2") # its still 'installed'
end
end
@@ -333,7 +333,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name "chef-integration-test2"
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test2', action)
+ should_be_purged_or_removed("chef-integration-test2", action)
end
end
end
diff --git a/spec/functional/resource/dsc_resource_spec.rb b/spec/functional/resource/dsc_resource_spec.rb
index 24503f1ec7..07c0bf5eb9 100644
--- a/spec/functional/resource/dsc_resource_spec.rb
+++ b/spec/functional/resource/dsc_resource_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::DscResource, :windows_powershell_dsc_only do
before(:all) do
@ohai = Ohai::System.new
- @ohai.all_plugins(['platform', 'os', 'languages/powershell'])
+ @ohai.all_plugins(["platform", "os", "languages/powershell"])
end
let(:event_dispatch) { Chef::EventDispatch::Dispatcher.new }
@@ -38,25 +38,25 @@ describe Chef::Resource::DscResource, :windows_powershell_dsc_only do
Chef::Resource::DscResource.new("dsc_resource_test", run_context)
}
- context 'when Powershell does not support Invoke-DscResource'
- context 'when Powershell supports Invoke-DscResource' do
+ context "when Powershell does not support Invoke-DscResource"
+ context "when Powershell supports Invoke-DscResource" do
before do
if !Chef::Platform.supports_dsc_invoke_resource?(node)
- skip 'Requires Powershell >= 5.0.10018.0'
+ skip "Requires Powershell >= 5.0.10018.0"
elsif !Chef::Platform.dsc_refresh_mode_disabled?(node)
- skip 'Requires LCM RefreshMode is Disabled'
+ skip "Requires LCM RefreshMode is Disabled"
end
end
- context 'with an invalid dsc resource' do
- it 'raises an exception if the resource is not found' do
- new_resource.resource 'thisdoesnotexist'
+ context "with an invalid dsc resource" do
+ it "raises an exception if the resource is not found" do
+ new_resource.resource "thisdoesnotexist"
expect { new_resource.run_action(:run) }.to raise_error(
Chef::Exceptions::ResourceNotFound)
end
end
- context 'with a valid dsc resource' do
- let(:tmp_file_name) { Dir::Tmpname.create('tmpfile') {} }
+ context "with a valid dsc resource" do
+ let(:tmp_file_name) { Dir::Tmpname.create("tmpfile") {} }
let(:test_text) { "'\"!@#$%^&*)(}{][\u2713~n"}
before do
@@ -69,16 +69,16 @@ describe Chef::Resource::DscResource, :windows_powershell_dsc_only do
File.delete(tmp_file_name) if File.exists? tmp_file_name
end
- it 'converges the resource if it is not converged' do
+ it "converges the resource if it is not converged" do
new_resource.run_action(:run)
- contents = File.open(tmp_file_name, 'rb:bom|UTF-16LE') do |f|
- f.read.encode('UTF-8')
+ contents = File.open(tmp_file_name, "rb:bom|UTF-16LE") do |f|
+ f.read.encode("UTF-8")
end
expect(contents).to eq(test_text)
expect(new_resource).to be_updated
end
- it 'does not converge the resource if it is already converged' do
+ it "does not converge the resource if it is already converged" do
new_resource.run_action(:run)
expect(new_resource).to be_updated
reresource =
diff --git a/spec/functional/resource/dsc_script_spec.rb b/spec/functional/resource/dsc_script_spec.rb
index 2e0830e02e..67fa30d815 100644
--- a/spec/functional/resource/dsc_script_spec.rb
+++ b/spec/functional/resource/dsc_script_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/shell_out'
-require 'chef/mixin/windows_architecture_helper'
-require 'support/shared/integration/integration_helper'
+require "spec_helper"
+require "chef/mixin/shell_out"
+require "chef/mixin/windows_architecture_helper"
+require "support/shared/integration/integration_helper"
describe Chef::Resource::DscScript, :windows_powershell_dsc_only do
include Chef::Mixin::WindowsArchitectureHelper
@@ -35,10 +35,10 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only do
def create_config_script_from_code(code, configuration_name, data = false)
script_code = data ? code : "Configuration '#{configuration_name}'\n{\n\t#{code}\n}\n"
- data_suffix = data ? '_config_data' : ''
- extension = data ? 'psd1' : 'ps1'
+ data_suffix = data ? "_config_data" : ""
+ extension = data ? "psd1" : "ps1"
script_path = "#{@temp_dir}/dsc_functional_test#{data_suffix}.#{extension}"
- ::File.open(script_path, 'wt') do | script |
+ ::File.open(script_path, "wt") do | script |
script.write(script_code)
end
script_path
@@ -61,28 +61,28 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only do
end
end
- let(:dsc_env_variable) { 'chefenvtest' }
- let(:dsc_env_value1) { 'value1' }
- let(:env_value2) { 'value2' }
+ let(:dsc_env_variable) { "chefenvtest" }
+ let(:dsc_env_value1) { "value1" }
+ let(:env_value2) { "value2" }
let(:dsc_test_run_context) {
node = Chef::Node.new
- node.automatic['platform'] = 'windows'
- node.automatic['platform_version'] = '6.1'
- node.automatic['kernel'][:machine] = :x86_64 # Only 64-bit architecture is supported
- node.automatic[:languages][:powershell][:version] = '4.0'
+ node.automatic["platform"] = "windows"
+ node.automatic["platform_version"] = "6.1"
+ node.automatic["kernel"][:machine] = :x86_64 # Only 64-bit architecture is supported
+ node.automatic[:languages][:powershell][:version] = "4.0"
empty_events = Chef::EventDispatch::Dispatcher.new
Chef::RunContext.new(node, {}, empty_events)
}
- let(:dsc_test_resource_name) { 'DSCTest' }
+ let(:dsc_test_resource_name) { "DSCTest" }
let(:dsc_test_resource_base) {
Chef::Resource::DscScript.new(dsc_test_resource_name, dsc_test_run_context)
}
let(:test_registry_key) { 'HKEY_LOCAL_MACHINE\Software\Chef\Spec\Functional\Resource\dsc_script_spec' }
- let(:test_registry_value) { 'Registration' }
- let(:test_registry_data1) { 'LL927' }
- let(:test_registry_data2) { 'LL928' }
- let(:reg_key_name_param_name) { 'testregkeyname' }
- let(:reg_key_value_param_name) { 'testregvaluename' }
+ let(:test_registry_value) { "Registration" }
+ let(:test_registry_data1) { "LL927" }
+ let(:test_registry_data2) { "LL928" }
+ let(:reg_key_name_param_name) { "testregkeyname" }
+ let(:reg_key_value_param_name) { "testregvaluename" }
let(:registry_embedded_parameters) { "$#{reg_key_name_param_name} = '#{test_registry_key}';$#{reg_key_value_param_name} = '#{test_registry_value}'"}
let(:dsc_reg_code) { <<-EOH
#{registry_embedded_parameters}
@@ -103,15 +103,15 @@ EOH
EOH
}
- let(:dsc_user_prefix) { 'dsc' }
- let(:dsc_user_suffix) { 'chefx' }
+ let(:dsc_user_prefix) { "dsc" }
+ let(:dsc_user_suffix) { "chefx" }
let(:dsc_user) {"#{dsc_user_prefix}_usr_#{dsc_user_suffix}" }
- let(:dsc_user_prefix_env_var_name) { 'dsc_user_env_prefix' }
- let(:dsc_user_suffix_env_var_name) { 'dsc_user_env_suffix' }
+ let(:dsc_user_prefix_env_var_name) { "dsc_user_env_prefix" }
+ let(:dsc_user_suffix_env_var_name) { "dsc_user_env_suffix" }
let(:dsc_user_prefix_env_code) { "$env:#{dsc_user_prefix_env_var_name}"}
let(:dsc_user_suffix_env_code) { "$env:#{dsc_user_suffix_env_var_name}"}
- let(:dsc_user_prefix_param_name) { 'dsc_user_prefix_param' }
- let(:dsc_user_suffix_param_name) { 'dsc_user_suffix_param' }
+ let(:dsc_user_prefix_param_name) { "dsc_user_prefix_param" }
+ let(:dsc_user_suffix_param_name) { "dsc_user_suffix_param" }
let(:dsc_user_prefix_param_code) { "$#{dsc_user_prefix_param_name}"}
let(:dsc_user_suffix_param_code) { "$#{dsc_user_suffix_param_name}"}
let(:dsc_user_env_code) { "\"$(#{dsc_user_prefix_env_code})_usr_$(#{dsc_user_suffix_env_code})\""}
@@ -129,7 +129,7 @@ EOH
EOH
}
- let(:config_param_section) { '' }
+ let(:config_param_section) { "" }
let(:dsc_user_code) { "'#{dsc_user}'" }
let(:dsc_user_prefix_code) { dsc_user_prefix }
let(:dsc_user_suffix_code) { dsc_user_suffix }
@@ -170,10 +170,10 @@ EOH
EOH
}
- let(:dsc_environment_env_var_name) { 'dsc_test_cwd' }
+ let(:dsc_environment_env_var_name) { "dsc_test_cwd" }
let(:dsc_environment_no_fail_not_etc_directory) { "#{ENV['systemroot']}\\system32" }
let(:dsc_environment_fail_etc_directory) { "#{ENV['systemroot']}\\system32\\drivers\\etc" }
- let(:exception_message_signature) { 'LL927-LL928' }
+ let(:exception_message_signature) { "LL927-LL928" }
let(:dsc_environment_config) {<<-EOH
if (($pwd.path -eq '#{dsc_environment_fail_etc_directory}') -and (test-path('#{dsc_environment_fail_etc_directory}')))
{
@@ -214,19 +214,19 @@ EOH
test_key_resource.run_action(:delete_key)
end
- shared_examples_for 'a dsc_script resource with specified PowerShell configuration code' do
+ shared_examples_for "a dsc_script resource with specified PowerShell configuration code" do
let(:test_registry_data) { test_registry_data1 }
- it 'should create a registry key with a specific registry value and data' do
+ it "should create a registry key with a specific registry value and data" do
expect(dsc_test_resource.registry_key_exists?(test_registry_key)).to eq(false)
dsc_test_resource.run_action(:run)
expect(dsc_test_resource.registry_key_exists?(test_registry_key)).to eq(true)
expect(dsc_test_resource.registry_value_exists?(test_registry_key, {:name => test_registry_value, :type => :string, :data => test_registry_data})).to eq(true)
end
- it_should_behave_like 'a dsc_script resource with configuration affected by cwd'
+ it_should_behave_like "a dsc_script resource with configuration affected by cwd"
end
- shared_examples_for 'a dsc_script resource with configuration affected by cwd' do
+ shared_examples_for "a dsc_script resource with configuration affected by cwd" do
after(:each) do
removal_resource = Chef::Resource::DscScript.new(dsc_test_resource_name, dsc_test_run_context)
removal_resource.code <<-EOH
@@ -239,14 +239,14 @@ EOH
removal_resource.run_action(:run)
end
- describe 'when the DSC configuration contains code that raises an exception if cwd has a specific value' do
+ describe "when the DSC configuration contains code that raises an exception if cwd has a specific value" do
let(:dsc_code) { dsc_environment_config }
- it 'should not raise an exception if the cwd is not etc' do
+ it "should not raise an exception if the cwd is not etc" do
dsc_test_resource.cwd(dsc_environment_no_fail_not_etc_directory)
expect {dsc_test_resource.run_action(:run)}.not_to raise_error
end
- it 'should raise an exception if the cwd is etc' do
+ it "should raise an exception if the cwd is etc" do
dsc_test_resource.cwd(dsc_environment_fail_etc_directory)
expect {dsc_test_resource.run_action(:run)}.to raise_error(Chef::Exceptions::PowershellCmdletException)
begin
@@ -258,14 +258,14 @@ EOH
end
end
- shared_examples_for 'a parameterized DSC configuration script' do
+ shared_examples_for "a parameterized DSC configuration script" do
let(:dsc_user_prefix_code) { dsc_user_prefix_env_code }
let(:dsc_user_suffix_code) { dsc_user_suffix_env_code }
- it_behaves_like 'a dsc_script with configuration that uses environment variables'
+ it_behaves_like "a dsc_script with configuration that uses environment variables"
end
- shared_examples_for 'a dsc_script without configuration data that takes parameters' do
- context 'when configuration data is not specified' do
+ shared_examples_for "a dsc_script without configuration data that takes parameters" do
+ context "when configuration data is not specified" do
before(:each) do
test_key_resource = Chef::Resource::RegistryKey.new(test_registry_key, dsc_test_run_context)
@@ -282,19 +282,19 @@ EOH
let(:test_registry_data) { test_registry_data1 }
let(:dsc_parameterized_env_param_value) { "val" + Random::rand.to_s }
- it 'should have a default value of nil for the configuration_data attribute' do
+ it "should have a default value of nil for the configuration_data attribute" do
expect(dsc_test_resource.configuration_data).to eql(nil)
end
- it 'should have a default value of nil for the configuration_data_path attribute' do
+ it "should have a default value of nil for the configuration_data_path attribute" do
expect(dsc_test_resource.configuration_data_script).to eql(nil)
end
let(:dsc_test_resource) { dsc_resource_from_path }
- let(:registry_embedded_parameters) { '' }
+ let(:registry_embedded_parameters) { "" }
let(:dsc_code) { dsc_reg_script }
- it 'should set a registry key according to parameters passed to the configuration' do
+ it "should set a registry key according to parameters passed to the configuration" do
dsc_test_resource.configuration_name(config_name_value)
dsc_test_resource.flags({:"#{reg_key_name_param_name}" => test_registry_key, :"#{reg_key_value_param_name}" => test_registry_value})
expect(dsc_test_resource.registry_key_exists?(test_registry_key)).to eq(false)
@@ -305,20 +305,20 @@ EOH
end
end
- shared_examples_for 'a dsc_script with configuration data' do
- let(:configuration_data_attribute) { 'configuration_data' }
- it_behaves_like 'a dsc_script with configuration data set via an attribute'
+ shared_examples_for "a dsc_script with configuration data" do
+ let(:configuration_data_attribute) { "configuration_data" }
+ it_behaves_like "a dsc_script with configuration data set via an attribute"
- let(:configuration_data_attribute) { 'configuration_data_script' }
- it_behaves_like 'a dsc_script with configuration data set via an attribute'
+ let(:configuration_data_attribute) { "configuration_data_script" }
+ it_behaves_like "a dsc_script with configuration data set via an attribute"
end
- shared_examples_for 'a dsc_script with configuration data set via an attribute' do
- it 'should run a configuration script that creates a user' do
+ shared_examples_for "a dsc_script with configuration data set via an attribute" do
+ it "should run a configuration script that creates a user" do
config_data_value = dsc_user_config_data
dsc_test_resource.configuration_name(config_name_value)
- if configuration_data_attribute == 'configuration_data_script'
- config_data_value = create_config_script_from_code(dsc_user_config_data, '', true)
+ if configuration_data_attribute == "configuration_data_script"
+ config_data_value = create_config_script_from_code(dsc_user_config_data, "", true)
end
dsc_test_resource.environment({dsc_user_prefix_env_var_name => dsc_user_prefix,
dsc_user_suffix_env_var_name => dsc_user_suffix})
@@ -330,57 +330,57 @@ EOH
end
end
- shared_examples_for 'a dsc_script with configuration data that takes parameters' do
+ shared_examples_for "a dsc_script with configuration data that takes parameters" do
let(:dsc_user_code) { dsc_user_param_code }
let(:config_param_section) { config_params }
let(:config_flags) {{:"#{dsc_user_prefix_param_name}" => "#{dsc_user_prefix}", :"#{dsc_user_suffix_param_name}" => "#{dsc_user_suffix}"}}
- it 'does not directly contain the user name' do
+ it "does not directly contain the user name" do
configuration_script_content = ::File.open(dsc_test_resource.command) do | file |
file.read
end
expect(configuration_script_content.include?(dsc_user)).to be(false)
end
- it_behaves_like 'a dsc_script with configuration data'
+ it_behaves_like "a dsc_script with configuration data"
end
- shared_examples_for 'a dsc_script with configuration data that uses environment variables' do
+ shared_examples_for "a dsc_script with configuration data that uses environment variables" do
let(:dsc_user_code) { dsc_user_env_code }
- it 'does not directly contain the user name' do
+ it "does not directly contain the user name" do
configuration_script_content = ::File.open(dsc_test_resource.command) do | file |
file.read
end
expect(configuration_script_content.include?(dsc_user)).to be(false)
end
- it_behaves_like 'a dsc_script with configuration data'
+ it_behaves_like "a dsc_script with configuration data"
end
- context 'when supplying configuration through the configuration attribute' do
+ context "when supplying configuration through the configuration attribute" do
let(:dsc_test_resource) { dsc_resource_from_code }
- it_behaves_like 'a dsc_script resource with specified PowerShell configuration code'
+ it_behaves_like "a dsc_script resource with specified PowerShell configuration code"
end
- context 'when supplying configuration using the path attribute' do
+ context "when supplying configuration using the path attribute" do
let(:dsc_test_resource) { dsc_resource_from_path }
- it_behaves_like 'a dsc_script resource with specified PowerShell configuration code'
+ it_behaves_like "a dsc_script resource with specified PowerShell configuration code"
end
- context 'when running a configuration that manages users' do
+ context "when running a configuration that manages users" do
before(:each) do
delete_user(dsc_user)
end
let(:dsc_code) { dsc_user_resources_code }
- let(:config_name_value) { 'DSCTestConfig' }
+ let(:config_name_value) { "DSCTestConfig" }
let(:dsc_test_resource) { dsc_resource_from_path }
- it_behaves_like 'a dsc_script with configuration data'
- it_behaves_like 'a dsc_script with configuration data that uses environment variables'
- it_behaves_like 'a dsc_script with configuration data that takes parameters'
- it_behaves_like 'a dsc_script without configuration data that takes parameters'
+ it_behaves_like "a dsc_script with configuration data"
+ it_behaves_like "a dsc_script with configuration data that uses environment variables"
+ it_behaves_like "a dsc_script with configuration data that takes parameters"
+ it_behaves_like "a dsc_script without configuration data that takes parameters"
end
- context 'when using ps_credential' do
+ context "when using ps_credential" do
include IntegrationSupport
before(:each) do
@@ -393,7 +393,7 @@ EOH
let(:configuration_data_path) { 'C:\\configurationdata.psd1' }
let(:self_signed_cert_path) do
- File.join(CHEF_SPEC_DATA, 'dsc_lcm.pfx')
+ File.join(CHEF_SPEC_DATA, "dsc_lcm.pfx")
end
let(:dsc_configuration_script) do
@@ -440,7 +440,7 @@ $ConfigurationData | out-file '#{configuration_data_path}' -force
end
let(:powershell_script_resource) do
- Chef::Resource::PowershellScript.new('configure-lcm', dsc_test_run_context).tap do |r|
+ Chef::Resource::PowershellScript.new("configure-lcm", dsc_test_run_context).tap do |r|
r.code(dsc_configuration_script)
r.architecture(:x86_64)
end
@@ -460,7 +460,7 @@ EOF
end
end
- it 'allows the use of ps_credential' do
+ it "allows the use of ps_credential" do
expect(user_exists?(dsc_user)).to eq(false)
powershell_script_resource.run_action(:run)
expect(File).to exist(configuration_data_path)
diff --git a/spec/functional/resource/env_spec.rb b/spec/functional/resource/env_spec.rb
index b9dcd7b33a..60322e91a9 100755
--- a/spec/functional/resource/env_spec.rb
+++ b/spec/functional/resource/env_spec.rb
@@ -16,27 +16,27 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Env, :windows_only do
- context 'when running on Windows' do
- let(:chef_env_test_lower_case) { 'chefenvtest' }
- let(:chef_env_test_mixed_case) { 'chefENVtest' }
- let(:env_dne_key) { 'env_dne_key' }
- let(:env_value1) { 'value1' }
- let(:env_value2) { 'value2' }
-
- let(:env_value_expandable) { '%SystemRoot%' }
+ context "when running on Windows" do
+ let(:chef_env_test_lower_case) { "chefenvtest" }
+ let(:chef_env_test_mixed_case) { "chefENVtest" }
+ let(:env_dne_key) { "env_dne_key" }
+ let(:env_value1) { "value1" }
+ let(:env_value2) { "value2" }
+
+ let(:env_value_expandable) { "%SystemRoot%" }
let(:test_run_context) {
node = Chef::Node.new
- node.default['os'] = 'windows'
- node.default['platform'] = 'windows'
- node.default['platform_version'] = '6.1'
+ node.default["os"] = "windows"
+ node.default["platform"] = "windows"
+ node.default["platform_version"] = "6.1"
empty_events = Chef::EventDispatch::Dispatcher.new
Chef::RunContext.new(node, {}, empty_events)
}
let(:test_resource) {
- Chef::Resource::Env.new('unknown', test_run_context)
+ Chef::Resource::Env.new("unknown", test_run_context)
}
before(:each) do
@@ -47,7 +47,7 @@ describe Chef::Resource::Env, :windows_only do
end
context "when the create action is invoked" do
- it 'should create an environment variable for action create' do
+ it "should create an environment variable for action create" do
expect(ENV[chef_env_test_lower_case]).to eq(nil)
test_resource.key_name(chef_env_test_lower_case)
test_resource.value(env_value1)
@@ -76,7 +76,7 @@ describe Chef::Resource::Env, :windows_only do
expect(ENV[chef_env_test_lower_case]).to eq(env_value2)
end
- it 'should not expand environment variables if the variable is not PATH' do
+ it "should not expand environment variables if the variable is not PATH" do
expect(ENV[chef_env_test_lower_case]).to eq(nil)
test_resource.key_name(chef_env_test_lower_case)
test_resource.value(env_value_expandable)
@@ -115,7 +115,7 @@ describe Chef::Resource::Env, :windows_only do
expect(ENV[chef_env_test_lower_case]).to eq(env_value2)
end
- it 'should not expand environment variables if the variable is not PATH' do
+ it "should not expand environment variables if the variable is not PATH" do
test_resource.key_name(chef_env_test_lower_case)
test_resource.value(env_value1)
test_resource.run_action(:create)
@@ -125,27 +125,27 @@ describe Chef::Resource::Env, :windows_only do
expect(ENV[chef_env_test_lower_case]).to eq(env_value_expandable)
end
- context 'when using PATH' do
+ context "when using PATH" do
let(:random_name) { Time.now.to_i }
let(:env_val) { "#{env_value_expandable}_#{random_name}"}
- let!(:path_before) { test_resource.provider_for_action(test_resource.action).env_value('PATH') || '' }
- let!(:env_path_before) { ENV['PATH'] }
+ let!(:path_before) { test_resource.provider_for_action(test_resource.action).env_value("PATH") || "" }
+ let!(:env_path_before) { ENV["PATH"] }
- it 'should expand PATH' do
+ it "should expand PATH" do
expect(path_before).not_to include(env_val)
- test_resource.key_name('PATH')
+ test_resource.key_name("PATH")
test_resource.value("#{path_before};#{env_val}")
test_resource.run_action(:create)
- expect(ENV['PATH']).not_to include(env_val)
- expect(ENV['PATH']).to include("#{random_name}")
+ expect(ENV["PATH"]).not_to include(env_val)
+ expect(ENV["PATH"]).to include("#{random_name}")
end
after(:each) do
# cleanup so we don't flood the path
- test_resource.key_name('PATH')
+ test_resource.key_name("PATH")
test_resource.value(path_before)
test_resource.run_action(:create)
- ENV['PATH'] = env_path_before
+ ENV["PATH"] = env_path_before
end
end
diff --git a/spec/functional/resource/execute_spec.rb b/spec/functional/resource/execute_spec.rb
index 9369a8050d..74daf75b08 100644
--- a/spec/functional/resource/execute_spec.rb
+++ b/spec/functional/resource/execute_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'timeout'
+require "spec_helper"
+require "functional/resource/base"
+require "timeout"
describe Chef::Resource::Execute do
let(:resource) {
@@ -106,7 +106,7 @@ describe Chef::Resource::Execute do
it "guard adds additional values in its :environment and runs" do
resource.only_if %{ruby -e 'exit 1 if ENV["SGCE_SECRET"] != "regularsecret"'}, {
- :environment => { 'SGCE_SECRET' => "regularsecret" }
+ :environment => { "SGCE_SECRET" => "regularsecret" }
}
resource.run_action(:run)
expect(resource).to be_updated_by_last_action
@@ -114,7 +114,7 @@ describe Chef::Resource::Execute do
it "guard adds additional values in its :environment and does not run" do
resource.only_if %{ruby -e 'exit 1 if ENV["SGCE_SECRET"] == "regularsecret"'}, {
- :environment => { 'SGCE_SECRET' => "regularsecret" }
+ :environment => { "SGCE_SECRET" => "regularsecret" }
}
resource.run_action(:run)
expect(resource).not_to be_updated_by_last_action
@@ -122,7 +122,7 @@ describe Chef::Resource::Execute do
it "guard overwrites value with its :environment and runs" do
resource.only_if %{ruby -e 'exit 1 if ENV["SAWS_SECRET"] != "regularsecret"'}, {
- :environment => { 'SAWS_SECRET' => "regularsecret" }
+ :environment => { "SAWS_SECRET" => "regularsecret" }
}
resource.run_action(:run)
expect(resource).to be_updated_by_last_action
@@ -130,7 +130,7 @@ describe Chef::Resource::Execute do
it "guard overwrites value with its :environment and does not runs" do
resource.only_if %{ruby -e 'exit 1 if ENV["SAWS_SECRET"] == "regularsecret"'}, {
- :environment => { 'SAWS_SECRET' => "regularsecret" }
+ :environment => { "SAWS_SECRET" => "regularsecret" }
}
resource.run_action(:run)
expect(resource).not_to be_updated_by_last_action
diff --git a/spec/functional/resource/file_spec.rb b/spec/functional/resource/file_spec.rb
index 861bc65363..7ddd487e2a 100644
--- a/spec/functional/resource/file_spec.rb
+++ b/spec/functional/resource/file_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tmpdir'
+require "spec_helper"
+require "tmpdir"
describe Chef::Resource::File do
include_context Chef::Resource::File
@@ -102,9 +102,9 @@ describe Chef::Resource::File do
end
it "only stores the number of requested backups" do
- resource_without_content.content('foo')
+ resource_without_content.content("foo")
resource_without_content.run_action(:create)
- resource_without_content.content('bar')
+ resource_without_content.content("bar")
resource_without_content.run_action(:create)
expect(Dir.glob(backup_glob).length).to eq(1)
end
diff --git a/spec/functional/resource/git_spec.rb b/spec/functional/resource/git_spec.rb
index 9d3b82f19e..35da2506e5 100644
--- a/spec/functional/resource/git_spec.rb
+++ b/spec/functional/resource/git_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/shell_out'
-require 'tmpdir'
-require 'shellwords'
+require "spec_helper"
+require "chef/mixin/shell_out"
+require "tmpdir"
+require "shellwords"
# Deploy relies heavily on symlinks, so it doesn't work on windows.
describe Chef::Resource::Git do
@@ -129,10 +129,10 @@ E
it "checks out the revision pointed to by the tag commit, not the tag commit itself" do
basic_git_resource.run_action(:sync)
- head_rev = shell_out!('git rev-parse HEAD', :cwd => deploy_directory, :returns => [0]).stdout.strip
+ head_rev = shell_out!("git rev-parse HEAD", :cwd => deploy_directory, :returns => [0]).stdout.strip
expect(head_rev).to eq(v1_commit)
# also verify the tag commit itself is what we expect as an extra sanity check
- rev = shell_out!('git rev-parse v1.0.0', :cwd => deploy_directory, :returns => [0]).stdout.strip
+ rev = shell_out!("git rev-parse v1.0.0", :cwd => deploy_directory, :returns => [0]).stdout.strip
expect(rev).to eq(v1_tag)
end
@@ -140,7 +140,7 @@ E
# this used to fail because we didn't resolve the annotated tag
# properly to the pointed to commit.
basic_git_resource.run_action(:sync)
- head_rev = shell_out!('git rev-parse HEAD', :cwd => deploy_directory, :returns => [0]).stdout.strip
+ head_rev = shell_out!("git rev-parse HEAD", :cwd => deploy_directory, :returns => [0]).stdout.strip
expect(head_rev).to eq(v1_commit)
copy_git_resource.run_action(:sync)
@@ -166,14 +166,14 @@ E
it "checks out the expected revision ed18" do
basic_git_resource.revision rev_foo
basic_git_resource.run_action(:sync)
- head_rev = shell_out!('git rev-parse HEAD', :cwd => deploy_directory, :returns => [0]).stdout.strip
+ head_rev = shell_out!("git rev-parse HEAD", :cwd => deploy_directory, :returns => [0]).stdout.strip
expect(head_rev).to eq(rev_foo)
end
it "doesn't update if up-to-date" do
basic_git_resource.revision rev_foo
basic_git_resource.run_action(:sync)
- head_rev = shell_out!('git rev-parse HEAD', :cwd => deploy_directory, :returns => [0]).stdout.strip
+ head_rev = shell_out!("git rev-parse HEAD", :cwd => deploy_directory, :returns => [0]).stdout.strip
expect(head_rev).to eq(rev_foo)
copy_git_resource.revision rev_foo
@@ -184,7 +184,7 @@ E
it "checks out the expected revision 972d" do
basic_git_resource.revision rev_testing
basic_git_resource.run_action(:sync)
- head_rev = shell_out!('git rev-parse HEAD', :cwd => deploy_directory, :returns => [0]).stdout.strip
+ head_rev = shell_out!("git rev-parse HEAD", :cwd => deploy_directory, :returns => [0]).stdout.strip
expect(head_rev).to eq(rev_testing)
end
end
@@ -193,13 +193,13 @@ E
let(:basic_git_resource) do
Chef::Resource::Git.new(deploy_directory, run_context).tap do |r|
r.repository origin_repo
- r.revision 'HEAD'
+ r.revision "HEAD"
end
end
it "checks out the expected revision" do
basic_git_resource.run_action(:sync)
- head_rev = shell_out!('git rev-parse HEAD', :cwd => deploy_directory, :returns => [0]).stdout.strip
+ head_rev = shell_out!("git rev-parse HEAD", :cwd => deploy_directory, :returns => [0]).stdout.strip
expect(head_rev).to eq(rev_head)
end
end
@@ -214,7 +214,7 @@ E
it "checks out HEAD as the default revision" do
basic_git_resource.run_action(:sync)
- head_rev = shell_out!('git rev-parse HEAD', :cwd => deploy_directory, :returns => [0]).stdout.strip
+ head_rev = shell_out!("git rev-parse HEAD", :cwd => deploy_directory, :returns => [0]).stdout.strip
expect(head_rev).to eq(rev_head)
end
end
@@ -228,7 +228,7 @@ E
let(:basic_git_resource) do
Chef::Resource::Git.new(deploy_directory, run_context).tap do |r|
r.repository origin_repo
- r.revision 'HEAD'
+ r.revision "HEAD"
end
end
@@ -241,7 +241,7 @@ E
it "checks out the (master) HEAD revision and ignores the tag" do
basic_git_resource.run_action(:sync)
- head_rev = shell_out!('git rev-parse HEAD',
+ head_rev = shell_out!("git rev-parse HEAD",
:cwd => deploy_directory,
:returns => [0]).stdout.strip
expect(head_rev).to eq(rev_head)
@@ -249,7 +249,7 @@ E
it "checks out the (master) HEAD revision when no revision is specified (ignores tag)" do
git_resource_default_rev.run_action(:sync)
- head_rev = shell_out!('git rev-parse HEAD',
+ head_rev = shell_out!("git rev-parse HEAD",
:cwd => deploy_directory,
:returns => [0]).stdout.strip
expect(head_rev).to eq(rev_head)
diff --git a/spec/functional/resource/group_spec.rb b/spec/functional/resource/group_spec.rb
index 0862b8e15f..418dad431d 100644
--- a/spec/functional/resource/group_spec.rb
+++ b/spec/functional/resource/group_spec.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "functional/resource/base"
+require "chef/mixin/shell_out"
# Chef::Resource::Group are turned off on Mac OS X 10.6 due to caching
# issues around Etc.getgrnam() not picking up the group membership
@@ -79,8 +79,8 @@ describe Chef::Resource::Group, :requires_root_or_running_windows, :not_supporte
def windows_domain_user?(user_name)
domain, user = user_name.split('\\')
- if user && domain != '.'
- computer_name = ENV['computername']
+ if user && domain != "."
+ computer_name = ENV["computername"]
domain.downcase != computer_name.downcase
end
end
@@ -378,7 +378,7 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" }
describe "when running on Windows", :windows_only do
describe "when members are Active Directory domain identities", :windows_domain_joined_only do
- let(:computer_domain) { ohai[:kernel]['cs_info']['domain'].split('.')[0] }
+ let(:computer_domain) { ohai[:kernel]["cs_info"]["domain"].split(".")[0] }
let(:spec_members){ ["#{computer_domain}\\Domain Admins", "#{computer_domain}\\Domain Users", "#{computer_domain}\\Domain Computers"] }
include_examples "correct group management"
@@ -415,7 +415,7 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" }
describe "running on windows", :windows_only do
describe "when members are Windows domain identities", :windows_domain_joined_only do
- let(:computer_domain) { ohai[:kernel]['cs_info']['domain'].split('.')[0] }
+ let(:computer_domain) { ohai[:kernel]["cs_info"]["domain"].split(".")[0] }
let(:spec_members){ ["#{computer_domain}\\Domain Admins", "#{computer_domain}\\Domain Users", "#{computer_domain}\\Domain Computers"] }
include_examples "correct group management"
diff --git a/spec/functional/resource/ifconfig_spec.rb b/spec/functional/resource/ifconfig_spec.rb
index 4733b05f35..6b40fbc2e2 100644
--- a/spec/functional/resource/ifconfig_spec.rb
+++ b/spec/functional/resource/ifconfig_spec.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
+require "functional/resource/base"
+require "chef/mixin/shell_out"
# run this test only for following platforms.
-include_flag = !(['ubuntu', 'centos', 'aix'].include?(ohai[:platform]))
+include_flag = !(["ubuntu", "centos", "aix"].include?(ohai[:platform]))
describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => include_flag do
# This test does not work in travis because there is no eth0
@@ -28,7 +28,7 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in
include Chef::Mixin::ShellOut
let(:new_resource) do
- new_resource = Chef::Resource::Ifconfig.new('10.10.0.1', run_context)
+ new_resource = Chef::Resource::Ifconfig.new("10.10.0.1", run_context)
new_resource
end
@@ -45,9 +45,9 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in
# use loopback interface for tests
case ohai[:platform]
when "aix"
- 'lo0'
+ "lo0"
else
- 'lo'
+ "lo"
end
end
@@ -55,9 +55,9 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in
def en0_interface_for_test
case ohai[:platform]
when "aix"
- 'en0'
+ "en0"
else
- 'eth0'
+ "eth0"
end
end
@@ -107,14 +107,14 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in
# Actual tests
describe "#load_current_resource" do
- it 'should load given interface' do
+ it "should load given interface" do
new_resource.device lo_interface_for_test
expect(current_resource.device).to eql(lo_interface_for_test)
expect(current_resource.inet_addr).to match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)
end
end
- exclude_test = ohai[:platform] != 'ubuntu'
+ exclude_test = ohai[:platform] != "ubuntu"
describe "#action_add", :external => exclude_test do
after do
new_resource.run_action(:delete)
diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb
index 6b214f0b16..4840713667 100644
--- a/spec/functional/resource/link_spec.rb
+++ b/spec/functional/resource/link_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if 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 do
@@ -31,7 +31,7 @@ describe Chef::Resource::Link do
# different file deployment strategies more completely.
let(:test_file_dir) do
if windows?
- File.join(ENV['systemdrive'], "test-dir")
+ File.join(ENV["systemdrive"], "test-dir")
else
File.join(CHEF_SPEC_DATA, "test-dir")
end
@@ -73,7 +73,7 @@ describe Chef::Resource::Link do
end
def canonicalize(path)
- windows? ? path.gsub('/', '\\') : path
+ windows? ? path.gsub("/", '\\') : path
end
def symlink(a, b)
@@ -121,142 +121,142 @@ describe Chef::Resource::Link do
end
describe "when supported on platform", :not_supported_on_win2k3 do
- shared_examples_for 'delete errors out' do
- it 'delete errors out' do
+ shared_examples_for "delete errors out" do
+ it "delete errors out" do
expect { resource.run_action(:delete) }.to raise_error(Chef::Exceptions::Link)
expect(File.exist?(target_file) || symlink?(target_file)).to be_truthy
end
end
- shared_context 'delete is noop' do
- describe 'the :delete action' do
+ shared_context "delete is noop" do
+ describe "the :delete action" do
before(:each) do
@info = []
allow(Chef::Log).to receive(:info) { |msg| @info << msg }
resource.run_action(:delete)
end
- it 'leaves the file deleted' do
+ it "leaves the file deleted" do
expect(File.exist?(target_file)).to be_falsey
expect(symlink?(target_file)).to be_falsey
end
- it 'does not mark the resource updated' do
+ it "does not mark the resource updated" do
expect(resource).not_to be_updated
end
- it 'does not log that it deleted' do
+ it "does not log that it deleted" do
expect(@info.include?("link[#{target_file}] deleted")).to be_falsey
end
end
end
- shared_context 'delete succeeds' do
- describe 'the :delete action' do
+ shared_context "delete succeeds" do
+ describe "the :delete action" do
before(:each) do
@info = []
allow(Chef::Log).to receive(:info) { |msg| @info << msg }
resource.run_action(:delete)
end
- it 'deletes the file' do
+ it "deletes the file" do
expect(File.exist?(target_file)).to be_falsey
expect(symlink?(target_file)).to be_falsey
end
- it 'marks the resource updated' do
+ it "marks the resource updated" do
expect(resource).to be_updated
end
- it 'logs that it deleted' do
+ it "logs that it deleted" do
expect(@info.include?("link[#{target_file}] deleted")).to be_truthy
end
end
end
- shared_context 'create symbolic link succeeds' do
- describe 'the :create action' do
+ shared_context "create symbolic link succeeds" do
+ describe "the :create action" do
before(:each) do
@info = []
allow(Chef::Log).to receive(:info) { |msg| @info << msg }
resource.run_action(:create)
end
- it 'links to the target file' do
+ it "links to the target file" do
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(to))
end
- it 'marks the resource updated' do
+ it "marks the resource updated" do
expect(resource).to be_updated
end
- it 'logs that it created' do
+ it "logs that it created" do
expect(@info.include?("link[#{target_file}] created")).to be_truthy
end
end
end
- shared_context 'create symbolic link is noop' do
- describe 'the :create action' do
+ shared_context "create symbolic link is noop" do
+ describe "the :create action" do
before(:each) do
@info = []
allow(Chef::Log).to receive(:info) { |msg| @info << msg }
resource.run_action(:create)
end
- it 'leaves the file linked' do
+ it "leaves the file linked" do
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(to))
end
- it 'does not mark the resource updated' do
+ it "does not mark the resource updated" do
expect(resource).not_to be_updated
end
- it 'does not log that it created' do
+ it "does not log that it created" do
expect(@info.include?("link[#{target_file}] created")).to be_falsey
end
end
end
- shared_context 'create hard link succeeds' do
- describe 'the :create action' do
+ shared_context "create hard link succeeds" do
+ describe "the :create action" do
before(:each) do
@info = []
allow(Chef::Log).to receive(:info) { |msg| @info << msg }
resource.run_action(:create)
end
- it 'preserves the hard link' do
+ it "preserves the hard link" do
expect(File.exists?(target_file)).to be_truthy
expect(symlink?(target_file)).to be_falsey
# Writing to one hardlinked file should cause both
# to have the new value.
expect(IO.read(to)).to eq(IO.read(target_file))
- File.open(to, "w") { |file| file.write('wowzers') }
- expect(IO.read(target_file)).to eq('wowzers')
+ File.open(to, "w") { |file| file.write("wowzers") }
+ expect(IO.read(target_file)).to eq("wowzers")
end
- it 'marks the resource updated' do
+ it "marks the resource updated" do
expect(resource).to be_updated
end
- it 'logs that it created' do
+ it "logs that it created" do
expect(@info.include?("link[#{target_file}] created")).to be_truthy
end
end
end
- shared_context 'create hard link is noop' do
- describe 'the :create action' do
+ shared_context "create hard link is noop" do
+ describe "the :create action" do
before(:each) do
@info = []
allow(Chef::Log).to receive(:info) { |msg| @info << msg }
resource.run_action(:create)
end
- it 'links to the target file' do
+ it "links to the target file" do
expect(File.exists?(target_file)).to be_truthy
expect(symlink?(target_file)).to be_falsey
# Writing to one hardlinked file should cause both
# to have the new value.
expect(IO.read(to)).to eq(IO.read(target_file))
- File.open(to, "w") { |file| file.write('wowzers') }
- expect(IO.read(target_file)).to eq('wowzers')
+ File.open(to, "w") { |file| file.write("wowzers") }
+ expect(IO.read(target_file)).to eq("wowzers")
end
- it 'does not mark the resource updated' do
+ it "does not mark the resource updated" do
expect(resource).not_to be_updated
end
- it 'does not log that it created' do
+ it "does not log that it created" do
expect(@info.include?("link[#{target_file}] created")).to be_falsey
end
end
@@ -264,34 +264,34 @@ describe Chef::Resource::Link do
context "is symbolic" do
- context 'when the link destination is a file' do
+ context "when the link destination is a file" do
before(:each) do
File.open(to, "w") do |file|
- file.write('woohoo')
+ file.write("woohoo")
end
end
- context 'and the link does not yet exist' do
- include_context 'create symbolic link succeeds'
- include_context 'delete is noop'
+ context "and the link does not yet exist" do
+ include_context "create symbolic link succeeds"
+ include_context "delete is noop"
end
- context 'and the link already exists and is a symbolic link' do
- context 'pointing at the target' do
+ context "and the link already exists and is a symbolic link" do
+ context "pointing at the target" do
before(:each) do
symlink(to, target_file)
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(to))
end
- include_context 'create symbolic link is noop'
- include_context 'delete succeeds'
- it 'the :delete action does not delete the target file' do
+ include_context "create symbolic link is noop"
+ include_context "delete succeeds"
+ it "the :delete action does not delete the target file" do
resource.run_action(:delete)
expect(File.exists?(to)).to be_truthy
end
end
- context 'pointing somewhere else' do
+ context "pointing somewhere else" do
before(:each) do
- @other_target = File.join(test_file_dir, make_tmpname('other_spec'))
- File.open(@other_target, 'w') { |file| file.write('eek') }
+ @other_target = File.join(test_file_dir, make_tmpname("other_spec"))
+ File.open(@other_target, "w") { |file| file.write("eek") }
symlink(@other_target, target_file)
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(@other_target))
@@ -299,45 +299,45 @@ describe Chef::Resource::Link do
after(:each) do
File.delete(@other_target)
end
- include_context 'create symbolic link succeeds'
- include_context 'delete succeeds'
- it 'the :delete action does not delete the target file' do
+ include_context "create symbolic link succeeds"
+ include_context "delete succeeds"
+ it "the :delete action does not delete the target file" do
resource.run_action(:delete)
expect(File.exists?(to)).to be_truthy
end
end
- context 'pointing nowhere' do
+ context "pointing nowhere" do
before(:each) do
- nonexistent = File.join(test_file_dir, make_tmpname('nonexistent_spec'))
+ nonexistent = File.join(test_file_dir, make_tmpname("nonexistent_spec"))
symlink(nonexistent, target_file)
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(nonexistent))
end
- include_context 'create symbolic link succeeds'
- include_context 'delete succeeds'
+ include_context "create symbolic link succeeds"
+ include_context "delete succeeds"
end
end
- context 'and the link already exists and is a hard link to the file' do
+ context "and the link already exists and is a hard link to the file" do
before(:each) do
link(to, target_file)
expect(File.exists?(target_file)).to be_truthy
expect(symlink?(target_file)).to be_falsey
end
- include_context 'create symbolic link succeeds'
- it_behaves_like 'delete errors out'
+ include_context "create symbolic link succeeds"
+ it_behaves_like "delete errors out"
end
- context 'and the link already exists and is a file' do
+ context "and the link already exists and is a file" do
before(:each) do
- File.open(target_file, 'w') { |file| file.write('eek') }
+ File.open(target_file, "w") { |file| file.write("eek") }
end
- include_context 'create symbolic link succeeds'
- it_behaves_like 'delete errors out'
+ include_context "create symbolic link succeeds"
+ it_behaves_like "delete errors out"
end
- context 'and the link already exists and is a directory' do
+ context "and the link already exists and is a directory" do
before(:each) do
Dir.mkdir(target_file)
end
- it 'create errors out' do
+ it "create errors out" do
if windows?
expect { resource.run_action(:create) }.to raise_error(Errno::EACCES)
elsif os_x? or solaris? or freebsd? or aix?
@@ -346,10 +346,10 @@ describe Chef::Resource::Link do
expect { resource.run_action(:create) }.to raise_error(Errno::EISDIR)
end
end
- it_behaves_like 'delete errors out'
+ it_behaves_like "delete errors out"
end
- it_behaves_like 'a securable resource without existing target' do
+ it_behaves_like "a securable resource without existing target" do
let(:path) { target_file }
def allowed_acl(sid, expected_perms)
[ ACE.access_allowed(sid, expected_perms[:specific]) ]
@@ -366,27 +366,27 @@ describe Chef::Resource::Link do
end
end
end
- context 'when the link destination is a directory' do
+ context "when the link destination is a directory" do
before(:each) do
Dir.mkdir(to)
end
# On Windows, readlink fails to open the link. FILE_FLAG_OPEN_REPARSE_POINT
# might help, from http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx
- context 'and the link does not yet exist' do
- include_context 'create symbolic link succeeds'
- include_context 'delete is noop'
+ context "and the link does not yet exist" do
+ include_context "create symbolic link succeeds"
+ include_context "delete is noop"
end
- context 'and the link already exists and points to a different directory' do
+ context "and the link already exists and points to a different directory" do
before(:each) do
other_dir = File.join(test_file_dir, make_tmpname("other_dir"))
Dir.mkdir(other_dir)
symlink(other_dir, target_file)
end
- include_context 'create symbolic link succeeds'
+ include_context "create symbolic link succeeds"
end
end
context "when the link destination is a symbolic link" do
- context 'to a file that exists' do
+ context "to a file that exists" do
before(:each) do
@other_target = File.join(test_file_dir, make_tmpname("other_spec"))
File.open(@other_target, "w") { |file| file.write("eek") }
@@ -397,32 +397,32 @@ describe Chef::Resource::Link do
after(:each) do
File.delete(@other_target)
end
- context 'and the link does not yet exist' do
- include_context 'create symbolic link succeeds'
- include_context 'delete is noop'
+ context "and the link does not yet exist" do
+ include_context "create symbolic link succeeds"
+ include_context "delete is noop"
end
end
- context 'to a file that does not exist' do
+ context "to a file that does not exist" do
before(:each) do
@other_target = File.join(test_file_dir, make_tmpname("other_spec"))
symlink(@other_target, to)
expect(symlink?(to)).to be_truthy
expect(readlink(to)).to eq(canonicalize(@other_target))
end
- context 'and the link does not yet exist' do
- include_context 'create symbolic link succeeds'
- include_context 'delete is noop'
+ context "and the link does not yet exist" do
+ include_context "create symbolic link succeeds"
+ include_context "delete is noop"
end
end
end
context "when the link destination does not exist" do
- include_context 'create symbolic link succeeds'
- include_context 'delete is noop'
+ include_context "create symbolic link succeeds"
+ include_context "delete is noop"
end
{
- '../' => 'with a relative link destination',
- '' => 'with a bare filename for the link destination',
+ "../" => "with a relative link destination",
+ "" => "with a bare filename for the link destination",
}.each do |prefix, desc|
context desc do
let(:to) { "#{prefix}#{File.basename(absolute_to)}" }
@@ -430,27 +430,27 @@ describe Chef::Resource::Link do
before(:each) do
resource.to(to)
end
- context 'when the link does not yet exist' do
- include_context 'create symbolic link succeeds'
- include_context 'delete is noop'
+ context "when the link does not yet exist" do
+ include_context "create symbolic link succeeds"
+ include_context "delete is noop"
end
- context 'when the link already exists and points at the target' do
+ context "when the link already exists and points at the target" do
before(:each) do
symlink(to, target_file)
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(to))
end
- include_context 'create symbolic link is noop'
- include_context 'delete succeeds'
+ include_context "create symbolic link is noop"
+ include_context "delete succeeds"
end
- context 'when the link already exists and points at the target with an absolute path' do
+ context "when the link already exists and points at the target with an absolute path" do
before(:each) do
symlink(absolute_to, target_file)
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(absolute_to))
end
- include_context 'create symbolic link succeeds'
- include_context 'delete succeeds'
+ include_context "create symbolic link succeeds"
+ include_context "delete succeeds"
end
end
end
@@ -464,12 +464,12 @@ describe Chef::Resource::Link do
context "when the link destination is a file" do
before(:each) do
File.open(to, "w") do |file|
- file.write('woohoo')
+ file.write("woohoo")
end
end
context "and the link does not yet exist" do
- include_context 'create hard link succeeds'
- include_context 'delete is noop'
+ include_context "create hard link succeeds"
+ include_context "delete is noop"
end
context "and the link already exists and is a symbolic link pointing at the same file" do
before(:each) do
@@ -477,34 +477,34 @@ describe Chef::Resource::Link do
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(to))
end
- include_context 'create hard link succeeds'
- it_behaves_like 'delete errors out'
+ include_context "create hard link succeeds"
+ it_behaves_like "delete errors out"
end
- context 'and the link already exists and is a hard link to the file' do
+ context "and the link already exists and is a hard link to the file" do
before(:each) do
link(to, target_file)
expect(File.exists?(target_file)).to be_truthy
expect(symlink?(target_file)).to be_falsey
end
- include_context 'create hard link is noop'
- include_context 'delete succeeds'
- it 'the :delete action does not delete the target file' do
+ include_context "create hard link is noop"
+ include_context "delete succeeds"
+ it "the :delete action does not delete the target file" do
resource.run_action(:delete)
expect(File.exists?(to)).to be_truthy
end
end
context "and the link already exists and is a file" do
before(:each) do
- File.open(target_file, 'w') { |file| file.write('tomfoolery') }
+ File.open(target_file, "w") { |file| file.write("tomfoolery") }
end
- include_context 'create hard link succeeds'
- it_behaves_like 'delete errors out'
+ include_context "create hard link succeeds"
+ it_behaves_like "delete errors out"
end
context "and the link already exists and is a directory" do
before(:each) do
Dir.mkdir(target_file)
end
- it 'errors out' do
+ it "errors out" do
if windows?
expect { resource.run_action(:create) }.to raise_error(Errno::EACCES)
elsif os_x? or solaris? or freebsd? or aix?
@@ -513,18 +513,18 @@ describe Chef::Resource::Link do
expect { resource.run_action(:create) }.to raise_error(Errno::EISDIR)
end
end
- it_behaves_like 'delete errors out'
+ it_behaves_like "delete errors out"
end
context "and specifies security attributes" do
before(:each) do
- resource.owner(windows? ? 'Guest' : 'nobody')
+ resource.owner(windows? ? "Guest" : "nobody")
end
- it 'ignores them' do
+ it "ignores them" do
resource.run_action(:create)
if windows?
expect(Chef::ReservedNames::Win32::Security.get_named_security_info(target_file).owner).not_to eq(SID.Guest)
else
- expect(File.lstat(target_file).uid).not_to eq(Etc.getpwnam('nobody').uid)
+ expect(File.lstat(target_file).uid).not_to eq(Etc.getpwnam("nobody").uid)
end
end
end
@@ -533,15 +533,15 @@ describe Chef::Resource::Link do
before(:each) do
Dir.mkdir(to)
end
- context 'and the link does not yet exist' do
- it 'create errors out' do
+ context "and the link does not yet exist" do
+ it "create errors out" do
expect { resource.run_action(:create) }.to raise_error(windows? ? Chef::Exceptions::Win32APIError : Errno::EPERM)
end
- include_context 'delete is noop'
+ include_context "delete is noop"
end
end
context "when the link destination is a symbolic link" do
- context 'to a real file' do
+ context "to a real file" do
before(:each) do
@other_target = File.join(test_file_dir, make_tmpname("other_spec"))
File.open(@other_target, "w") { |file| file.write("eek") }
@@ -552,28 +552,28 @@ describe Chef::Resource::Link do
after(:each) do
File.delete(@other_target)
end
- context 'and the link does not yet exist' do
- it 'links to the target file' do
- skip('OS X/FreeBSD/AIX symlink? and readlink working on hard links to symlinks') if (os_x? or freebsd? or aix?)
+ context "and the link does not yet exist" do
+ it "links to the target file" do
+ skip("OS X/FreeBSD/AIX symlink? and readlink working on hard links to symlinks") if (os_x? or freebsd? or aix?)
resource.run_action(:create)
expect(File.exists?(target_file)).to be_truthy
# OS X gets angry about this sort of link. Bug in OS X, IMO.
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(@other_target))
end
- include_context 'delete is noop'
+ include_context "delete is noop"
end
end
- context 'to a nonexistent file' do
+ context "to a nonexistent file" do
before(:each) do
@other_target = File.join(test_file_dir, make_tmpname("other_spec"))
symlink(@other_target, to)
expect(symlink?(to)).to be_truthy
expect(readlink(to)).to eq(canonicalize(@other_target))
end
- context 'and the link does not yet exist' do
- it 'links to the target file' do
- skip('OS X/FreeBSD/AIX fails to create hardlinks to broken symlinks') if (os_x? or freebsd? or aix?)
+ context "and the link does not yet exist" do
+ it "links to the target file" do
+ skip("OS X/FreeBSD/AIX fails to create hardlinks to broken symlinks") if (os_x? or freebsd? or aix?)
resource.run_action(:create)
# Windows and Unix have different definitions of exists? here, and that's OK.
if windows?
@@ -584,17 +584,17 @@ describe Chef::Resource::Link do
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(@other_target))
end
- include_context 'delete is noop'
+ include_context "delete is noop"
end
end
end
context "when the link destination does not exist" do
- context 'and the link does not yet exist' do
- it 'create errors out' do
+ context "and the link does not yet exist" do
+ it "create errors out" do
expect { resource.run_action(:create) }.to raise_error(Errno::ENOENT)
end
- include_context 'delete is noop'
+ include_context "delete is noop"
end
end
end
diff --git a/spec/functional/resource/mount_spec.rb b/spec/functional/resource/mount_spec.rb
index 4e9e8c3bdc..7f919439c9 100644
--- a/spec/functional/resource/mount_spec.rb
+++ b/spec/functional/resource/mount_spec.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
-require 'tmpdir'
+require "spec_helper"
+require "functional/resource/base"
+require "chef/mixin/shell_out"
+require "tmpdir"
# run this test only for following platforms.
-include_flag = !(['ubuntu', 'centos', 'aix', 'solaris2'].include?(ohai[:platform]))
+include_flag = !(["ubuntu", "centos", "aix", "solaris2"].include?(ohai[:platform]))
describe Chef::Resource::Mount, :requires_root, :skip_travis, :external => include_flag do
# Disabled in travis because it refuses to let us mount a ramdisk. /dev/ramX does not
@@ -79,9 +79,9 @@ describe Chef::Resource::Mount, :requires_root, :skip_travis, :external => inclu
def unix_mount_config_file
case ohai[:platform]
- when 'aix'
+ when "aix"
mount_config = "/etc/filesystems"
- when 'solaris2'
+ when "solaris2"
mount_config = "/etc/vfstab"
else
mount_config = "/etc/fstab"
@@ -90,7 +90,7 @@ describe Chef::Resource::Mount, :requires_root, :skip_travis, :external => inclu
def mount_should_be_enabled(mount_point, device)
case ohai[:platform]
- when 'aix'
+ when "aix"
expect(shell_out("cat #{unix_mount_config_file} | grep \"#{mount_point}:\" ").exitstatus).to eq(0)
else
expect(shell_out("cat #{unix_mount_config_file} | grep \"#{mount_point}\" | grep \"#{device}\" ").exitstatus).to eq(0)
@@ -106,7 +106,7 @@ describe Chef::Resource::Mount, :requires_root, :skip_travis, :external => inclu
new_resource.device @device
new_resource.name @mount_point
new_resource.fstype @fstype
- new_resource.options "log=NULL" if ohai[:platform] == 'aix'
+ new_resource.options "log=NULL" if ohai[:platform] == "aix"
new_resource
end
@@ -163,10 +163,10 @@ describe Chef::Resource::Mount, :requires_root, :skip_travis, :external => inclu
mount_should_exist(new_resource.mount_point, new_resource.device)
new_resource.supports[:remount] = true
- new_resource.options "rw" if ohai[:platform] == 'aix'
+ new_resource.options "rw" if ohai[:platform] == "aix"
new_resource.run_action(:remount)
- mount_should_exist(new_resource.mount_point, new_resource.device, nil, (ohai[:platform] == 'aix') ? new_resource.options : nil)
+ mount_should_exist(new_resource.mount_point, new_resource.device, nil, (ohai[:platform] == "aix") ? new_resource.options : nil)
end
end
diff --git a/spec/functional/resource/ohai_spec.rb b/spec/functional/resource/ohai_spec.rb
index da47b9e140..8b93f22613 100644
--- a/spec/functional/resource/ohai_spec.rb
+++ b/spec/functional/resource/ohai_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Ohai do
let(:ohai) {
diff --git a/spec/functional/resource/package_spec.rb b/spec/functional/resource/package_spec.rb
index 00120afc29..459e21586e 100644
--- a/spec/functional/resource/package_spec.rb
+++ b/spec/functional/resource/package_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'webrick'
+require "spec_helper"
+require "webrick"
module AptServer
def enable_testing_apt_source
@@ -239,7 +239,7 @@ describe Chef::Resource::Package, metadata do
it "does not update the package configuration" do
package_resource.run_action(:install)
cmd = shell_out!("debconf-show chef-integration-test")
- expect(cmd.stdout).to include('chef-integration-test/sample-var: INVALID')
+ expect(cmd.stdout).to include("chef-integration-test/sample-var: INVALID")
expect(package_resource).to be_updated_by_last_action
end
@@ -276,7 +276,7 @@ describe Chef::Resource::Package, metadata do
r = base_resource
r.cookbook_name = "preseed"
r.response_file("preseed-template-variables.seed")
- r.response_file_variables({ :template_variable => 'SUPPORTS VARIABLES' })
+ r.response_file_variables({ :template_variable => "SUPPORTS VARIABLES" })
r
end
diff --git a/spec/functional/resource/powershell_script_spec.rb b/spec/functional/resource/powershell_script_spec.rb
index d7e5b9888b..ac4660e1cc 100644
--- a/spec/functional/resource/powershell_script_spec.rb
+++ b/spec/functional/resource/powershell_script_spec.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/platform/query_helpers'
-require 'spec_helper'
+require "chef/platform/query_helpers"
+require "spec_helper"
describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
include_context Chef::Resource::WindowsScript
- let (:architecture_command) { 'echo $env:PROCESSOR_ARCHITECTURE' }
- let (:output_command) { ' | out-file -encoding ASCII ' }
+ let (:architecture_command) { "echo $env:PROCESSOR_ARCHITECTURE" }
+ let (:output_command) { " | out-file -encoding ASCII " }
it_behaves_like "a Windows script running on Windows"
@@ -59,7 +59,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
it "returns the exit status 27 for a powershell script that exits with 27" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- file = Tempfile.new(['foo', '.ps1'])
+ file = Tempfile.new(["foo", ".ps1"])
begin
file.write "exit 27"
file.close
@@ -79,7 +79,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
# Versions of PowerShell prior to 4.0 return a 16-bit unsigned value --
# PowerShell 4.0 and later versions return a 32-bit signed value.
- file = Tempfile.new(['foo', '.ps1'])
+ file = Tempfile.new(["foo", ".ps1"])
begin
file.write "exit #{negative_exit_status}"
file.close
@@ -114,7 +114,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
end
it "returns 0 if the last command was a cmdlet that succeeded and was preceded by a non-cmdlet Windows binary that failed" do
- resource.code([windows_process_exit_code_not_found_content, cmdlet_exit_code_success_content].join(';'))
+ resource.code([windows_process_exit_code_not_found_content, cmdlet_exit_code_success_content].join(";"))
resource.returns(0)
resource.run_action(:run)
end
@@ -130,7 +130,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
it "returns 1 if the last command was a cmdlet that failed and was preceded by a successfully executed non-cmdlet Windows binary" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.code([windows_process_exit_code_success_content, cmdlet_exit_code_not_found_content].join(';'))
+ resource.code([windows_process_exit_code_success_content, cmdlet_exit_code_not_found_content].join(";"))
resource.returns(1)
expect { resource.run_action(:run) }.not_to raise_error
end
@@ -138,7 +138,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
it "raises a Mixlib::ShellOut::ShellCommandFailed error if the script is not syntactically correct" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.code('if({)')
+ resource.code("if({)")
resource.returns(0)
expect { resource.run_action(:run) }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
end
@@ -148,7 +148,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
# The error is a false-positive.
skip "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.code('if({)')
+ resource.code("if({)")
resource.returns(1)
expect { resource.run_action(:run) }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
end
@@ -164,7 +164,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
it "returns 1 if the last command was a cmdlet that failed and was preceded by an unsuccessfully executed non-cmdlet Windows binary" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.code([arbitrary_nonzero_process_exit_code_content,cmdlet_exit_code_not_found_content].join(';'))
+ resource.code([arbitrary_nonzero_process_exit_code_content,cmdlet_exit_code_not_found_content].join(";"))
resource.returns(arbitrary_nonzero_process_exit_code)
resource.run_action(:run)
end
@@ -172,7 +172,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
it "returns 0 if the last command was a non-cmdlet Windows binary that succeeded and was preceded by a failed cmdlet" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.code([cmdlet_exit_code_success_content, arbitrary_nonzero_process_exit_code_content].join(';'))
+ resource.code([cmdlet_exit_code_success_content, arbitrary_nonzero_process_exit_code_content].join(";"))
resource.returns(arbitrary_nonzero_process_exit_code)
resource.run_action(:run)
end
@@ -180,7 +180,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
it "returns a specific error code if the last command was a non-cmdlet Windows binary that failed and was preceded by cmdlet that succeeded" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.code([cmdlet_exit_code_success_content, arbitrary_nonzero_process_exit_code_content].join(';'))
+ resource.code([cmdlet_exit_code_success_content, arbitrary_nonzero_process_exit_code_content].join(";"))
resource.returns(arbitrary_nonzero_process_exit_code)
resource.run_action(:run)
end
@@ -188,7 +188,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
it "returns a specific error code if the last command was a non-cmdlet Windows binary that failed and was preceded by cmdlet that failed" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.code([cmdlet_exit_code_not_found_content, arbitrary_nonzero_process_exit_code_content].join(';'))
+ resource.code([cmdlet_exit_code_not_found_content, arbitrary_nonzero_process_exit_code_content].join(";"))
resource.returns(arbitrary_nonzero_process_exit_code)
resource.run_action(:run)
end
@@ -226,9 +226,9 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
resource.returns(0)
resource.run_action(:run)
- is_64_bit = (ENV['PROCESSOR_ARCHITECTURE'] == 'AMD64') || (ENV['PROCESSOR_ARCHITEW6432'] == 'AMD64')
+ is_64_bit = (ENV["PROCESSOR_ARCHITECTURE"] == "AMD64") || (ENV["PROCESSOR_ARCHITEW6432"] == "AMD64")
- detected_64_bit = source_contains_case_insensitive_content?( get_script_output, 'AMD64' )
+ detected_64_bit = source_contains_case_insensitive_content?( get_script_output, "AMD64" )
expect(is_64_bit).to eq(detected_64_bit)
end
@@ -280,7 +280,7 @@ configuration LCM
resource.returns(0)
resource.run_action(:run)
- expect(source_contains_case_insensitive_content?( get_script_output, 'x86' )).to eq(true)
+ expect(source_contains_case_insensitive_content?( get_script_output, "x86" )).to eq(true)
end
context "when running on a 64-bit version of Windows", :windows64_only do
@@ -290,7 +290,7 @@ configuration LCM
resource.returns(0)
resource.run_action(:run)
- expect(source_contains_case_insensitive_content?( get_script_output, 'AMD64' )).to eq(true)
+ expect(source_contains_case_insensitive_content?( get_script_output, "AMD64" )).to eq(true)
end
end
@@ -311,7 +311,7 @@ configuration LCM
resource.returns(0)
resource.run_action(:run)
- expect(source_contains_case_insensitive_content?( get_script_output, 'AMD64' )).to eq(true)
+ expect(source_contains_case_insensitive_content?( get_script_output, "AMD64" )).to eq(true)
end
it "executes a script with a 32-bit process if :i386 arch is specified", :not_supported_on_nano do
@@ -320,7 +320,7 @@ configuration LCM
resource.returns(0)
resource.run_action(:run)
- expect(source_contains_case_insensitive_content?( get_script_output, 'x86' )).to eq(true)
+ expect(source_contains_case_insensitive_content?( get_script_output, "x86" )).to eq(true)
end
it "raises an error when executing a script with a 32-bit process on Windows Nano Server", :windows_nano_only do
diff --git a/spec/functional/resource/reboot_spec.rb b/spec/functional/resource/reboot_spec.rb
index da3775ef20..8647ae23a4 100644
--- a/spec/functional/resource/reboot_spec.rb
+++ b/spec/functional/resource/reboot_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Reboot do
@@ -42,7 +42,7 @@ describe Chef::Resource::Reboot do
create_resource
end
- shared_context 'testing run context modification' do
+ shared_context "testing run context modification" do
def test_reboot_action(resource)
reboot_info = resource.run_context.reboot_info
expect(reboot_info.keys.sort).to eq([:delay_mins, :reason, :requested_by, :timestamp])
@@ -55,8 +55,8 @@ describe Chef::Resource::Reboot do
end
# the currently defined behavior for multiple calls to this resource is "last one wins."
- describe 'the request_reboot_on_successful_run action' do
- include_context 'testing run context modification'
+ describe "the request_reboot_on_successful_run action" do
+ include_context "testing run context modification"
before do
resource.run_action(:request_reboot)
@@ -66,19 +66,19 @@ describe Chef::Resource::Reboot do
resource.run_context.cancel_reboot
end
- it 'should have modified the run context correctly' do
+ it "should have modified the run context correctly" do
test_reboot_action(resource)
end
end
- describe 'the reboot_interrupt_run action' do
- include_context 'testing run context modification'
+ describe "the reboot_interrupt_run action" do
+ include_context "testing run context modification"
after do
resource.run_context.cancel_reboot
end
- it 'should have modified the run context correctly' do
+ it "should have modified the run context correctly" do
# this doesn't actually test the flow of Chef::Client#do_run, unfortunately.
expect {
resource.run_action(:reboot_now)
@@ -94,7 +94,7 @@ describe Chef::Resource::Reboot do
resource.run_action(:cancel)
end
- it 'should have cleared the reboot request' do
+ it "should have cleared the reboot request" do
# arguably we shouldn't be querying RunContext's internal data directly.
expect(resource.run_context.reboot_info).to eq({})
expect(resource.run_context.reboot_requested?).to be_falsey
diff --git a/spec/functional/resource/registry_spec.rb b/spec/functional/resource/registry_spec.rb
index c0682fefc8..ec54e8253a 100644
--- a/spec/functional/resource/registry_spec.rb
+++ b/spec/functional/resource/registry_spec.rb
@@ -43,8 +43,8 @@ end
describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
# parent and key must be single keys, not paths
- let(:parent) { 'Opscode' }
- let(:child) { 'Whatever' }
+ let(:parent) { "Opscode" }
+ let(:child) { "Whatever" }
let(:key_parent) { "SOFTWARE\\" + parent }
let(:key_child) { "SOFTWARE\\" + parent + "\\" + child }
# must be under HKLM\SOFTWARE for WOW64 redirection to work
diff --git a/spec/functional/resource/remote_directory_spec.rb b/spec/functional/resource/remote_directory_spec.rb
index 669ee60831..3537432203 100644
--- a/spec/functional/resource/remote_directory_spec.rb
+++ b/spec/functional/resource/remote_directory_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::RemoteDirectory do
include_context Chef::Resource::Directory
@@ -36,14 +36,14 @@ describe Chef::Resource::RemoteDirectory do
resource = Chef::Resource::RemoteDirectory.new(path, run_context)
resource.source "remotedir"
- resource.cookbook('openldap')
+ resource.cookbook("openldap")
resource
end
def create_extraneous_files
- FileUtils.mkdir_p(File.join(path, 'remotesubdir'))
- @existing1 = File.join(path, 'marked_for_death.txt')
- @existing2 = File.join(path, 'remotesubdir', 'marked_for_death_again.txt')
+ FileUtils.mkdir_p(File.join(path, "remotesubdir"))
+ @existing1 = File.join(path, "marked_for_death.txt")
+ @existing2 = File.join(path, "remotesubdir", "marked_for_death_again.txt")
FileUtils.touch(@existing1)
FileUtils.touch(@existing2)
end
@@ -59,12 +59,12 @@ describe Chef::Resource::RemoteDirectory do
# See spec/data/cookbooks/openldap/files/default
let(:expected_files) do
[
- File.join(path, 'remote_dir_file1.txt'),
- File.join(path, 'remote_dir_file2.txt'),
- File.join(path, 'remotesubdir', 'remote_subdir_file1.txt'),
- File.join(path, 'remotesubdir', 'remote_subdir_file2.txt'),
- File.join(path, 'remotesubdir', '.a_dotfile'),
- File.join(path, '.a_dotdir', '.a_dotfile_in_a_dotdir'),
+ File.join(path, "remote_dir_file1.txt"),
+ File.join(path, "remote_dir_file2.txt"),
+ File.join(path, "remotesubdir", "remote_subdir_file1.txt"),
+ File.join(path, "remotesubdir", "remote_subdir_file2.txt"),
+ File.join(path, "remotesubdir", ".a_dotfile"),
+ File.join(path, ".a_dotdir", ".a_dotfile_in_a_dotdir"),
]
end
@@ -133,11 +133,11 @@ describe Chef::Resource::RemoteDirectory do
end
it "leaves modifications alone" do
- FileUtils.mkdir_p(File.join(path, 'remotesubdir'))
- modified_file = File.join(path, 'remote_dir_file1.txt')
- modified_subdir_file = File.join(path, 'remotesubdir', 'remote_subdir_file1.txt')
- File.open(modified_file, 'a') {|f| f.puts "santa is real"}
- File.open(modified_subdir_file, 'a') {|f| f.puts "so is rudolph"}
+ FileUtils.mkdir_p(File.join(path, "remotesubdir"))
+ modified_file = File.join(path, "remote_dir_file1.txt")
+ modified_subdir_file = File.join(path, "remotesubdir", "remote_subdir_file1.txt")
+ File.open(modified_file, "a") {|f| f.puts "santa is real"}
+ File.open(modified_subdir_file, "a") {|f| f.puts "so is rudolph"}
modified_file_checksum = sha256_checksum(modified_file)
modified_subdir_file_checksum = sha256_checksum(modified_subdir_file)
@@ -190,11 +190,11 @@ describe Chef::Resource::RemoteDirectory do
context "and there are deeply nested extraneous files in the directory" do
before do
- FileUtils.mkdir_p(File.join(path, 'a', 'multiply', 'nested', 'directory'))
- @existing1 = File.join(path, 'a', 'foo.txt')
- @existing2 = File.join(path, 'a', 'multiply', 'bar.txt')
- @existing3 = File.join(path, 'a', 'multiply', 'nested', 'baz.txt')
- @existing4 = File.join(path, 'a', 'multiply', 'nested', 'directory', 'qux.txt')
+ FileUtils.mkdir_p(File.join(path, "a", "multiply", "nested", "directory"))
+ @existing1 = File.join(path, "a", "foo.txt")
+ @existing2 = File.join(path, "a", "multiply", "bar.txt")
+ @existing3 = File.join(path, "a", "multiply", "nested", "baz.txt")
+ @existing4 = File.join(path, "a", "multiply", "nested", "directory", "qux.txt")
FileUtils.touch(@existing1)
FileUtils.touch(@existing2)
FileUtils.touch(@existing3)
diff --git a/spec/functional/resource/remote_file_spec.rb b/spec/functional/resource/remote_file_spec.rb
index 4fbcd2d24b..7bf95e7a7d 100644
--- a/spec/functional/resource/remote_file_spec.rb
+++ b/spec/functional/resource/remote_file_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tiny_server'
-require 'support/shared/functional/http'
+require "spec_helper"
+require "tiny_server"
+require "support/shared/functional/http"
describe Chef::Resource::RemoteFile do
include ChefHTTPShared
@@ -64,10 +64,10 @@ describe Chef::Resource::RemoteFile do
end
describe "when redownload isn't necessary" do
- let(:source) { 'http://localhost:9000/seattle_capo.png' }
+ let(:source) { "http://localhost:9000/seattle_capo.png" }
before do
- @api.get("/seattle_capo.png", 304, "", { 'Etag' => 'abcdef' } )
+ @api.get("/seattle_capo.png", 304, "", { "Etag" => "abcdef" } )
end
it "does not fetch the file" do
@@ -76,7 +76,7 @@ describe Chef::Resource::RemoteFile do
end
context "when using normal encoding" do
- let(:source) { 'http://localhost:9000/nyan_cat.png' }
+ let(:source) { "http://localhost:9000/nyan_cat.png" }
let(:expected_content) { binread(nyan_uncompressed_filename) }
it_behaves_like "a file resource"
@@ -85,7 +85,7 @@ describe Chef::Resource::RemoteFile do
end
context "when using gzip encoding" do
- let(:source) { 'http://localhost:9000/nyan_cat.png.gz' }
+ let(:source) { "http://localhost:9000/nyan_cat.png.gz" }
let(:expected_content) { binread(nyan_compressed_filename) }
it_behaves_like "a file resource"
@@ -115,7 +115,7 @@ describe Chef::Resource::RemoteFile do
stop_tiny_server
end
- let(:source) { 'https://localhost:9000/nyan_cat.png' }
+ let(:source) { "https://localhost:9000/nyan_cat.png" }
let(:expected_content) { binread(nyan_uncompressed_filename) }
@@ -134,7 +134,7 @@ describe Chef::Resource::RemoteFile do
context "when downloading compressed data" do
let(:expected_content) { binread(nyan_uncompressed_filename) }
- let(:source) { 'http://localhost:9000/nyan_cat_content_length_compressed.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_content_length_compressed.png" }
before do
expect(File).not_to exist(path)
@@ -156,7 +156,7 @@ describe Chef::Resource::RemoteFile do
context "when downloding uncompressed data" do
let(:expected_content) { binread(nyan_uncompressed_filename) }
- let(:source) { 'http://localhost:9000/nyan_cat_content_length.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_content_length.png" }
before do
expect(File).not_to exist(path)
@@ -177,7 +177,7 @@ describe Chef::Resource::RemoteFile do
end
context "when downloading truncated compressed data" do
- let(:source) { 'http://localhost:9000/nyan_cat_truncated_compressed.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_truncated_compressed.png" }
before do
expect(File).not_to exist(path)
@@ -190,7 +190,7 @@ describe Chef::Resource::RemoteFile do
end
context "when downloding truncated uncompressed data" do
- let(:source) { 'http://localhost:9000/nyan_cat_truncated.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_truncated.png" }
before do
expect(File).not_to exist(path)
@@ -204,7 +204,7 @@ describe Chef::Resource::RemoteFile do
context "when downloding data with transfer-encoding set" do
let(:expected_content) { binread(nyan_uncompressed_filename) }
- let(:source) { 'http://localhost:9000/nyan_cat_transfer_encoding.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_transfer_encoding.png" }
before do
expect(File).not_to exist(path)
@@ -225,7 +225,7 @@ describe Chef::Resource::RemoteFile do
end
describe "when the download of the source raises an exception" do
- let(:source) { 'http://localhost:0000/seattle_capo.png' }
+ let(:source) { "http://localhost:0000/seattle_capo.png" }
before do
expect(File).not_to exist(path)
diff --git a/spec/functional/resource/rpm_spec.rb b/spec/functional/resource/rpm_spec.rb
index b37ee781f1..f0e57dc58b 100644
--- a/spec/functional/resource/rpm_spec.rb
+++ b/spec/functional/resource/rpm_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "functional/resource/base"
+require "chef/mixin/shell_out"
# run this test only for following platforms.
-exclude_test = !['aix', 'centos', 'redhat', 'suse'].include?(ohai[:platform])
+exclude_test = !["aix", "centos", "redhat", "suse"].include?(ohai[:platform])
describe Chef::Resource::RpmPackage, :requires_root, :external => exclude_test do
include Chef::Mixin::ShellOut
@@ -61,12 +61,12 @@ describe Chef::Resource::RpmPackage, :requires_root, :external => exclude_test d
@pkg_name = "dummy"
@pkg_version = "1-0"
@pkg_path = "/tmp/dummy-1-0.aix6.1.noarch.rpm"
- FileUtils.cp(File.join(CHEF_SPEC_ASSETS, 'dummy-1-0.aix6.1.noarch.rpm') , @pkg_path)
+ FileUtils.cp(File.join(CHEF_SPEC_ASSETS, "dummy-1-0.aix6.1.noarch.rpm") , @pkg_path)
when "centos", "redhat", "suse"
@pkg_name = "mytest"
@pkg_version = "1.0-1"
@pkg_path = "/tmp/mytest-1.0-1.noarch.rpm"
- FileUtils.cp(File.join(CHEF_SPEC_ASSETS, 'mytest-1.0-1.noarch.rpm') , @pkg_path)
+ FileUtils.cp(File.join(CHEF_SPEC_ASSETS, "mytest-1.0-1.noarch.rpm") , @pkg_path)
end
end
@@ -99,14 +99,14 @@ describe Chef::Resource::RpmPackage, :requires_root, :external => exclude_test d
context "package upgrade action" do
before(:each) do
shell_out("rpm -i #{@pkg_path}")
- if ohai[:platform] == 'aix'
+ if ohai[:platform] == "aix"
@pkg_version = "2-0"
@pkg_path = "/tmp/dummy-2-0.aix6.1.noarch.rpm"
- FileUtils.cp(File.join(CHEF_SPEC_ASSETS, 'dummy-2-0.aix6.1.noarch.rpm') , @pkg_path)
+ FileUtils.cp(File.join(CHEF_SPEC_ASSETS, "dummy-2-0.aix6.1.noarch.rpm") , @pkg_path)
else
@pkg_version = "2.0-1"
@pkg_path = "/tmp/mytest-2.0-1.noarch.rpm"
- FileUtils.cp(File.join(CHEF_SPEC_ASSETS, 'mytest-2.0-1.noarch.rpm') , @pkg_path)
+ FileUtils.cp(File.join(CHEF_SPEC_ASSETS, "mytest-2.0-1.noarch.rpm") , @pkg_path)
end
end
diff --git a/spec/functional/resource/template_spec.rb b/spec/functional/resource/template_spec.rb
index 35c5166e31..b0099e02c0 100644
--- a/spec/functional/resource/template_spec.rb
+++ b/spec/functional/resource/template_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Template do
@@ -44,8 +44,8 @@ describe Chef::Resource::Template do
events = Chef::EventDispatch::Dispatcher.new
run_context = Chef::RunContext.new(node, cookbook_collection, events)
resource = Chef::Resource::Template.new(path, run_context)
- resource.source('openldap_stuff.conf.erb')
- resource.cookbook('openldap')
+ resource.source("openldap_stuff.conf.erb")
+ resource.cookbook("openldap")
# NOTE: partials rely on `cookbook_name` getting set by chef internals and
# ignore the user-set `cookbook` attribute.
@@ -66,14 +66,14 @@ describe Chef::Resource::Template do
context "when the target file does not exist" do
it "creates the template with the rendered content using the variable attribute when the :create action is run" do
- resource.source('openldap_variable_stuff.conf.erb')
+ resource.source("openldap_variable_stuff.conf.erb")
resource.variables(:secret => "nutella")
resource.run_action(:create)
expect(IO.read(path)).to eq("super secret is nutella")
end
it "creates the template with the rendered content using a local erb file when the :create action is run" do
- resource.source(File.expand_path(File.join(CHEF_SPEC_DATA,'cookbooks','openldap','templates','default','openldap_stuff.conf.erb')))
+ resource.source(File.expand_path(File.join(CHEF_SPEC_DATA,"cookbooks","openldap","templates","default","openldap_stuff.conf.erb")))
resource.cookbook(nil)
resource.local(true)
resource.run_action(:create)
diff --git a/spec/functional/resource/user/dscl_spec.rb b/spec/functional/resource/user/dscl_spec.rb
index 5d960daf11..db2e67e714 100644
--- a/spec/functional/resource/user/dscl_spec.rb
+++ b/spec/functional/resource/user/dscl_spec.rb
@@ -15,8 +15,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "chef/mixin/shell_out"
metadata = {
:mac_osx_only => true,
diff --git a/spec/functional/resource/user/useradd_spec.rb b/spec/functional/resource/user/useradd_spec.rb
index 2750d33fd1..5ab6a403da 100644
--- a/spec/functional/resource/user/useradd_spec.rb
+++ b/spec/functional/resource/user/useradd_spec.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "functional/resource/base"
+require "chef/mixin/shell_out"
def user_provider_for_platform
case ohai[:platform]
@@ -50,7 +50,7 @@ describe Chef::Provider::User::Useradd, metadata do
passwd_file = File.open("/etc/passwd", "rb") {|f| f.read}
matcher = /^#{Regexp.escape(username)}.+$/
if passwd_entry = passwd_file.scan(matcher).first
- PwEntry.new(*passwd_entry.split(':'))
+ PwEntry.new(*passwd_entry.split(":"))
else
raise UserNotFound, "no entry matching #{matcher.inspect} found in /etc/passwd"
end
@@ -82,13 +82,13 @@ describe Chef::Provider::User::Useradd, metadata do
end
def try_cleanup
- ['/home/cheftestfoo', '/home/cheftestbar'].each do |f|
+ ["/home/cheftestfoo", "/home/cheftestbar"].each do |f|
FileUtils.rm_rf(f) if File.exists? f
end
- ['cf-test'].each do |u|
+ ["cf-test"].each do |u|
r = Chef::Resource::User.new("DELETE USER", run_context)
- r.username('cf-test')
+ r.username("cf-test")
r.run_action(:remove)
end
end
@@ -522,7 +522,7 @@ describe Chef::Provider::User::Useradd, metadata do
end
def shadow_password
- shadow_entry.split(':')[1]
+ shadow_entry.split(":")[1]
end
def aix_user_lock_status
@@ -665,10 +665,10 @@ describe Chef::Provider::User::Useradd, metadata do
# DEBUG: Ran usermod -U chef-functional-test returned 0
expect(@error).to be_nil
if ohai[:platform] == "aix"
- expect(pw_entry.passwd).to eq('*')
+ expect(pw_entry.passwd).to eq("*")
user_account_should_be_unlocked
else
- expect(pw_entry.passwd).to eq('x')
+ expect(pw_entry.passwd).to eq("x")
expect(shadow_password).to include("!")
end
end
diff --git a/spec/functional/resource/user/windows_spec.rb b/spec/functional/resource/user/windows_spec.rb
index 5e3a9090d4..aefe8ba676 100644
--- a/spec/functional/resource/user/windows_spec.rb
+++ b/spec/functional/resource/user/windows_spec.rb
@@ -15,13 +15,13 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "chef/mixin/shell_out"
describe Chef::Provider::User::Windows, :windows_only do
include Chef::Mixin::ShellOut
- let(:username) { 'ChefFunctionalTest' }
+ let(:username) { "ChefFunctionalTest" }
let(:password) { SecureRandom.uuid }
let(:node) do
@@ -47,84 +47,84 @@ describe Chef::Provider::User::Windows, :windows_only do
delete_user(username)
end
- describe 'action :create' do
- it 'creates a user when a username and password are given' do
+ describe "action :create" do
+ it "creates a user when a username and password are given" do
new_resource.run_action(:create)
expect(new_resource).to be_updated_by_last_action
expect(shell_out("net user #{username}").exitstatus).to eq(0)
end
- it 'reports no changes if there are no changes needed' do
+ it "reports no changes if there are no changes needed" do
new_resource.run_action(:create)
new_resource.run_action(:create)
expect(new_resource).not_to be_updated_by_last_action
end
- it 'allows chaning the password' do
+ it "allows chaning the password" do
new_resource.run_action(:create)
new_resource.password(SecureRandom.uuid)
new_resource.run_action(:create)
expect(new_resource).to be_updated_by_last_action
end
- context 'with a gid specified' do
- it 'warns unsupported' do
+ context "with a gid specified" do
+ it "warns unsupported" do
expect(Chef::Log).to receive(:warn).with(/not implemented/)
- new_resource.gid('agroup')
+ new_resource.gid("agroup")
new_resource.run_action(:create)
end
end
end
- describe 'action :remove' do
+ describe "action :remove" do
before do
new_resource.run_action(:create)
end
- it 'deletes the user' do
+ it "deletes the user" do
new_resource.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
expect(shell_out("net user #{username}").exitstatus).to eq(2)
end
- it 'is idempotent' do
+ it "is idempotent" do
new_resource.run_action(:remove)
new_resource.run_action(:remove)
expect(new_resource).not_to be_updated_by_last_action
end
end
- describe 'action :lock' do
+ describe "action :lock" do
before do
new_resource.run_action(:create)
end
- it 'locks the user account' do
+ it "locks the user account" do
new_resource.run_action(:lock)
expect(new_resource).to be_updated_by_last_action
expect(shell_out("net user #{username}").stdout).to match(/Account active\s*No/)
end
- it 'is idempotent' do
+ it "is idempotent" do
new_resource.run_action(:lock)
new_resource.run_action(:lock)
expect(new_resource).not_to be_updated_by_last_action
end
end
- describe 'action :unlock' do
+ describe "action :unlock" do
before do
new_resource.run_action(:create)
new_resource.run_action(:lock)
end
- it 'unlocks the user account' do
+ it "unlocks the user account" do
new_resource.run_action(:unlock)
expect(new_resource).to be_updated_by_last_action
expect(shell_out("net user #{username}").stdout).to match(/Account active\s*Yes/)
end
- it 'is idempotent' do
+ it "is idempotent" do
new_resource.run_action(:unlock)
new_resource.run_action(:unlock)
expect(new_resource).not_to be_updated_by_last_action
diff --git a/spec/functional/resource/windows_package_spec.rb b/spec/functional/resource/windows_package_spec.rb
index 957f357846..684f2542c2 100644
--- a/spec/functional/resource/windows_package_spec.rb
+++ b/spec/functional/resource/windows_package_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
+require "spec_helper"
+require "functional/resource/base"
describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
let(:pkg_name) { nil }
@@ -38,9 +38,9 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
end
describe "install package" do
- let(:pkg_name) { 'Microsoft Visual C++ 2005 Redistributable' }
- let(:pkg_checksum) { 'd6832398e3bc9156a660745f427dc1c2392ce4e9a872e04f41f62d0c6bae07a8' }
- let(:pkg_path) { 'https://download.microsoft.com/download/6/B/B/6BB661D6-A8AE-4819-B79F-236472F6070C/vcredist_x86.exe' }
+ let(:pkg_name) { "Microsoft Visual C++ 2005 Redistributable" }
+ let(:pkg_checksum) { "d6832398e3bc9156a660745f427dc1c2392ce4e9a872e04f41f62d0c6bae07a8" }
+ let(:pkg_path) { "https://download.microsoft.com/download/6/B/B/6BB661D6-A8AE-4819-B79F-236472F6070C/vcredist_x86.exe" }
let(:pkg_checksum) { nil }
let(:pkg_type) { :custom }
let(:pkg_options) { "/Q" }
@@ -56,9 +56,9 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
end
context "installing additional version" do
- let(:pkg_path) { 'https://download.microsoft.com/download/e/1/c/e1c773de-73ba-494a-a5ba-f24906ecf088/vcredist_x86.exe' }
- let(:pkg_checksum) { 'eb00f891919d4f894ab725b158459db8834470c382dc60cd3c3ee2c6de6da92c' }
- let(:pkg_version) { '8.0.56336' }
+ let(:pkg_path) { "https://download.microsoft.com/download/e/1/c/e1c773de-73ba-494a-a5ba-f24906ecf088/vcredist_x86.exe" }
+ let(:pkg_checksum) { "eb00f891919d4f894ab725b158459db8834470c382dc60cd3c3ee2c6de6da92c" }
+ let(:pkg_version) { "8.0.56336" }
it "installs older version" do
subject.run_action(:install)
@@ -70,14 +70,14 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
subject { Chef::Resource::WindowsPackage.new(pkg_name, run_context) }
context "multiple versions and a version given to remove" do
- before { subject.version('8.0.56336')}
+ before { subject.version("8.0.56336")}
it "removes specified version" do
subject.run_action(:remove)
expect(subject).to be_updated_by_last_action
prov = subject.provider_for_action(:remove)
prov.load_current_resource
- expect(prov.current_version_array).to eq([['8.0.59193']])
+ expect(prov.current_version_array).to eq([["8.0.59193"]])
end
end
@@ -102,8 +102,8 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
install1.run_action(:install)
install2 = Chef::Resource::WindowsPackage.new(pkg_name, run_context)
- install2.source 'https://download.microsoft.com/download/e/1/c/e1c773de-73ba-494a-a5ba-f24906ecf088/vcredist_x86.exe'
- install2.version '8.0.56336'
+ install2.source "https://download.microsoft.com/download/e/1/c/e1c773de-73ba-494a-a5ba-f24906ecf088/vcredist_x86.exe"
+ install2.version "8.0.56336"
install2.installer_type pkg_type
install2.options pkg_options
install2.run_action(:install)
@@ -124,9 +124,9 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
after { subject.run_action(:remove) }
context "null soft" do
- let(:pkg_name) { 'Ultra Defragmenter' }
- let(:pkg_path) { 'http://iweb.dl.sourceforge.net/project/ultradefrag/stable-release/6.1.1/ultradefrag-6.1.1.bin.amd64.exe' }
- let(:pkg_checksum) { '11d53ed4c426c8c867ad43f142b7904226ffd9938c02e37086913620d79e3c09' }
+ let(:pkg_name) { "Ultra Defragmenter" }
+ let(:pkg_path) { "http://iweb.dl.sourceforge.net/project/ultradefrag/stable-release/6.1.1/ultradefrag-6.1.1.bin.amd64.exe" }
+ let(:pkg_checksum) { "11d53ed4c426c8c867ad43f142b7904226ffd9938c02e37086913620d79e3c09" }
it "finds the correct installer type" do
subject.run_action(:install)
@@ -135,9 +135,9 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
end
context "inno" do
- let(:pkg_name) { 'Mercurial 3.6.1 (64-bit)' }
- let(:pkg_path) { 'http://mercurial.selenic.com/release/windows/Mercurial-3.6.1-x64.exe' }
- let(:pkg_checksum) { 'febd29578cb6736163d232708b834a2ddd119aa40abc536b2c313fc5e1b5831d' }
+ let(:pkg_name) { "Mercurial 3.6.1 (64-bit)" }
+ let(:pkg_path) { "http://mercurial.selenic.com/release/windows/Mercurial-3.6.1-x64.exe" }
+ let(:pkg_checksum) { "febd29578cb6736163d232708b834a2ddd119aa40abc536b2c313fc5e1b5831d" }
it "finds the correct installer type" do
subject.run_action(:install)
@@ -147,9 +147,9 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
end
describe "install from local file" do
- let(:pkg_name) { 'Mercurial 3.6.1 (64-bit)' }
+ let(:pkg_name) { "Mercurial 3.6.1 (64-bit)" }
let(:pkg_path) { ::File.join(Chef::Config[:file_cache_path], "package", "Mercurial-3.6.1-x64.exe") }
- let(:pkg_checksum) { 'febd29578cb6736163d232708b834a2ddd119aa40abc536b2c313fc5e1b5831d' }
+ let(:pkg_checksum) { "febd29578cb6736163d232708b834a2ddd119aa40abc536b2c313fc5e1b5831d" }
it "installs the app" do
subject.run_action(:install)
@@ -158,7 +158,7 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
end
describe "uninstall exe without source" do
- let(:pkg_name) { 'Mercurial 3.6.1 (64-bit)' }
+ let(:pkg_name) { "Mercurial 3.6.1 (64-bit)" }
it "uninstalls the app" do
subject.run_action(:remove)
diff --git a/spec/functional/resource/windows_service_spec.rb b/spec/functional/resource/windows_service_spec.rb
index bbefb49623..56d81845e8 100644
--- a/spec/functional/resource/windows_service_spec.rb
+++ b/spec/functional/resource/windows_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_gem_only, :appveyor_only do