summaryrefslogtreecommitdiff
path: root/spec/functional
diff options
context:
space:
mode:
Diffstat (limited to 'spec/functional')
-rw-r--r--spec/functional/event_loggers/windows_eventlog_spec.rb2
-rw-r--r--spec/functional/resource/cookbook_file_spec.rb2
-rw-r--r--spec/functional/resource/cron_spec.rb4
-rw-r--r--spec/functional/resource/deploy_revision_spec.rb2
-rw-r--r--spec/functional/resource/dsc_script_spec.rb2
-rw-r--r--spec/functional/resource/execute_spec.rb2
-rw-r--r--spec/functional/resource/git_spec.rb2
-rw-r--r--spec/functional/resource/group_spec.rb16
-rw-r--r--spec/functional/resource/ifconfig_spec.rb2
-rw-r--r--spec/functional/resource/link_spec.rb8
-rw-r--r--spec/functional/resource/mount_spec.rb2
-rw-r--r--spec/functional/resource/package_spec.rb2
-rw-r--r--spec/functional/resource/registry_spec.rb18
-rw-r--r--spec/functional/resource/rpm_spec.rb2
-rw-r--r--spec/functional/resource/template_spec.rb2
-rw-r--r--spec/functional/resource/user/dscl_spec.rb2
-rw-r--r--spec/functional/resource/windows_service_spec.rb2
-rw-r--r--spec/functional/run_lock_spec.rb12
-rw-r--r--spec/functional/win32/registry_spec.rb32
-rw-r--r--spec/functional/win32/service_manager_spec.rb10
-rw-r--r--spec/functional/win32/versions_spec.rb2
21 files changed, 64 insertions, 64 deletions
diff --git a/spec/functional/event_loggers/windows_eventlog_spec.rb b/spec/functional/event_loggers/windows_eventlog_spec.rb
index 031405f718..69874ef677 100644
--- a/spec/functional/event_loggers/windows_eventlog_spec.rb
+++ b/spec/functional/event_loggers/windows_eventlog_spec.rb
@@ -19,7 +19,7 @@
require "spec_helper"
require "securerandom"
require "chef/event_loggers/windows_eventlog"
-if Chef::Platform.windows? and not Chef::Platform::windows_server_2003?
+if Chef::Platform.windows? and not Chef::Platform.windows_server_2003?
require "win32/eventlog"
include Win32
end
diff --git a/spec/functional/resource/cookbook_file_spec.rb b/spec/functional/resource/cookbook_file_spec.rb
index cd678e5e13..d127413c73 100644
--- a/spec/functional/resource/cookbook_file_spec.rb
+++ b/spec/functional/resource/cookbook_file_spec.rb
@@ -70,7 +70,7 @@ describe Chef::Resource::CookbookFile do
let(:path) { File.join(windows_non_temp_dir, make_tmpname(file_base)) }
before do
- FileUtils::mkdir_p(windows_non_temp_dir) if Chef::Platform.windows?
+ FileUtils.mkdir_p(windows_non_temp_dir) if Chef::Platform.windows?
end
after do
diff --git a/spec/functional/resource/cron_spec.rb b/spec/functional/resource/cron_spec.rb
index 2906715f7a..3380eccb0d 100644
--- a/spec/functional/resource/cron_spec.rb
+++ b/spec/functional/resource/cron_spec.rb
@@ -104,7 +104,7 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do
end
end
- exclude_solaris = ["solaris", "opensolaris", "solaris2", "omnios"].include?(ohai[:platform])
+ exclude_solaris = %w{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"
@@ -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 %w{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 4772067949..ee98832180 100644
--- a/spec/functional/resource/deploy_revision_spec.rb
+++ b/spec/functional/resource/deploy_revision_spec.rb
@@ -45,7 +45,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
before(:all) do
@ohai = Ohai::System.new
- @ohai.all_plugins(["platform", "os"])
+ @ohai.all_plugins(%w{platform os})
end
let(:node) do
diff --git a/spec/functional/resource/dsc_script_spec.rb b/spec/functional/resource/dsc_script_spec.rb
index 5f264fdca1..921638bcf8 100644
--- a/spec/functional/resource/dsc_script_spec.rb
+++ b/spec/functional/resource/dsc_script_spec.rb
@@ -280,7 +280,7 @@ EOH
end
let(:test_registry_data) { test_registry_data1 }
- let(:dsc_parameterized_env_param_value) { "val" + Random::rand.to_s }
+ 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
expect(dsc_test_resource.configuration_data).to eql(nil)
diff --git a/spec/functional/resource/execute_spec.rb b/spec/functional/resource/execute_spec.rb
index 1ceeb70590..dd0f68bebb 100644
--- a/spec/functional/resource/execute_spec.rb
+++ b/spec/functional/resource/execute_spec.rb
@@ -145,7 +145,7 @@ describe Chef::Resource::Execute do
# Timeout::timeout should be longer than resource.timeout, but less than the resource.command ruby sleep timer,
# so we fail if we finish on resource.command instead of resource.timeout, but raise CommandTimeout anyway (#2175).
it "times out when a timeout is set on the resource" do
- Timeout::timeout(30) do
+ Timeout.timeout(30) do
resource.command %{ruby -e 'sleep 300'}
resource.timeout 0.1
expect { resource.run_action(:run) }.to raise_error(Mixlib::ShellOut::CommandTimeout)
diff --git a/spec/functional/resource/git_spec.rb b/spec/functional/resource/git_spec.rb
index 7174a99451..92c2dd2074 100644
--- a/spec/functional/resource/git_spec.rb
+++ b/spec/functional/resource/git_spec.rb
@@ -92,7 +92,7 @@ E
before(:all) do
@ohai = Ohai::System.new
- @ohai.all_plugins(["platform", "os"])
+ @ohai.all_plugins(%w{platform os})
end
context "working with pathes with special characters" do
diff --git a/spec/functional/resource/group_spec.rb b/spec/functional/resource/group_spec.rb
index 063b5d9004..521c8e887d 100644
--- a/spec/functional/resource/group_spec.rb
+++ b/spec/functional/resource/group_spec.rb
@@ -31,8 +31,8 @@ describe Chef::Resource::Group, :requires_root_or_running_windows, :not_supporte
def group_should_exist(group)
case ohai[:platform_family]
when "debian", "fedora", "rhel", "suse", "gentoo", "slackware", "arch"
- expect { Etc::getgrnam(group) }.not_to raise_error
- expect(group).to eq(Etc::getgrnam(group).name)
+ expect { Etc.getgrnam(group) }.not_to raise_error
+ expect(group).to eq(Etc.getgrnam(group).name)
when "windows"
expect { Chef::Util::Windows::NetGroup.new(group).local_get_members }.not_to raise_error
end
@@ -49,21 +49,21 @@ describe Chef::Resource::Group, :requires_root_or_running_windows, :not_supporte
members.shift # Get rid of GroupMembership: string
members.include?(user)
else
- Etc::getgrnam(group_name).mem.include?(user)
+ Etc.getgrnam(group_name).mem.include?(user)
end
end
def group_should_not_exist(group)
case ohai[:platform_family]
when "debian", "fedora", "rhel", "suse", "gentoo", "slackware", "arch"
- expect { Etc::getgrnam(group) }.to raise_error(ArgumentError, "can't find group for #{group}")
+ expect { Etc.getgrnam(group) }.to raise_error(ArgumentError, "can't find group for #{group}")
when "windows"
expect { Chef::Util::Windows::NetGroup.new(group).local_get_members }.to raise_error(ArgumentError, /The group name could not be found./)
end
end
def compare_gid(resource, gid)
- return resource.gid == Etc::getgrnam(resource.name).gid if unix?
+ return resource.gid == Etc.getgrnam(resource.name).gid if unix?
end
def sid_string_from_user(user)
@@ -361,7 +361,7 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" }
end
describe "group modify action", :not_supported_on_solaris do
- let(:spec_members) { ["mnou5sdz", "htulrvwq", "x4c3g1lu"] }
+ let(:spec_members) { %w{mnou5sdz htulrvwq x4c3g1lu} }
let(:included_members) { [spec_members[0], spec_members[1]] }
let(:excluded_members) { [spec_members[2]] }
let(:tested_action) { :modify }
@@ -389,7 +389,7 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" }
end
describe "group manage action", :not_supported_on_solaris do
- let(:spec_members) { ["mnou5sdz", "htulrvwq", "x4c3g1lu"] }
+ let(:spec_members) { %w{mnou5sdz htulrvwq x4c3g1lu} }
let(:included_members) { [spec_members[0], spec_members[1]] }
let(:excluded_members) { [spec_members[2]] }
let(:tested_action) { :manage }
@@ -443,7 +443,7 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" }
end
describe "when append is not set" do
- let(:included_members) { ["gordon", "eric"] }
+ let(:included_members) { %w{gordon eric} }
before(:each) do
group_resource.append(false)
diff --git a/spec/functional/resource/ifconfig_spec.rb b/spec/functional/resource/ifconfig_spec.rb
index cac6d96981..a30dcff641 100644
--- a/spec/functional/resource/ifconfig_spec.rb
+++ b/spec/functional/resource/ifconfig_spec.rb
@@ -20,7 +20,7 @@ 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 = !(%w{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
diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb
index 9b9d696979..f55b9fca1e 100644
--- a/spec/functional/resource/link_spec.rb
+++ b/spec/functional/resource/link_spec.rb
@@ -38,11 +38,11 @@ describe Chef::Resource::Link do
end
before do
- FileUtils::mkdir_p(test_file_dir)
+ FileUtils.mkdir_p(test_file_dir)
end
after do
- FileUtils::rm_rf(test_file_dir)
+ FileUtils.rm_rf(test_file_dir)
end
let(:to) do
@@ -559,7 +559,7 @@ describe Chef::Resource::Link do
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?)
+ 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.
@@ -578,7 +578,7 @@ describe Chef::Resource::Link do
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?)
+ 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?
diff --git a/spec/functional/resource/mount_spec.rb b/spec/functional/resource/mount_spec.rb
index 7f088891e3..c756b0d3d4 100644
--- a/spec/functional/resource/mount_spec.rb
+++ b/spec/functional/resource/mount_spec.rb
@@ -22,7 +22,7 @@ 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 = !(%w{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
diff --git a/spec/functional/resource/package_spec.rb b/spec/functional/resource/package_spec.rb
index 36b106bf1c..1ab247a154 100644
--- a/spec/functional/resource/package_spec.rb
+++ b/spec/functional/resource/package_spec.rb
@@ -66,7 +66,7 @@ module AptServer
@apt_server_thread = Thread.new do
run_apt_server
end
- until tcp_test_port("localhost", 9000) do
+ until tcp_test_port("localhost", 9000)
if @apt_server_thread.alive?
sleep 1
else
diff --git a/spec/functional/resource/registry_spec.rb b/spec/functional/resource/registry_spec.rb
index 6cf8524883..e64b6697c5 100644
--- a/spec/functional/resource/registry_spec.rb
+++ b/spec/functional/resource/registry_spec.rb
@@ -78,7 +78,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
hive_class.create(key_parent + '\Opscode', Win32::Registry::KEY_WRITE | flag)
hive_class.open(key_parent + '\Opscode', Win32::Registry::KEY_ALL_ACCESS | flag) do |reg|
reg["Color", Win32::Registry::REG_SZ] = "Orange"
- reg.write("Opscode", Win32::Registry::REG_MULTI_SZ, ["Seattle", "Washington"])
+ reg.write("Opscode", Win32::Registry::REG_MULTI_SZ, %w{Seattle Washington})
reg["AKA", Win32::Registry::REG_SZ] = "OC"
end
hive_class.create(key_parent + '\ReportKey', Win32::Registry::KEY_WRITE | flag)
@@ -179,12 +179,12 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "creates subkey if parent exists" do
@new_resource.key(reg_child + '\OpscodeTest')
- @new_resource.values([{ :name => "Chef", :type => :multi_string, :data => ["OpscodeOrange", "Rules"] }])
+ @new_resource.values([{ :name => "Chef", :type => :multi_string, :data => %w{OpscodeOrange Rules} }])
@new_resource.recursive(false)
@new_resource.run_action(:create)
expect(@registry.key_exists?(reg_child + '\OpscodeTest')).to eq(true)
- expect(@registry.value_exists?(reg_child + '\OpscodeTest', { :name => "Chef", :type => :multi_string, :data => ["OpscodeOrange", "Rules"] })).to eq(true)
+ expect(@registry.value_exists?(reg_child + '\OpscodeTest', { :name => "Chef", :type => :multi_string, :data => %w{OpscodeOrange Rules} })).to eq(true)
end
it "gives error if action create and parent does not exist and recursive is set to false" do
@@ -312,12 +312,12 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "creates subkey if parent exists" do
@new_resource.key(reg_child + '\Pyrovile')
- @new_resource.values([{ :name => "Chef", :type => :multi_string, :data => ["OpscodeOrange", "Rules"] }])
+ @new_resource.values([{ :name => "Chef", :type => :multi_string, :data => %w{OpscodeOrange Rules} }])
@new_resource.recursive(false)
@new_resource.run_action(:create_if_missing)
expect(@registry.key_exists?(reg_child + '\Pyrovile')).to eq(true)
- expect(@registry.value_exists?(reg_child + '\Pyrovile', { :name => "Chef", :type => :multi_string, :data => ["OpscodeOrange", "Rules"] })).to eq(true)
+ expect(@registry.value_exists?(reg_child + '\Pyrovile', { :name => "Chef", :type => :multi_string, :data => %w{OpscodeOrange Rules} })).to eq(true)
end
it "gives error if action create and parent does not exist and recursive is set to false" do
@@ -409,7 +409,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
expect(@registry.data_exists?(reg_parent + '\Opscode', { :name => "Color", :type => :string, :data => "Orange" })).to eq(true)
@new_resource.key(reg_parent + '\Opscode')
- @new_resource.values([{ :name => "LooksLike", :type => :multi_string, :data => ["SeattleGrey", "OCOrange"] }])
+ @new_resource.values([{ :name => "LooksLike", :type => :multi_string, :data => %w{SeattleGrey OCOrange} }])
@new_resource.recursive(false)
@new_resource.run_action(:delete)
@@ -418,18 +418,18 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "deletes only specified values under a key path" do
@new_resource.key(reg_parent + '\Opscode')
- @new_resource.values([{ :name => "Opscode", :type => :multi_string, :data => ["Seattle", "Washington"] }, { :name => "AKA", :type => :string, :data => "OC" }])
+ @new_resource.values([{ :name => "Opscode", :type => :multi_string, :data => %w{Seattle Washington} }, { :name => "AKA", :type => :string, :data => "OC" }])
@new_resource.recursive(false)
@new_resource.run_action(:delete)
expect(@registry.data_exists?(reg_parent + '\Opscode', { :name => "Color", :type => :string, :data => "Orange" })).to eq(true)
expect(@registry.value_exists?(reg_parent + '\Opscode', { :name => "AKA", :type => :string, :data => "OC" })).to eq(false)
- expect(@registry.value_exists?(reg_parent + '\Opscode', { :name => "Opscode", :type => :multi_string, :data => ["Seattle", "Washington"] })).to eq(false)
+ expect(@registry.value_exists?(reg_parent + '\Opscode', { :name => "Opscode", :type => :multi_string, :data => %w{Seattle Washington} })).to eq(false)
end
it "it deletes the values with the same name irrespective of it type and data" do
@new_resource.key(reg_parent + '\Opscode')
- @new_resource.values([{ :name => "Color", :type => :multi_string, :data => ["Black", "Orange"] }])
+ @new_resource.values([{ :name => "Color", :type => :multi_string, :data => %w{Black Orange} }])
@new_resource.recursive(false)
@new_resource.run_action(:delete)
diff --git a/spec/functional/resource/rpm_spec.rb b/spec/functional/resource/rpm_spec.rb
index 5e68c70d39..ce9332e4ed 100644
--- a/spec/functional/resource/rpm_spec.rb
+++ b/spec/functional/resource/rpm_spec.rb
@@ -21,7 +21,7 @@ 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 = !%w{aix centos redhat suse}.include?(ohai[:platform])
describe Chef::Resource::RpmPackage, :requires_root, :external => exclude_test do
include Chef::Mixin::ShellOut
diff --git a/spec/functional/resource/template_spec.rb b/spec/functional/resource/template_spec.rb
index da8cbfc68a..f270043f2c 100644
--- a/spec/functional/resource/template_spec.rb
+++ b/spec/functional/resource/template_spec.rb
@@ -191,7 +191,7 @@ describe Chef::Resource::Template do
describe "when template source contains windows style line endings" do
include_context "diff disabled"
- ["all", "some", "no"].each do |test_case|
+ %w{all some no}.each do |test_case|
context "for #{test_case} lines" do
let(:resource) do
r = create_resource
diff --git a/spec/functional/resource/user/dscl_spec.rb b/spec/functional/resource/user/dscl_spec.rb
index 37f6047dfc..243471c3f7 100644
--- a/spec/functional/resource/user/dscl_spec.rb
+++ b/spec/functional/resource/user/dscl_spec.rb
@@ -168,7 +168,7 @@ c5adbbac718b7eb99463a7b679571e0f\
end
describe "when a user is member of some groups" do
- let(:groups) { ["staff", "operator"] }
+ let(:groups) { %w{staff operator} }
before do
existing_resource = user_resource.dup
diff --git a/spec/functional/resource/windows_service_spec.rb b/spec/functional/resource/windows_service_spec.rb
index 80faaece34..9353e92c24 100644
--- a/spec/functional/resource/windows_service_spec.rb
+++ b/spec/functional/resource/windows_service_spec.rb
@@ -68,7 +68,7 @@ describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_
# the service executable has to be outside the current user's home
# directory in order for the logon user to execute it.
- FileUtils::copy_file(test_service[:service_file_path], global_service_file_path)
+ FileUtils.copy_file(test_service[:service_file_path], global_service_file_path)
# if you don't make the file executable by the service user, you'll get
# the not-very-helpful "service did not respond fast enough" error.
diff --git a/spec/functional/run_lock_spec.rb b/spec/functional/run_lock_spec.rb
index d380b19dc8..b0e52471db 100644
--- a/spec/functional/run_lock_spec.rb
+++ b/spec/functional/run_lock_spec.rb
@@ -47,7 +47,7 @@ describe Chef::RunLock do
WAIT_ON_LOCK_TIME = 1.0
def wait_on_lock
- Timeout::timeout(WAIT_ON_LOCK_TIME) do
+ Timeout.timeout(WAIT_ON_LOCK_TIME) do
until File.exist?(lockfile)
sleep 0.1
end
@@ -346,7 +346,7 @@ describe Chef::RunLock do
background_block.call if background_block
# Wait until it gets there
- Timeout::timeout(CLIENT_PROCESS_TIMEOUT) do
+ Timeout.timeout(CLIENT_PROCESS_TIMEOUT) do
until @last_event == "after #{to_event}"
got_event, time = read_from_process.gets.split("@")
example.log_event("#{name}.last_event got #{got_event}")
@@ -373,7 +373,7 @@ describe Chef::RunLock do
def wait_for_exit
example.log_event("#{name}.wait_for_exit (pid #{pid})")
- Timeout::timeout(CLIENT_PROCESS_TIMEOUT) do
+ Timeout.timeout(CLIENT_PROCESS_TIMEOUT) do
Process.wait(pid) if pid
end
example.log_event("#{name}.wait_for_exit finished (pid #{pid})")
@@ -384,9 +384,9 @@ describe Chef::RunLock do
example.log_event("#{name}.stop (pid #{pid})")
begin
# Send it the kill signal over and over until it dies
- Timeout::timeout(CLIENT_PROCESS_TIMEOUT) do
+ Timeout.timeout(CLIENT_PROCESS_TIMEOUT) do
Process.kill(:KILL, pid)
- while !Process.waitpid2(pid, Process::WNOHANG)
+ until Process.waitpid2(pid, Process::WNOHANG)
sleep(0.05)
end
end
@@ -431,7 +431,7 @@ describe Chef::RunLock do
example.log_event("#{name}.start")
@pid = fork do
begin
- Timeout::timeout(CLIENT_PROCESS_TIMEOUT) do
+ Timeout.timeout(CLIENT_PROCESS_TIMEOUT) do
run_lock = TestRunLock.new(example.lockfile)
run_lock.client_process = self
fire_event("started")
diff --git a/spec/functional/win32/registry_spec.rb b/spec/functional/win32/registry_spec.rb
index f0258ab3b9..4f9b742503 100644
--- a/spec/functional/win32/registry_spec.rb
+++ b/spec/functional/win32/registry_spec.rb
@@ -35,7 +35,7 @@ describe "Chef::Win32::Registry", :windows_only do
reg["Strong", Win32::Registry::REG_SZ] = "bird nest"
end
::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Branch\\Flower', Win32::Registry::KEY_ALL_ACCESS) do |reg|
- reg["Petals", Win32::Registry::REG_MULTI_SZ] = ["Pink", "Delicate"]
+ reg["Petals", Win32::Registry::REG_MULTI_SZ] = %w{Pink Delicate}
end
#Create the node with ohai data
@@ -137,49 +137,49 @@ describe "Chef::Win32::Registry", :windows_only do
describe "data_exists?" do
it "throws an exception if the hive does not exist" do
- expect { @registry.data_exists?("JKLM\\Software\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Pink", "Delicate"] }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.data_exists?("JKLM\\Software\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "throws an exception if the key does not exist" do
- expect { @registry.data_exists?("HKCU\\Software\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Pink", "Delicate"] }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.data_exists?("HKCU\\Software\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "returns true if all the data matches" do
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Pink", "Delicate"] })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Pink Delicate} })).to eq(true)
end
it "returns true if all the data matches with a case mismatch on the data name" do
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "petals", :type => :multi_string, :data => ["Pink", "Delicate"] })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "petals", :type => :multi_string, :data => %w{Pink Delicate} })).to eq(true)
end
it "returns false if the name does not exist" do
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "slateP", :type => :multi_string, :data => ["Pink", "Delicate"] })).to eq(false)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "slateP", :type => :multi_string, :data => %w{Pink Delicate} })).to eq(false)
end
it "returns false if the types do not match" do
expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :string, :data => "Pink" })).to eq(false)
end
it "returns false if the data does not match" do
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Mauve", "Delicate"] })).to eq(false)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Mauve Delicate} })).to eq(false)
end
end
describe "data_exists!" do
it "throws an exception if the hive does not exist" do
- expect { @registry.data_exists!("JKLM\\Software\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Pink", "Delicate"] }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.data_exists!("JKLM\\Software\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "throws an exception if the key does not exist" do
- expect { @registry.data_exists!("HKCU\\Software\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Pink", "Delicate"] }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.data_exists!("HKCU\\Software\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "returns true if all the data matches" do
- expect(@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Pink", "Delicate"] })).to eq(true)
+ expect(@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Pink Delicate} })).to eq(true)
end
it "returns true if all the data matches with a case mismatch on the data name" do
- expect(@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "petals", :type => :multi_string, :data => ["Pink", "Delicate"] })).to eq(true)
+ expect(@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "petals", :type => :multi_string, :data => %w{Pink Delicate} })).to eq(true)
end
it "throws an exception if the name does not exist" do
- expect { @registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "slateP", :type => :multi_string, :data => ["Pink", "Delicate"] }) }.to raise_error(Chef::Exceptions::Win32RegDataMissing)
+ expect { @registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "slateP", :type => :multi_string, :data => %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegDataMissing)
end
it "throws an exception if the types do not match" do
expect { @registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :string, :data => "Pink" }) }.to raise_error(Chef::Exceptions::Win32RegDataMissing)
end
it "throws an exception if the data does not match" do
- expect { @registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Mauve", "Delicate"] }) }.to raise_error(Chef::Exceptions::Win32RegDataMissing)
+ expect { @registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Mauve Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegDataMissing)
end
end
@@ -243,13 +243,13 @@ describe "Chef::Win32::Registry", :windows_only do
end
it "throws an exception when trying to cast an array to an int for a dword" do
- expect { @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldThrow", :type => :dword, :data => ["one", "two"] }) }.to raise_error
+ expect { @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldThrow", :type => :dword, :data => %w{one two} }) }.to raise_error
end
# we are validating that the data gets .to_s called on it when type is a :string
it "stores the string representation of an array into a string if you pass it an array" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBePainful", :type => :string, :data => ["one", "two"] })).to eq(true)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBePainful", :type => :string, :data => %w{one two} })).to eq(true)
expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBePainful", :type => :string, :data => '["one", "two"]' })).to eq(true)
end
@@ -330,7 +330,7 @@ describe "Chef::Win32::Registry", :windows_only do
before (:all) do
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch\\Fruit"
::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Branch\\Fruit', Win32::Registry::KEY_ALL_ACCESS) do |reg|
- reg["Apple", Win32::Registry::REG_MULTI_SZ] = ["Red", "Juicy"]
+ reg["Apple", Win32::Registry::REG_MULTI_SZ] = %w{Red Juicy}
end
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Trunk\\Peck\\Woodpecker"
::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Trunk\\Peck\\Woodpecker', Win32::Registry::KEY_ALL_ACCESS) do |reg|
diff --git a/spec/functional/win32/service_manager_spec.rb b/spec/functional/win32/service_manager_spec.rb
index 7f8e943367..8fff73396e 100644
--- a/spec/functional/win32/service_manager_spec.rb
+++ b/spec/functional/win32/service_manager_spec.rb
@@ -81,7 +81,7 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
end
it "other actions => should say service doesn't exist" do
- ["delete", "start", "stop", "pause", "resume", "uninstall"].each do |action|
+ %w{delete start stop pause resume uninstall}.each do |action|
service_manager.run(["-a", action])
expect(@service_manager_output.grep(/doesn't exist on the system/).length).to be > 0
@service_manager_output = [ ]
@@ -106,7 +106,7 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
end
context "and service is stopped" do
- ["delete", "uninstall"].each do |action|
+ %w{delete uninstall}.each do |action|
it "#{action} => should remove the service", :volatile do
service_manager.run(["-a", action])
expect(test_service_exists?).to be_falsey
@@ -133,7 +133,7 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
expect(test_service_state).to eq("stopped")
end
- ["pause", "resume"].each do |action|
+ %w{pause resume}.each do |action|
it "#{action} => should raise error" do
expect { service_manager.run(["-a", action]) }.to raise_error(SystemCallError)
end
@@ -144,7 +144,7 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
service_manager.run(["-a", "start"])
end
- ["delete", "uninstall"].each do |action|
+ %w{delete uninstall}.each do |action|
it "#{action} => should remove the service", :volatile do
service_manager.run(["-a", action])
expect(test_service_exists?).to be_falsey
@@ -182,7 +182,7 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
service_manager.run(["-a", "pause"])
end
- actions = ["delete", "uninstall"]
+ actions = %w{delete uninstall}
actions.each do |action|
it "#{action} => should remove the service" do
service_manager.run(["-a", action])
diff --git a/spec/functional/win32/versions_spec.rb b/spec/functional/win32/versions_spec.rb
index aee5bbbcd4..53fce39491 100644
--- a/spec/functional/win32/versions_spec.rb
+++ b/spec/functional/win32/versions_spec.rb
@@ -36,7 +36,7 @@ describe "Chef::ReservedNames::Win32::Version", :windows_only, :not_supported_on
# from WMI contain extended characters such as registered
# trademark on Win2k8 and Win2k3 that we're not using in our
# library, so we have to set the expectation statically.
- if Chef::Platform::windows_server_2003?
+ if Chef::Platform.windows_server_2003?
@current_os_version = "Windows Server 2003 R2"
elsif is_windows_server_2008?(host)
@current_os_version = "Windows Server 2008"