summaryrefslogtreecommitdiff
path: root/spec/functional/win32
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-01-14 14:08:03 +0000
committerThom May <thom@chef.io>2016-01-14 14:08:03 +0000
commit51cfbdc4d16739caac4d946fadbe678444aafe34 (patch)
tree56dfd8f1cd9fd933de27268b32402e955a43ac2b /spec/functional/win32
parent05064423057d4cf46f4713b81b08829cf6d20af6 (diff)
downloadchef-51cfbdc4d16739caac4d946fadbe678444aafe34.tar.gz
Use double quotes by default
This is an entirely mechanically generated (chefstyle -a) change, to go along with chef/chefstyle#5 . We should pick something and use it consistently, and my opinion is that double quotes are the appropriate thing.
Diffstat (limited to 'spec/functional/win32')
-rw-r--r--spec/functional/win32/crypto_spec.rb10
-rw-r--r--spec/functional/win32/registry_spec.rb24
-rw-r--r--spec/functional/win32/security_spec.rb24
-rw-r--r--spec/functional/win32/service_manager_spec.rb4
-rw-r--r--spec/functional/win32/sid_spec.rb24
-rw-r--r--spec/functional/win32/version_info_spec.rb12
-rw-r--r--spec/functional/win32/versions_spec.rb22
7 files changed, 60 insertions, 60 deletions
diff --git a/spec/functional/win32/crypto_spec.rb b/spec/functional/win32/crypto_spec.rb
index 1492995886..185231dbdd 100644
--- a/spec/functional/win32/crypto_spec.rb
+++ b/spec/functional/win32/crypto_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/win32/crypto'
+ require "chef/win32/crypto"
end
-describe 'Chef::ReservedNames::Win32::Crypto', :windows_only do
+describe "Chef::ReservedNames::Win32::Crypto", :windows_only do
describe '#encrypt' do
before(:all) do
ohai_reader = Ohai::System.new
@@ -35,9 +35,9 @@ describe 'Chef::ReservedNames::Win32::Crypto', :windows_only do
@run_context = Chef::RunContext.new(new_node, {}, events)
end
- let (:plaintext) { 'p@assword' }
+ let (:plaintext) { "p@assword" }
- it 'can be decrypted by powershell' do
+ it "can be decrypted by powershell" do
encrypted = Chef::ReservedNames::Win32::Crypto.encrypt(plaintext)
resource = Chef::Resource::WindowsScript::PowershellScript.new("Powershell resource functional test", @run_context)
resource.code <<-EOF
diff --git a/spec/functional/win32/registry_spec.rb b/spec/functional/win32/registry_spec.rb
index dcfc49e2b3..4e18074271 100644
--- a/spec/functional/win32/registry_spec.rb
+++ b/spec/functional/win32/registry_spec.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/win32/registry'
+require "spec_helper"
+require "chef/win32/registry"
-describe 'Chef::Win32::Registry', :windows_only do
+describe "Chef::Win32::Registry", :windows_only do
before(:all) do
#Create a registry item
@@ -28,14 +28,14 @@ describe 'Chef::Win32::Registry', :windows_only do
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch"
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch\\Flower"
::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root', Win32::Registry::KEY_ALL_ACCESS) do |reg|
- reg['RootType1', Win32::Registry::REG_SZ] = 'fibrous'
- reg.write('Roots', Win32::Registry::REG_MULTI_SZ, ["strong roots", "healthy tree"])
+ reg["RootType1", Win32::Registry::REG_SZ] = "fibrous"
+ reg.write("Roots", Win32::Registry::REG_MULTI_SZ, ["strong roots", "healthy tree"])
end
::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Branch', Win32::Registry::KEY_ALL_ACCESS) do |reg|
- reg['Strong', Win32::Registry::REG_SZ] = 'bird nest'
+ 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] = ["Pink", "Delicate"]
end
#Create the node with ohai data
@@ -305,7 +305,7 @@ describe 'Chef::Win32::Registry', :windows_only do
before(:all) do
::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|
- reg['Peter', Win32::Registry::REG_SZ] = 'Tiny'
+ reg["Peter", Win32::Registry::REG_SZ] = "Tiny"
end
end
@@ -332,11 +332,11 @@ 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] = ["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|
- reg['Peter', Win32::Registry::REG_SZ] = 'Tiny'
+ reg["Peter", Win32::Registry::REG_SZ] = "Tiny"
end
end
@@ -527,12 +527,12 @@ describe 'Chef::Win32::Registry', :windows_only do
# 64-bit
::Win32::Registry::HKEY_LOCAL_MACHINE.create("Software\\Root\\Mauve", ::Win32::Registry::KEY_ALL_ACCESS | 0x0100)
::Win32::Registry::HKEY_LOCAL_MACHINE.open('Software\\Root\\Mauve', Win32::Registry::KEY_ALL_ACCESS | 0x0100) do |reg|
- reg['Alert', Win32::Registry::REG_SZ] = 'Universal'
+ reg["Alert", Win32::Registry::REG_SZ] = "Universal"
end
# 32-bit
::Win32::Registry::HKEY_LOCAL_MACHINE.create("Software\\Root\\Poosh", ::Win32::Registry::KEY_ALL_ACCESS | 0x0200)
::Win32::Registry::HKEY_LOCAL_MACHINE.open('Software\\Root\\Poosh', Win32::Registry::KEY_ALL_ACCESS | 0x0200) do |reg|
- reg['Status', Win32::Registry::REG_SZ] = 'Lost'
+ reg["Status", Win32::Registry::REG_SZ] = "Lost"
end
end
diff --git a/spec/functional/win32/security_spec.rb b/spec/functional/win32/security_spec.rb
index 27af263860..6bac2aa07b 100644
--- a/spec/functional/win32/security_spec.rb
+++ b/spec/functional/win32/security_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/win32/security'
+ require "chef/win32/security"
end
-describe 'Chef::Win32::Security', :windows_only do
+describe "Chef::Win32::Security", :windows_only do
it "has_admin_privileges? returns true when running as admin" do
expect(Chef::ReservedNames::Win32::Security.has_admin_privileges?).to eq(true)
end
@@ -35,8 +35,8 @@ describe 'Chef::Win32::Security', :windows_only do
skip "requires user support in mixlib-shellout"
end
- describe 'get_file_security' do
- it 'should return a security descriptor when called with a path that exists' do
+ describe "get_file_security" do
+ it "should return a security descriptor when called with a path that exists" do
security_descriptor = Chef::ReservedNames::Win32::Security.get_file_security(
"C:\\Program Files")
# Make sure the security descriptor works
@@ -44,7 +44,7 @@ describe 'Chef::Win32::Security', :windows_only do
end
end
- describe 'access_check' do
+ describe "access_check" do
let(:security_descriptor) {
Chef::ReservedNames::Win32::Security.get_file_security(
"C:\\Program Files")
@@ -69,30 +69,30 @@ describe 'Chef::Win32::Security', :windows_only do
let(:desired_access) { Chef::ReservedNames::Win32::Security::FILE_GENERIC_READ }
- it 'should check if the provided token has the desired access' do
+ it "should check if the provided token has the desired access" do
expect(Chef::ReservedNames::Win32::Security.access_check(security_descriptor,
token, desired_access, mapping)).to be true
end
end
- describe 'Chef::Win32::Security::Token' do
+ describe "Chef::Win32::Security::Token" do
let(:token) {
Chef::ReservedNames::Win32::Security.open_process_token(
Chef::ReservedNames::Win32::Process.get_current_process,
token_rights)
}
- context 'with all rights' do
+ context "with all rights" do
let(:token_rights) { Chef::ReservedNames::Win32::Security::TOKEN_ALL_ACCESS }
- it 'can duplicate a token' do
+ it "can duplicate a token" do
expect{ token.duplicate_token(:SecurityImpersonation) }.not_to raise_error
end
end
- context 'with read only rights' do
+ context "with read only rights" do
let(:token_rights) { Chef::ReservedNames::Win32::Security::TOKEN_READ }
- it 'raises an exception when trying to duplicate' do
+ it "raises an exception when trying to duplicate" do
expect{ token.duplicate_token(:SecurityImpersonation) }.to raise_error(Chef::Exceptions::Win32APIError)
end
end
diff --git a/spec/functional/win32/service_manager_spec.rb b/spec/functional/win32/service_manager_spec.rb
index a1ce36146f..616a83cfcf 100644
--- a/spec/functional/win32/service_manager_spec.rb
+++ b/spec/functional/win32/service_manager_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/application/windows_service_manager'
+ require "chef/application/windows_service_manager"
end
#
diff --git a/spec/functional/win32/sid_spec.rb b/spec/functional/win32/sid_spec.rb
index 1f5f66178a..f3f3adfb56 100644
--- a/spec/functional/win32/sid_spec.rb
+++ b/spec/functional/win32/sid_spec.rb
@@ -16,39 +16,39 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/win32/security'
+ require "chef/win32/security"
end
-describe 'Chef::ReservedNames::Win32::SID', :windows_only do
+describe "Chef::ReservedNames::Win32::SID", :windows_only do
if Chef::Platform.windows?
SID ||= Chef::ReservedNames::Win32::Security::SID
end
- it 'should resolve default_security_object_group as a sane user group', :windows_not_domain_joined_only do
+ it "should resolve default_security_object_group as a sane user group", :windows_not_domain_joined_only do
# Domain accounts: domain-specific Domain Users SID
# Microsoft Accounts: SID.current_user
# Else: SID.None
expect(SID.default_security_object_group).to eq(SID.None).or eq(SID.current_user)
end
- context 'running as an elevated administrator user' do
- it 'should resolve default_security_object_owner as the Administrators group' do
+ context "running as an elevated administrator user" do
+ it "should resolve default_security_object_owner as the Administrators group" do
expect(SID.default_security_object_owner).to eq(SID.Administrators)
end
end
- context 'running as a non-elevated administrator user' do
- it 'should resolve default_security_object_owner as the current user' do
- skip 'requires user support in mixlib-shellout, see security_spec.rb'
+ context "running as a non-elevated administrator user" do
+ it "should resolve default_security_object_owner as the current user" do
+ skip "requires user support in mixlib-shellout, see security_spec.rb"
expect(SID.default_security_object_owner).to eq(SID.Administrators)
end
end
- context 'running as a non-elevated, non-administrator user' do
- it 'should resolve default_security_object_owner as the current user' do
- skip 'requires user support in mixlib-shellout, see security_spec.rb'
+ context "running as a non-elevated, non-administrator user" do
+ it "should resolve default_security_object_owner as the current user" do
+ skip "requires user support in mixlib-shellout, see security_spec.rb"
expect(SID.default_security_object_owner).to eq(SID.current_user)
end
end
diff --git a/spec/functional/win32/version_info_spec.rb b/spec/functional/win32/version_info_spec.rb
index c7d41f9616..162033462d 100644
--- a/spec/functional/win32/version_info_spec.rb
+++ b/spec/functional/win32/version_info_spec.rb
@@ -16,18 +16,18 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/win32/file/version_info'
+ require "chef/win32/file/version_info"
end
describe "Chef::ReservedNames::Win32::File::VersionInfo", :windows_only do
- require 'wmi-lite/wmi'
- let(:file_path) { ENV['ComSpec'] }
+ require "wmi-lite/wmi"
+ let(:file_path) { ENV["ComSpec"] }
let(:os_version) do
wmi = WmiLite::Wmi.new
- os_info = wmi.first_of('Win32_OperatingSystem')
- os_info['version']
+ os_info = wmi.first_of("Win32_OperatingSystem")
+ os_info["version"]
end
subject { Chef::ReservedNames::Win32::File::VersionInfo.new(file_path) }
diff --git a/spec/functional/win32/versions_spec.rb b/spec/functional/win32/versions_spec.rb
index 38af47b0c9..8cd6c74fa3 100644
--- a/spec/functional/win32/versions_spec.rb
+++ b/spec/functional/win32/versions_spec.rb
@@ -16,16 +16,16 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/win32/version'
+ require "chef/win32/version"
end
describe "Chef::ReservedNames::Win32::Version", :windows_only, :not_supported_on_win2k3 do
before do
wmi = WmiLite::Wmi.new
- host = wmi.first_of('Win32_OperatingSystem')
+ host = wmi.first_of("Win32_OperatingSystem")
# Use WMI to determine current OS version.
# On Win2k8R2 and later, we can dynamically obtain marketing
@@ -37,14 +37,14 @@ describe "Chef::ReservedNames::Win32::Version", :windows_only, :not_supported_on
# 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?
- @current_os_version = 'Windows Server 2003 R2'
+ @current_os_version = "Windows Server 2003 R2"
elsif is_windows_server_2008?(host)
- @current_os_version = 'Windows Server 2008'
+ @current_os_version = "Windows Server 2008"
else
# The name from WMI is actually what we want in Win2k8R2+.
# So this expectation sould continue to hold without modification
# as new versions of Windows are released.
- @current_os_version = host['caption']
+ @current_os_version = host["caption"]
end
@version = Chef::ReservedNames::Win32::Version.new
@@ -98,20 +98,20 @@ describe "Chef::ReservedNames::Win32::Version", :windows_only, :not_supported_on
def is_windows_server_2008?(wmi_host)
is_win2k8 = false
- os_version = wmi_host['version']
+ os_version = wmi_host["version"]
# The operating system version is a string in the following form
# that can be split into components based on the '.' delimiter:
# MajorVersionNumber.MinorVersionNumber.BuildNumber
- os_version_components = os_version.split('.')
+ os_version_components = os_version.split(".")
if os_version_components.length < 2
- raise 'WMI returned a Windows version from Win32_OperatingSystem.Version ' +
- 'with an unexpected format. The Windows version could not be determined.'
+ raise "WMI returned a Windows version from Win32_OperatingSystem.Version " +
+ "with an unexpected format. The Windows version could not be determined."
end
# Windows 6.0 is Windows Server 2008, so test the major and
# minor version components
- is_win2k8 = os_version_components[0] == '6' && os_version_components[1] == '0'
+ is_win2k8 = os_version_components[0] == "6" && os_version_components[1] == "0"
end
end