summaryrefslogtreecommitdiff
path: root/spec/functional
diff options
context:
space:
mode:
Diffstat (limited to 'spec/functional')
-rw-r--r--spec/functional/audit/runner_spec.rb4
-rw-r--r--spec/functional/dsl/reboot_pending_spec.rb4
-rw-r--r--spec/functional/dsl/registry_helper_spec.rb8
-rw-r--r--spec/functional/event_loggers/windows_eventlog_spec.rb6
-rw-r--r--spec/functional/file_content_management/deploy_strategies_spec.rb3
-rw-r--r--spec/functional/knife/cookbook_delete_spec.rb8
-rw-r--r--spec/functional/knife/exec_spec.rb2
-rw-r--r--spec/functional/knife/smoke_test.rb2
-rw-r--r--spec/functional/knife/ssh_spec.rb2
-rw-r--r--spec/functional/mixin/shell_out_spec.rb4
-rw-r--r--spec/functional/notifications_spec.rb5
-rwxr-xr-xspec/functional/provider/remote_file/cache_control_data_spec.rb13
-rw-r--r--spec/functional/provider/whyrun_safe_ruby_block_spec.rb2
-rwxr-xr-xspec/functional/resource/aix_service_spec.rb1
-rwxr-xr-xspec/functional/resource/aixinit_service_spec.rb22
-rw-r--r--spec/functional/resource/base.rb2
-rw-r--r--spec/functional/resource/bff_spec.rb2
-rw-r--r--spec/functional/resource/chocolatey_package_spec.rb12
-rw-r--r--spec/functional/resource/cron_spec.rb2
-rw-r--r--spec/functional/resource/deploy_revision_spec.rb4
-rw-r--r--spec/functional/resource/dpkg_package_spec.rb6
-rw-r--r--spec/functional/resource/dsc_resource_spec.rb2
-rw-r--r--spec/functional/resource/dsc_script_spec.rb56
-rwxr-xr-xspec/functional/resource/env_spec.rb6
-rw-r--r--spec/functional/resource/file_spec.rb3
-rw-r--r--spec/functional/resource/git_spec.rb4
-rw-r--r--spec/functional/resource/group_spec.rb20
-rw-r--r--spec/functional/resource/link_spec.rb9
-rw-r--r--spec/functional/resource/ohai_spec.rb3
-rw-r--r--spec/functional/resource/package_spec.rb10
-rw-r--r--spec/functional/resource/powershell_script_spec.rb76
-rw-r--r--spec/functional/resource/registry_spec.rb131
-rw-r--r--spec/functional/resource/remote_directory_spec.rb4
-rw-r--r--spec/functional/resource/remote_file_spec.rb2
-rw-r--r--spec/functional/resource/template_spec.rb4
-rw-r--r--spec/functional/resource/user/useradd_spec.rb26
-rw-r--r--spec/functional/resource/windows_package_spec.rb8
-rw-r--r--spec/functional/resource/windows_service_spec.rb6
-rw-r--r--spec/functional/run_lock_spec.rb9
-rw-r--r--spec/functional/shell_spec.rb4
-rw-r--r--spec/functional/tiny_server_spec.rb12
-rw-r--r--spec/functional/util/powershell/cmdlet_spec.rb30
-rw-r--r--spec/functional/win32/crypto_spec.rb2
-rw-r--r--spec/functional/win32/registry_spec.rb180
-rw-r--r--spec/functional/win32/security_spec.rb6
-rw-r--r--spec/functional/win32/service_manager_spec.rb7
-rw-r--r--spec/functional/win32/versions_spec.rb2
47 files changed, 361 insertions, 375 deletions
diff --git a/spec/functional/audit/runner_spec.rb b/spec/functional/audit/runner_spec.rb
index dcfa69c349..54f014e28f 100644
--- a/spec/functional/audit/runner_spec.rb
+++ b/spec/functional/audit/runner_spec.rb
@@ -63,7 +63,7 @@ describe Chef::Audit::Runner do
expect(2 - 2).to eq(0)
end
end
- { control_group_name => Struct.new(:args, :block).new([control_group_name], should_pass)}
+ { control_group_name => Struct.new(:args, :block).new([control_group_name], should_pass) }
end
end
@@ -74,7 +74,7 @@ describe Chef::Audit::Runner do
expect(2 - 1).to eq(0)
end
end
- { control_group_name => Struct.new(:args, :block).new([control_group_name], should_fail)}
+ { control_group_name => Struct.new(:args, :block).new([control_group_name], should_fail) }
end
end
diff --git a/spec/functional/dsl/reboot_pending_spec.rb b/spec/functional/dsl/reboot_pending_spec.rb
index 6f600ca325..c7a93c6822 100644
--- a/spec/functional/dsl/reboot_pending_spec.rb
+++ b/spec/functional/dsl/reboot_pending_spec.rb
@@ -22,7 +22,7 @@ require "spec_helper"
describe Chef::DSL::RebootPending, :windows_only do
def run_ohai
- node.consume_external_attrs(OHAI_SYSTEM.data,{})
+ node.consume_external_attrs(OHAI_SYSTEM.data, {})
end
let(:node) { Chef::Node.new }
@@ -98,7 +98,7 @@ describe Chef::DSL::RebootPending, :windows_only do
describe "when there is nothing to indicate a reboot is pending" do
it "should return false" do
- skip "reboot pending" if @any_flag.any? { |_,v| v == true }
+ skip "reboot pending" if @any_flag.any? { |_, v| v == true }
expect(recipe.reboot_pending?).to be_falsey
end
end
diff --git a/spec/functional/dsl/registry_helper_spec.rb b/spec/functional/dsl/registry_helper_spec.rb
index 885615b6d7..d90d5090e4 100644
--- a/spec/functional/dsl/registry_helper_spec.rb
+++ b/spec/functional/dsl/registry_helper_spec.rb
@@ -31,7 +31,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
events = Chef::EventDispatch::Dispatcher.new
node = Chef::Node.new
- node.consume_external_attrs(OHAI_SYSTEM.data,{})
+ node.consume_external_attrs(OHAI_SYSTEM.data, {})
run_context = Chef::RunContext.new(node, {}, events)
@resource = Chef::Resource.new("foo", run_context)
end
@@ -42,7 +42,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
end
it "returns true if registry has specified value" do
values = @resource.registry_get_values("HKCU\\Software\\Root")
- expect(values.include?({:name=>"RootType1",:type=>:string,:data=>"fibrous"})).to eq(true)
+ expect(values.include?({ :name => "RootType1", :type => :string, :data => "fibrous" })).to eq(true)
end
it "returns true if specified registry_has_subkey" do
expect(@resource.registry_has_subkeys?("HKCU\\Software\\Root")).to eq(true)
@@ -52,10 +52,10 @@ describe Chef::Resource::RegistryKey, :windows_only do
expect(subkeys.include?("Branch")).to eq(true)
end
it "returns true if registry_value_exists" do
- expect(@resource.registry_value_exists?("HKCU\\Software\\Root", {:name=>"RootType1", :type=>:string, :data=>"fibrous"})).to eq(true)
+ expect(@resource.registry_value_exists?("HKCU\\Software\\Root", { :name => "RootType1", :type => :string, :data => "fibrous" })).to eq(true)
end
it "returns true if data_value_exists" do
- expect(@resource.registry_data_exists?("HKCU\\Software\\Root", {:name=>"RootType1", :type=>:string, :data=>"fibrous"})).to eq(true)
+ expect(@resource.registry_data_exists?("HKCU\\Software\\Root", { :name => "RootType1", :type => :string, :data => "fibrous" })).to eq(true)
end
end
end
diff --git a/spec/functional/event_loggers/windows_eventlog_spec.rb b/spec/functional/event_loggers/windows_eventlog_spec.rb
index 0f59e64f25..031405f718 100644
--- a/spec/functional/event_loggers/windows_eventlog_spec.rb
+++ b/spec/functional/event_loggers/windows_eventlog_spec.rb
@@ -26,7 +26,7 @@ end
describe Chef::EventLoggers::WindowsEventLogger, :windows_only, :not_supported_on_win2k3 do
def rand
- random.rand(1<<32).to_s
+ random.rand(1 << 32).to_s
end
let(:random) { Random.new }
@@ -36,10 +36,10 @@ describe Chef::EventLoggers::WindowsEventLogger, :windows_only, :not_supported_o
let(:logger) { Chef::EventLoggers::WindowsEventLogger.new }
let(:flags) { nil }
let(:node) { nil }
- let(:run_status) { double("Run Status", {run_id: run_id, elapsed_time: elapsed_time }) }
+ let(:run_status) { double("Run Status", { run_id: run_id, elapsed_time: elapsed_time }) }
let(:event_log) { EventLog.new("Application") }
let!(:offset) { event_log.read_last_event.record_number }
- let(:mock_exception) { double("Exception", {message: rand, backtrace: [rand, rand]})}
+ let(:mock_exception) { double("Exception", { message: rand, backtrace: [rand, rand] }) }
it "is available" do
expect(Chef::EventLoggers::WindowsEventLogger.available?).to be_truthy
diff --git a/spec/functional/file_content_management/deploy_strategies_spec.rb b/spec/functional/file_content_management/deploy_strategies_spec.rb
index d3fc6bcd37..7c54af347c 100644
--- a/spec/functional/file_content_management/deploy_strategies_spec.rb
+++ b/spec/functional/file_content_management/deploy_strategies_spec.rb
@@ -38,7 +38,6 @@ shared_examples_for "a content deploy strategy" do
let(:content_deployer) { described_class.new }
let(:target_file_path) { File.join(sandbox_dir, "cp-deploy-strategy-target-file.txt") }
-
describe "creating the file" do
##
@@ -69,7 +68,7 @@ shared_examples_for "a content deploy strategy" do
def ace_inherits?(ace)
flags = ace.flags
- (flags & masks::OBJECT_INHERIT_ACE) !=0
+ (flags & masks::OBJECT_INHERIT_ACE) != 0
end
let(:parent_inheritable_aces) do
diff --git a/spec/functional/knife/cookbook_delete_spec.rb b/spec/functional/knife/cookbook_delete_spec.rb
index 1757b22842..a43e3a36c4 100644
--- a/spec/functional/knife/cookbook_delete_spec.rb
+++ b/spec/functional/knife/cookbook_delete_spec.rb
@@ -44,7 +44,7 @@ describe Chef::Knife::CookbookDelete do
before do
@knife.name_args = %w{no-such-cookbook}
- @api.get("/cookbooks/no-such-cookbook", 404, Chef::JSONCompat.to_json({"error"=>"dear Tim, no. -Sent from my iPad"}))
+ @api.get("/cookbooks/no-such-cookbook", 404, Chef::JSONCompat.to_json({ "error" => "dear Tim, no. -Sent from my iPad" }))
end
around do |ex|
@@ -62,7 +62,7 @@ describe Chef::Knife::CookbookDelete do
it "logs an error and exits" do
allow(@knife.ui).to receive(:stderr).and_return(log_output)
- expect {@knife.run}.to raise_error(SystemExit)
+ expect { @knife.run }.to raise_error(SystemExit)
expect(log_output.string).to match(/Cannot find a cookbook named no-such-cookbook to delete/)
end
@@ -71,7 +71,7 @@ describe Chef::Knife::CookbookDelete do
context "when there is only one version of a cookbook" do
before do
@knife.name_args = %w{obsolete-cookbook}
- @cookbook_list = {"obsolete-cookbook" => { "versions" => ["version" => "1.0.0"]} }
+ @cookbook_list = { "obsolete-cookbook" => { "versions" => ["version" => "1.0.0"] } }
@api.get("/cookbooks/obsolete-cookbook", 200, Chef::JSONCompat.to_json(@cookbook_list))
end
@@ -114,7 +114,7 @@ describe Chef::Knife::CookbookDelete do
@knife.name_args = %w{obsolete-cookbook}
versions = ["1.0.0", "1.1.0", "1.2.0"]
with_version = lambda { |version| { "version" => version } }
- @cookbook_list = {"obsolete-cookbook" => { "versions" => versions.map(&with_version) } }
+ @cookbook_list = { "obsolete-cookbook" => { "versions" => versions.map(&with_version) } }
@api.get("/cookbooks/obsolete-cookbook", 200, Chef::JSONCompat.to_json(@cookbook_list))
end
diff --git a/spec/functional/knife/exec_spec.rb b/spec/functional/knife/exec_spec.rb
index 62e3a4c214..838d15671c 100644
--- a/spec/functional/knife/exec_spec.rb
+++ b/spec/functional/knife/exec_spec.rb
@@ -44,7 +44,7 @@ describe Chef::Knife::Exec do
it "executes a script in the context of the chef-shell main context" do
@node = Chef::Node.new
@node.name("ohai-world")
- response = {"rows" => [@node],"start" => 0,"total" => 1}
+ response = { "rows" => [@node], "start" => 0, "total" => 1 }
@api.get(%r{^/search/node}, 200, Chef::JSONCompat.to_json(response))
code = "$output.puts nodes.all"
@knife.config[:exec] = code
diff --git a/spec/functional/knife/smoke_test.rb b/spec/functional/knife/smoke_test.rb
index 8681a01873..350644d177 100644
--- a/spec/functional/knife/smoke_test.rb
+++ b/spec/functional/knife/smoke_test.rb
@@ -31,7 +31,7 @@ describe "knife smoke tests" do
knife_cmd.error!
expect(knife_cmd.stdout).to include(Chef::VERSION)
end
-
+
it "can run and show help" do
knife_path = File.expand_path("../../bin/knife", CHEF_SPEC_DATA)
knife_cmd = Mixlib::ShellOut.new("#{knife_path} --help")
diff --git a/spec/functional/knife/ssh_spec.rb b/spec/functional/knife/ssh_spec.rb
index e516590905..a23220ed52 100644
--- a/spec/functional/knife/ssh_spec.rb
+++ b/spec/functional/knife/ssh_spec.rb
@@ -262,7 +262,7 @@ describe Chef::Knife::Ssh do
end
end
- def setup_knife(params=[])
+ def setup_knife(params = [])
@knife = Chef::Knife::Ssh.new(params)
# We explicitly avoid running #configure_chef, which would read a knife.rb
# if available, but #merge_configs (which is called by #configure_chef) is
diff --git a/spec/functional/mixin/shell_out_spec.rb b/spec/functional/mixin/shell_out_spec.rb
index edbfaa9ec8..48f6b7d912 100644
--- a/spec/functional/mixin/shell_out_spec.rb
+++ b/spec/functional/mixin/shell_out_spec.rb
@@ -36,9 +36,9 @@ describe Chef::Mixin::ShellOut do
describe "when environment['LC_ALL'] is set" do
it "should use the option's setting" do
cmd = if windows?
- shell_out_with_systems_locale("echo %LC_ALL%", :environment => {"LC_ALL" => "POSIX"})
+ shell_out_with_systems_locale("echo %LC_ALL%", :environment => { "LC_ALL" => "POSIX" })
else
- shell_out_with_systems_locale("echo $LC_ALL", :environment => {"LC_ALL" => "POSIX"})
+ shell_out_with_systems_locale("echo $LC_ALL", :environment => { "LC_ALL" => "POSIX" })
end
expect(cmd.stdout.chomp).to eq "POSIX"
diff --git a/spec/functional/notifications_spec.rb b/spec/functional/notifications_spec.rb
index ec6e514836..1b1ef83294 100644
--- a/spec/functional/notifications_spec.rb
+++ b/spec/functional/notifications_spec.rb
@@ -1,7 +1,6 @@
require "spec_helper"
require "chef/recipe"
-
# The goal of these tests is to make sure that loading resources from a file creates the necessary notifications.
# Then once converge has started, both immediate and delayed notifications are called as the resources are converged.
# We want to do this WITHOUT actually converging any resources - we don't want to take time changing the system,
@@ -136,7 +135,7 @@ describe "Notifications" do
expect(actions).to eq [
# First it runs why-run to check if the resource would update
- { resource: log_resource.to_s, action: :write, why_run: true },
+ { resource: log_resource.to_s, action: :write, why_run: true },
# Then it does NOT run the before action
# Then it runs the actual action
{ resource: log_resource.to_s, action: :write },
@@ -228,7 +227,7 @@ describe "Notifications" do
end
# Mocks having the provider run successfully and update the resource
- def update_action(resource, times=1)
+ def update_action(resource, times = 1)
p = Chef::Provider.new(resource, run_context)
expect(resource).to receive(:provider_for_action).exactly(times).times.and_return(p)
expect(p).to receive(:run_action).exactly(times).times {
diff --git a/spec/functional/provider/remote_file/cache_control_data_spec.rb b/spec/functional/provider/remote_file/cache_control_data_spec.rb
index e567c0b876..c56787e7e5 100755
--- a/spec/functional/provider/remote_file/cache_control_data_spec.rb
+++ b/spec/functional/provider/remote_file/cache_control_data_spec.rb
@@ -22,13 +22,13 @@ require "uri"
describe Chef::Provider::RemoteFile::CacheControlData do
before do
- @original_config = Chef::Config.hash_dup
+ @original_config = Chef::Config.hash_dup
end
after do
- Chef::Config.configuration = @original_config if @original_config
+ Chef::Config.configuration = @original_config if @original_config
end
-
+
before(:each) do
Chef::Config[:file_cache_path] = Dir.mktmpdir
end
@@ -38,7 +38,7 @@ describe Chef::Provider::RemoteFile::CacheControlData do
end
let(:uri) { URI.parse("http://www.bing.com/robots.txt") }
-
+
describe "when the cache control data save method is invoked" do
subject(:cache_control_data) do
@@ -66,7 +66,7 @@ describe Chef::Provider::RemoteFile::CacheControlData do
saved_cache_control_data = Chef::Provider::RemoteFile::CacheControlData.load_and_validate(uri, file_checksum)
expect(saved_cache_control_data.etag).to eq(cache_control_data.etag)
expect(saved_cache_control_data.mtime).to eq(cache_control_data.mtime)
- expect(saved_cache_control_data.checksum).to eq(cache_control_data.checksum)
+ expect(saved_cache_control_data.checksum).to eq(cache_control_data.checksum)
end
# Cover the very long remote file path case -- see CHEF-4422 where
@@ -91,11 +91,10 @@ describe Chef::Provider::RemoteFile::CacheControlData do
saved_cache_control_data = Chef::Provider::RemoteFile::CacheControlData.load_and_validate(uri, file_checksum)
expect(saved_cache_control_data.etag).to eq(cache_control_data.etag)
expect(saved_cache_control_data.mtime).to eq(cache_control_data.mtime)
- expect(saved_cache_control_data.checksum).to eq(cache_control_data.checksum)
+ expect(saved_cache_control_data.checksum).to eq(cache_control_data.checksum)
end
end
end
end
-
diff --git a/spec/functional/provider/whyrun_safe_ruby_block_spec.rb b/spec/functional/provider/whyrun_safe_ruby_block_spec.rb
index b68193e8b9..892e1080db 100644
--- a/spec/functional/provider/whyrun_safe_ruby_block_spec.rb
+++ b/spec/functional/provider/whyrun_safe_ruby_block_spec.rb
@@ -43,7 +43,7 @@ describe Chef::Resource::WhyrunSafeRubyBlock do
end
it "updates the evil laugh, even in why-run mode" do
- Array(new_resource.action).each {|action| new_resource.run_action(action) }
+ Array(new_resource.action).each { |action| new_resource.run_action(action) }
expect($evil_global_evil_laugh).to eq(:mwahahaha)
expect(new_resource).to be_updated
end
diff --git a/spec/functional/resource/aix_service_spec.rb b/spec/functional/resource/aix_service_spec.rb
index fe71f10cb3..5fff3e00d7 100755
--- a/spec/functional/resource/aix_service_spec.rb
+++ b/spec/functional/resource/aix_service_spec.rb
@@ -94,7 +94,6 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
shell_out!("rmssys -s ctestsys")
end
-
let(:new_resource) do
new_resource = Chef::Resource::Service.new("ctestsys", run_context)
new_resource
diff --git a/spec/functional/resource/aixinit_service_spec.rb b/spec/functional/resource/aixinit_service_spec.rb
index 63c9cf618a..92ddb52c33 100755
--- a/spec/functional/resource/aixinit_service_spec.rb
+++ b/spec/functional/resource/aixinit_service_spec.rb
@@ -39,7 +39,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
def valide_symlinks(expected_output, run_level = nil, status = nil, priority = nil)
directory = []
if priority.is_a? Hash
- priority.each do |level,o|
+ priority.each do |level, o|
directory << "/etc/rc.d/rc#{level}.d/#{(o[0] == :start ? 'S' : 'K')}#{o[1]}#{new_resource.service_name}"
end
directory
@@ -59,7 +59,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
let(:new_resource) do
new_resource = Chef::Resource::Service.new("chefinittest", run_context)
new_resource.provider Chef::Provider::Service::AixInit
- new_resource.supports({:status => true, :restart => true, :reload => true})
+ new_resource.supports({ :status => true, :restart => true, :reload => true })
new_resource
end
@@ -70,7 +70,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
before(:all) do
File.delete("/etc/rc.d/init.d/chefinittest") if File.exists?("/etc/rc.d/init.d/chefinittest")
- FileUtils.cp("#{File.join(File.dirname(__FILE__), "/../assets/chefinittest")}", "/etc/rc.d/init.d/chefinittest")
+ FileUtils.cp("#{File.join(File.dirname(__FILE__), "/../assets/chefinittest")}", "/etc/rc.d/init.d/chefinittest")
end
after(:all) 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,19 +141,19 @@ 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
context "when the service sets complex priorities (hash)" do
before do
- priority = {2 => [:start, 20], 3 => [:stop, 10]}
+ priority = { 2 => [:start, 20], 3 => [:stop, 10] }
new_resource.priority(priority)
end
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,13 +187,13 @@ 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
context "when the service sets complex priorities (hash)" do
before do
- @priority = {2 => [:stop, 20], 3 => [:start, 10]}
+ @priority = { 2 => [:stop, 20], 3 => [:start, 10] }
new_resource.priority(@priority)
File.symlink("/etc/rc.d/init.d/chefinittest", "/etc/rc.d/rc2.d/Schefinittest")
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/base.rb b/spec/functional/resource/base.rb
index 40d178479b..38175e81c0 100644
--- a/spec/functional/resource/base.rb
+++ b/spec/functional/resource/base.rb
@@ -16,7 +16,6 @@
# limitations under the License.
#
-
def run_context
@run_context ||= begin
node = Chef::Node.new
@@ -27,4 +26,3 @@ def run_context
Chef::RunContext.new(node, {}, events)
end
end
-
diff --git a/spec/functional/resource/bff_spec.rb b/spec/functional/resource/bff_spec.rb
index 326340606d..3a1d5840e8 100644
--- a/spec/functional/resource/bff_spec.rb
+++ b/spec/functional/resource/bff_spec.rb
@@ -39,7 +39,6 @@ describe Chef::Resource::BffPackage, :requires_root, :external => ohai[:platform
!::File.exists?("/usr/PkgA/bin/acommand")
end
-
before(:all) do
@pkg_name = "PkgA.rte"
@pkg_path = "/tmp/PkgA.1.0.0.0.bff"
@@ -119,4 +118,3 @@ describe Chef::Resource::BffPackage, :requires_root, :external => ohai[:platform
end
end
end
-
diff --git a/spec/functional/resource/chocolatey_package_spec.rb b/spec/functional/resource/chocolatey_package_spec.rb
index 7cbaaf0d6b..e442008060 100644
--- a/spec/functional/resource/chocolatey_package_spec.rb
+++ b/spec/functional/resource/chocolatey_package_spec.rb
@@ -31,7 +31,7 @@ describe Chef::Resource::ChocolateyPackage, :windows_only do
let(:package_name) { "test-A" }
let(:package_list) { proc { powershell_out!("choco list -lo -r #{Array(package_name).join(' ')}").stdout.chomp } }
let(:package_source) { File.join(CHEF_SPEC_ASSETS, "chocolatey_feed") }
-
+
subject do
new_resource = Chef::Resource::ChocolateyPackage.new("test choco package", run_context)
new_resource.package_name package_name
@@ -80,13 +80,13 @@ describe Chef::Resource::ChocolateyPackage, :windows_only do
it "raises if package is not found" do
subject.package_name "blah"
- expect{ subject.run_action(:install) }.to raise_error Chef::Exceptions::Package
+ expect { subject.run_action(:install) }.to raise_error Chef::Exceptions::Package
end
- it "raises if package version is not found" do
+ it "raises if package version is not found" do
subject.version "3.0"
- expect{ subject.run_action(:install) }.to raise_error Chef::Exceptions::Package
- end
+ expect { subject.run_action(:install) }.to raise_error Chef::Exceptions::Package
+ end
end
context "upgrading a package" do
@@ -121,4 +121,4 @@ describe Chef::Resource::ChocolateyPackage, :windows_only do
expect(package_list.call).to eq("")
end
end
-end \ No newline at end of file
+end
diff --git a/spec/functional/resource/cron_spec.rb b/spec/functional/resource/cron_spec.rb
index 8c12b6e867..2906715f7a 100644
--- a/spec/functional/resource/cron_spec.rb
+++ b/spec/functional/resource/cron_spec.rb
@@ -108,7 +108,7 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do
describe "create action with various attributes", :external => exclude_solaris do
def create_and_validate_with_attribute(resource, attribute, value)
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./)
+ 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)
# Verify if the cron is created successfully
diff --git a/spec/functional/resource/deploy_revision_spec.rb b/spec/functional/resource/deploy_revision_spec.rb
index 184c1cd017..4772067949 100644
--- a/spec/functional/resource/deploy_revision_spec.rb
+++ b/spec/functional/resource/deploy_revision_spec.rb
@@ -799,7 +799,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
let(:deploy_that_fails) do
resource = deploy_to_latest_rev.dup
- errant_callback = lambda {|x| raise Exception, "I am a failed deploy" }
+ errant_callback = lambda { |x| raise Exception, "I am a failed deploy" }
resource.send(callback, &errant_callback)
resource
end
@@ -862,7 +862,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
let(:deploy_that_fails) do
resource = deploy_to_previous_rev.dup
- resource.after_restart {|x| raise Exception, "I am a failed deploy" }
+ resource.after_restart { |x| raise Exception, "I am a failed deploy" }
resource
end
diff --git a/spec/functional/resource/dpkg_package_spec.rb b/spec/functional/resource/dpkg_package_spec.rb
index 3a09faf0d6..d65256231b 100644
--- a/spec/functional/resource/dpkg_package_spec.rb
+++ b/spec/functional/resource/dpkg_package_spec.rb
@@ -33,7 +33,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
Chef::RunContext.new(node, {}, events)
}
- let(:dpkg_package) { Chef::Resource::DpkgPackage.new(test1_0, run_context)}
+ let(:dpkg_package) { Chef::Resource::DpkgPackage.new(test1_0, run_context) }
before(:each) do
shell_out("dpkg -P chef-integration-test chef-integration-test2")
@@ -45,7 +45,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.package_name name
end
- def should_be_purged_or_removed(package, action=nil)
+ def should_be_purged_or_removed(package, action = nil)
status = shell_out("dpkg -s #{package}")
output = status.stdout + status.stderr
if action.nil? || action == :purge
@@ -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
diff --git a/spec/functional/resource/dsc_resource_spec.rb b/spec/functional/resource/dsc_resource_spec.rb
index f2c943f21d..129333c190 100644
--- a/spec/functional/resource/dsc_resource_spec.rb
+++ b/spec/functional/resource/dsc_resource_spec.rb
@@ -52,7 +52,7 @@ describe Chef::Resource::DscResource, :windows_powershell_dsc_only do
context "with a valid dsc resource" do
let(:tmp_file_name) { Dir::Tmpname.create("tmpfile") {} }
- let(:test_text) { "'\"!@#$%^&*)(}{][\u2713~n"}
+ let(:test_text) { "'\"!@#$%^&*)(}{][\u2713~n" }
before do
new_resource.resource :File
diff --git a/spec/functional/resource/dsc_script_spec.rb b/spec/functional/resource/dsc_script_spec.rb
index cb8d73f746..5f264fdca1 100644
--- a/spec/functional/resource/dsc_script_spec.rb
+++ b/spec/functional/resource/dsc_script_spec.rb
@@ -38,7 +38,7 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only do
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
@@ -68,7 +68,7 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only do
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["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)
@@ -83,7 +83,7 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only do
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(: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}
Registry "ChefRegKey"
@@ -105,17 +105,17 @@ EOH
let(:dsc_user_prefix) { "dsc" }
let(:dsc_user_suffix) { "chefx" }
- let(:dsc_user) {"#{dsc_user_prefix}_usr_#{dsc_user_suffix}" }
+ 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_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_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_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})\""}
- let(:dsc_user_param_code) { "\"$(#{dsc_user_prefix_param_code})_usr_$(#{dsc_user_suffix_param_code})\""}
+ 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})\"" }
+ let(:dsc_user_param_code) { "\"$(#{dsc_user_prefix_param_code})_usr_$(#{dsc_user_suffix_param_code})\"" }
let(:config_flags) { nil }
let(:config_params) { <<-EOH
@@ -157,7 +157,7 @@ EOH
}
let(:dsc_user_config_data) {
-<<-EOH
+ <<-EOH
@{
AllNodes = @(
@{
@@ -220,7 +220,7 @@ EOH
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)
+ 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"
@@ -243,12 +243,12 @@ EOH
let(:dsc_code) { dsc_environment_config }
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
+ expect { dsc_test_resource.run_action(:run) }.not_to raise_error
end
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)
+ expect { dsc_test_resource.run_action(:run) }.to raise_error(Chef::Exceptions::PowershellCmdletException)
begin
dsc_test_resource.run_action(:run)
rescue Chef::Exceptions::PowershellCmdletException => e
@@ -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)
@@ -296,11 +296,11 @@ EOH
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})
+ 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)
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)
+ expect(dsc_test_resource.registry_value_exists?(test_registry_key, { :name => test_registry_value, :type => :string, :data => test_registry_data })).to eq(true)
end
end
end
@@ -320,12 +320,12 @@ EOH
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})
+ dsc_test_resource.environment({ dsc_user_prefix_env_var_name => dsc_user_prefix,
+ dsc_user_suffix_env_var_name => dsc_user_suffix })
dsc_test_resource.send(configuration_data_attribute, config_data_value)
dsc_test_resource.flags(config_flags)
expect(user_exists?(dsc_user)).to eq(false)
- expect {dsc_test_resource.run_action(:run)}.not_to raise_error
+ expect { dsc_test_resource.run_action(:run) }.not_to raise_error
expect(user_exists?(dsc_user)).to eq(true)
end
end
@@ -333,9 +333,9 @@ EOH
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}"}}
+ 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
- configuration_script_content = ::File.open(dsc_test_resource.command) do | file |
+ configuration_script_content = ::File.open(dsc_test_resource.command) do |file|
file.read
end
expect(configuration_script_content.include?(dsc_user)).to be(false)
@@ -347,7 +347,7 @@ EOH
let(:dsc_user_code) { dsc_user_env_code }
it "does not directly contain the user name" do
- configuration_script_content = ::File.open(dsc_test_resource.command) do | file |
+ configuration_script_content = ::File.open(dsc_test_resource.command) do |file|
file.read
end
expect(configuration_script_content.include?(dsc_user)).to be(false)
@@ -385,7 +385,7 @@ EOH
before(:each) do
delete_user(dsc_user)
- dsc_test_run_context.node.consume_external_attrs(OHAI_SYSTEM.data,{})
+ dsc_test_run_context.node.consume_external_attrs(OHAI_SYSTEM.data, {})
end
let(:configuration_data_path) { 'C:\\configurationdata.psd1' }
@@ -422,12 +422,12 @@ if($cert -eq $null) {
}
lcm -thumbprint $cert.thumbprint
-set-dsclocalconfigurationmanager -path ./LCM
+set-dsclocalconfigurationmanager -path ./LCM
$ConfigurationData = @"
@{
-AllNodes = @(
- @{
- NodeName = "localhost";
+AllNodes = @(
+ @{
+ NodeName = "localhost";
CertificateID = '$($cert.thumbprint)';
};
);
diff --git a/spec/functional/resource/env_spec.rb b/spec/functional/resource/env_spec.rb
index 91fa860cd7..83328a6738 100755
--- a/spec/functional/resource/env_spec.rb
+++ b/spec/functional/resource/env_spec.rb
@@ -90,7 +90,7 @@ describe Chef::Resource::Env, :windows_only 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)
- expect {test_resource.run_action(:modify) }.to raise_error(Chef::Exceptions::Env)
+ expect { test_resource.run_action(:modify) }.to raise_error(Chef::Exceptions::Env)
end
it "should modify an existing variable's value to a new value" do
@@ -127,7 +127,7 @@ describe Chef::Resource::Env, :windows_only do
context "when using PATH" do
let(:random_name) { Time.now.to_i }
- let(:env_val) { "#{env_value_expandable}_#{random_name}"}
+ 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"] }
@@ -165,7 +165,7 @@ describe Chef::Resource::Env, :windows_only 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)
- expect{test_resource.run_action(:delete)}.not_to raise_error
+ expect { test_resource.run_action(:delete) }.not_to raise_error
expect(ENV[chef_env_test_lower_case]).to eq(nil)
end
diff --git a/spec/functional/resource/file_spec.rb b/spec/functional/resource/file_spec.rb
index d7ca34ecb8..0fa1317032 100644
--- a/spec/functional/resource/file_spec.rb
+++ b/spec/functional/resource/file_spec.rb
@@ -25,7 +25,7 @@ describe Chef::Resource::File do
let(:file_base) { "file_spec" }
let(:expected_content) { "Don't fear the ruby." }
- def create_resource(opts={})
+ def create_resource(opts = {})
events = Chef::EventDispatch::Dispatcher.new
node = Chef::Node.new
run_context = Chef::RunContext.new(node, {}, events)
@@ -86,7 +86,6 @@ describe Chef::Resource::File do
end
end
-
describe "when using backup" do
before do
Chef::Config[:file_backup_path] = CHEF_SPEC_BACKUP_PATH
diff --git a/spec/functional/resource/git_spec.rb b/spec/functional/resource/git_spec.rb
index 8710b22f31..7174a99451 100644
--- a/spec/functional/resource/git_spec.rb
+++ b/spec/functional/resource/git_spec.rb
@@ -62,7 +62,7 @@ describe Chef::Resource::Git do
let(:v1_tag) { "9b73fb5e316bfaff7b822b0ccb3e1e08f9885085" }
let(:rev_foo) { "ed181b3419b6f489bedab282348162a110d6d3a1" }
let(:rev_testing) { "972d153654503bccec29f630c5dd369854a561e8" }
- let(:rev_head) { "d294fbfd05aa7709ad9a9b8ef6343b17d355bf5f"}
+ let(:rev_head) { "d294fbfd05aa7709ad9a9b8ef6343b17d355bf5f" }
let(:git_user_config) do
<<-E
@@ -76,7 +76,7 @@ E
Chef::Log.level = :warn # silence git command live streams
@old_file_cache_path = Chef::Config[:file_cache_path]
shell_out!("git clone \"#{git_bundle_repo}\" example", :cwd => origin_repo_dir)
- File.open("#{origin_repo}/.git/config", "a+") {|f| f.print(git_user_config) }
+ File.open("#{origin_repo}/.git/config", "a+") { |f| f.print(git_user_config) }
Chef::Config[:file_cache_path] = file_cache_path
end
diff --git a/spec/functional/resource/group_spec.rb b/spec/functional/resource/group_spec.rb
index cb460fe7b4..063b5d9004 100644
--- a/spec/functional/resource/group_spec.rb
+++ b/spec/functional/resource/group_spec.rb
@@ -334,7 +334,7 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" }
invalid_resource = group_resource.dup
invalid_resource.members(["Jack"])
invalid_resource.excluded_members(["Jack"])
- expect { invalid_resource.run_action(:create)}.to raise_error(Chef::Exceptions::ConflictingMembersInGroup)
+ expect { invalid_resource.run_action(:create) }.to raise_error(Chef::Exceptions::ConflictingMembersInGroup)
end
end
end
@@ -361,7 +361,7 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" }
end
describe "group modify action", :not_supported_on_solaris do
- let(:spec_members){ ["mnou5sdz", "htulrvwq", "x4c3g1lu"] }
+ let(:spec_members) { ["mnou5sdz", "htulrvwq", "x4c3g1lu"] }
let(:included_members) { [spec_members[0], spec_members[1]] }
let(:excluded_members) { [spec_members[2]] }
let(:tested_action) { :modify }
@@ -379,7 +379,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(:spec_members){ ["#{computer_domain}\\Domain Admins", "#{computer_domain}\\Domain Users", "#{computer_domain}\\Domain Computers"] }
+ let(:spec_members) { ["#{computer_domain}\\Domain Admins", "#{computer_domain}\\Domain Users", "#{computer_domain}\\Domain Computers"] }
include_examples "correct group management"
end
@@ -389,7 +389,7 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" }
end
describe "group manage action", :not_supported_on_solaris do
- let(:spec_members){ ["mnou5sdz", "htulrvwq", "x4c3g1lu"] }
+ let(:spec_members) { ["mnou5sdz", "htulrvwq", "x4c3g1lu"] }
let(:included_members) { [spec_members[0], spec_members[1]] }
let(:excluded_members) { [spec_members[2]] }
let(:tested_action) { :manage }
@@ -416,7 +416,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(:spec_members){ ["#{computer_domain}\\Domain Admins", "#{computer_domain}\\Domain Users", "#{computer_domain}\\Domain Computers"] }
+ let(:spec_members) { ["#{computer_domain}\\Domain Admins", "#{computer_domain}\\Domain Users", "#{computer_domain}\\Domain Computers"] }
include_examples "correct group management"
end
@@ -430,15 +430,15 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" }
let(:excluded_members) { ["x4c3g1lu"] }
it ":manage should raise an error" do
- expect {group_resource.run_action(:manage) }.to raise_error
+ expect { group_resource.run_action(:manage) }.to raise_error
end
it ":modify should raise an error" do
- expect {group_resource.run_action(:modify) }.to raise_error
+ expect { group_resource.run_action(:modify) }.to raise_error
end
it ":create should raise an error" do
- expect {group_resource.run_action(:create) }.to raise_error
+ expect { group_resource.run_action(:create) }.to raise_error
end
end
@@ -450,11 +450,11 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" }
end
it ":manage should raise an error" do
- expect {group_resource.run_action(:manage) }.to raise_error
+ expect { group_resource.run_action(:manage) }.to raise_error
end
it ":modify should raise an error" do
- expect {group_resource.run_action(:modify) }.to raise_error
+ expect { group_resource.run_action(:modify) }.to raise_error
end
end
end
diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb
index cfb20f0c69..9b9d696979 100644
--- a/spec/functional/resource/link_spec.rb
+++ b/spec/functional/resource/link_spec.rb
@@ -25,7 +25,7 @@ end
describe Chef::Resource::Link do
let(:file_base) { "file_spec" }
- let(:expect_updated?) {true}
+ let(:expect_updated?) { true }
# We create the files in a different directory than tmp to exercise
# different file deployment strategies more completely.
@@ -83,6 +83,7 @@ describe Chef::Resource::Link do
File.symlink(a, b)
end
end
+
def symlink?(file)
if windows?
Chef::ReservedNames::Win32::File.symlink?(file)
@@ -90,6 +91,7 @@ describe Chef::Resource::Link do
File.symlink?(file)
end
end
+
def readlink(file)
if windows?
Chef::ReservedNames::Win32::File.readlink(file)
@@ -97,6 +99,7 @@ describe Chef::Resource::Link do
File.readlink(file)
end
end
+
def link(a, b)
if windows?
Chef::ReservedNames::Win32::File.link(a, b)
@@ -354,9 +357,11 @@ describe Chef::Resource::Link do
def allowed_acl(sid, expected_perms)
[ ACE.access_allowed(sid, expected_perms[:specific]) ]
end
+
def denied_acl(sid, expected_perms)
[ ACE.access_denied(sid, expected_perms[:specific]) ]
end
+
def parent_inheritable_acls
dummy_file_path = File.join(test_file_dir, "dummy_file")
FileUtils.touch(dummy_file_path)
@@ -602,7 +607,7 @@ describe Chef::Resource::Link do
describe "when not supported on platform", :win2k3_only do
it "raises error" do
- expect {resource}.to raise_error(Chef::Exceptions::Win32APIFunctionNotImplemented)
+ expect { resource }.to raise_error(Chef::Exceptions::Win32APIFunctionNotImplemented)
end
end
end
diff --git a/spec/functional/resource/ohai_spec.rb b/spec/functional/resource/ohai_spec.rb
index ff7666392a..9ce989d8df 100644
--- a/spec/functional/resource/ohai_spec.rb
+++ b/spec/functional/resource/ohai_spec.rb
@@ -45,7 +45,7 @@ describe Chef::Resource::Ohai do
end
describe "when reloading all plugins" do
- let(:ohai_resource) { Chef::Resource::Ohai.new("reload all", run_context)}
+ let(:ohai_resource) { Chef::Resource::Ohai.new("reload all", run_context) }
it_behaves_like "reloaded :uptime"
end
@@ -57,7 +57,6 @@ describe Chef::Resource::Ohai do
r
}
-
it_behaves_like "reloaded :uptime"
end
end
diff --git a/spec/functional/resource/package_spec.rb b/spec/functional/resource/package_spec.rb
index 499b2d6b78..36b106bf1c 100644
--- a/spec/functional/resource/package_spec.rb
+++ b/spec/functional/resource/package_spec.rb
@@ -87,9 +87,9 @@ module AptServer
end
metadata = { :unix_only => true,
- :requires_root => true,
- :provider => {:package => Chef::Provider::Package::Apt},
- :arch => "x86_64" # test packages are 64bit
+ :requires_root => true,
+ :provider => { :package => Chef::Provider::Package::Apt },
+ :arch => "x86_64" # test packages are 64bit
}
describe Chef::Resource::Package, metadata do
@@ -112,7 +112,6 @@ describe Chef::Resource::Package, metadata do
shell_out!("apt-get clean")
end
-
after do
shell_out!("dpkg -r chef-integration-test")
shell_out("dpkg --clear-avail")
@@ -325,14 +324,13 @@ describe Chef::Resource::Package, metadata do
# un chef-integration-test <none> (no description available)
def pkg_should_be_removed
# will raise if exit code != 0,1
- pkg_check = shell_out!("dpkg -l chef-integration-test", :returns => [0,1])
+ pkg_check = shell_out!("dpkg -l chef-integration-test", :returns => [0, 1])
if pkg_check.exitstatus == 0
expect(pkg_check.stdout).to match(/un[\s]+chef-integration-test/)
end
end
-
it "removes the package for action :remove" do
package_resource.run_action(:remove)
pkg_should_be_removed
diff --git a/spec/functional/resource/powershell_script_spec.rb b/spec/functional/resource/powershell_script_spec.rb
index 2d9e1458a7..7a7f7a2ded 100644
--- a/spec/functional/resource/powershell_script_spec.rb
+++ b/spec/functional/resource/powershell_script_spec.rb
@@ -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
@@ -325,7 +325,7 @@ configuration LCM
it "raises an error when executing a script with a 32-bit process on Windows Nano Server", :windows_nano_only do
resource.code(processor_architecture_script_content + " | out-file -encoding ASCII #{script_output_path}")
- expect{ resource.architecture(:i386) }.to raise_error(Chef::Exceptions::Win32ArchitectureIncorrect,
+ expect { resource.architecture(:i386) }.to raise_error(Chef::Exceptions::Win32ArchitectureIncorrect,
"cannot execute script with requested architecture 'i386' on Windows Nano Server")
end
end
@@ -342,22 +342,22 @@ configuration LCM
end
it "evaluates a succeeding not_if block using cmd.exe as false by default" do
- resource.not_if "exit /b 0"
+ resource.not_if "exit /b 0"
expect(resource.should_skip?(:run)).to be_truthy
end
it "evaluates a failing not_if block using cmd.exe as true by default" do
- resource.not_if "exit /b 2"
+ resource.not_if "exit /b 2"
expect(resource.should_skip?(:run)).to be_falsey
end
it "evaluates an succeeding only_if block using cmd.exe as true by default" do
- resource.only_if "exit /b 0"
+ resource.only_if "exit /b 0"
expect(resource.should_skip?(:run)).to be_falsey
end
it "evaluates a failing only_if block using cmd.exe as false by default" do
- resource.only_if "exit /b 2"
+ resource.only_if "exit /b 2"
expect(resource.should_skip?(:run)).to be_truthy
end
end
@@ -383,77 +383,77 @@ configuration LCM
it "evaluates a powershell $false for a not_if block as true" do
pending "powershell.exe always exits with $true on nano" if Chef::Platform.windows_nano_server?
- resource.not_if "$false"
+ resource.not_if "$false"
expect(resource.should_skip?(:run)).to be_falsey
end
it "evaluates a powershell $true for a not_if block as false" do
- resource.not_if "$true"
+ resource.not_if "$true"
expect(resource.should_skip?(:run)).to be_truthy
end
it "evaluates a powershell $false for an only_if block as false" do
pending "powershell.exe always exits with $true on nano" if Chef::Platform.windows_nano_server?
- resource.only_if "$false"
+ resource.only_if "$false"
expect(resource.should_skip?(:run)).to be_truthy
end
it "evaluates a powershell $true for a only_if block as true" do
- resource.only_if "$true"
+ resource.only_if "$true"
expect(resource.should_skip?(:run)).to be_falsey
end
it "evaluates a not_if block using powershell.exe" do
- resource.not_if "exit([int32](![System.Environment]::CommandLine.Contains('powershell.exe')))"
+ resource.not_if "exit([int32](![System.Environment]::CommandLine.Contains('powershell.exe')))"
expect(resource.should_skip?(:run)).to be_truthy
end
it "evaluates an only_if block using powershell.exe" do
- resource.only_if "exit([int32](![System.Environment]::CommandLine.Contains('powershell.exe')))"
+ resource.only_if "exit([int32](![System.Environment]::CommandLine.Contains('powershell.exe')))"
expect(resource.should_skip?(:run)).to be_falsey
end
it "evaluates a non-zero powershell exit status for not_if as true" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.not_if "exit 37"
+ resource.not_if "exit 37"
expect(resource.should_skip?(:run)).to be_falsey
end
it "evaluates a zero powershell exit status for not_if as false" do
- resource.not_if "exit 0"
+ resource.not_if "exit 0"
expect(resource.should_skip?(:run)).to be_truthy
end
it "evaluates a failed executable exit status for not_if as false" do
pending "powershell.exe always exits with success on nano" if Chef::Platform.windows_nano_server?
- resource.not_if windows_process_exit_code_not_found_content
+ resource.not_if windows_process_exit_code_not_found_content
expect(resource.should_skip?(:run)).to be_falsey
end
it "evaluates a successful executable exit status for not_if as true" do
- resource.not_if windows_process_exit_code_success_content
+ resource.not_if windows_process_exit_code_success_content
expect(resource.should_skip?(:run)).to be_truthy
end
it "evaluates a failed executable exit status for only_if as false" do
pending "powershell.exe always exits with success on nano" if Chef::Platform.windows_nano_server?
- resource.only_if windows_process_exit_code_not_found_content
+ resource.only_if windows_process_exit_code_not_found_content
expect(resource.should_skip?(:run)).to be_truthy
end
it "evaluates a successful executable exit status for only_if as true" do
- resource.only_if windows_process_exit_code_success_content
+ resource.only_if windows_process_exit_code_success_content
expect(resource.should_skip?(:run)).to be_falsey
end
it "evaluates a failed cmdlet exit status for not_if as true" do
pending "powershell.exe always exits with success on nano" if Chef::Platform.windows_nano_server?
- resource.not_if "throw 'up'"
+ resource.not_if "throw 'up'"
expect(resource.should_skip?(:run)).to be_falsey
end
@@ -465,44 +465,44 @@ configuration LCM
it "evaluates a failed cmdlet exit status for only_if as false" do
pending "powershell.exe always exits with success on nano" if Chef::Platform.windows_nano_server?
- resource.only_if "throw 'up'"
+ resource.only_if "throw 'up'"
expect(resource.should_skip?(:run)).to be_truthy
end
it "evaluates a successful cmdlet exit status for only_if as true" do
- resource.only_if "cd ."
+ resource.only_if "cd ."
expect(resource.should_skip?(:run)).to be_falsey
end
it "evaluates a not_if block using the cwd guard parameter" do
custom_cwd = "#{ENV['SystemRoot']}\\system32\\drivers\\etc"
- resource.not_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')", :cwd => custom_cwd
+ resource.not_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')", :cwd => custom_cwd
expect(resource.should_skip?(:run)).to be_truthy
end
it "evaluates an only_if block using the cwd guard parameter" do
custom_cwd = "#{ENV['SystemRoot']}\\system32\\drivers\\etc"
- resource.only_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')", :cwd => custom_cwd
+ resource.only_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')", :cwd => custom_cwd
expect(resource.should_skip?(:run)).to be_falsey
end
it "inherits cwd from the parent resource for only_if" do
custom_cwd = "#{ENV['SystemRoot']}\\system32\\drivers\\etc"
resource.cwd custom_cwd
- resource.only_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')"
+ resource.only_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')"
expect(resource.should_skip?(:run)).to be_falsey
end
it "inherits cwd from the parent resource for not_if" do
custom_cwd = "#{ENV['SystemRoot']}\\system32\\drivers\\etc"
resource.cwd custom_cwd
- resource.not_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')"
+ resource.not_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')"
expect(resource.should_skip?(:run)).to be_truthy
end
it "evaluates a 64-bit resource with a 64-bit guard and interprets boolean false as zero status code", :windows64_only do
resource.architecture :x86_64
- resource.only_if "exit [int32]($env:PROCESSOR_ARCHITECTURE -ne 'AMD64')"
+ resource.only_if "exit [int32]($env:PROCESSOR_ARCHITECTURE -ne 'AMD64')"
expect(resource.should_skip?(:run)).to be_falsey
end
@@ -510,19 +510,19 @@ configuration LCM
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
resource.architecture :x86_64
- resource.only_if "exit [int32]($env:PROCESSOR_ARCHITECTURE -eq 'AMD64')"
+ resource.only_if "exit [int32]($env:PROCESSOR_ARCHITECTURE -eq 'AMD64')"
expect(resource.should_skip?(:run)).to be_truthy
end
it "evaluates a 32-bit resource with a 32-bit guard and interprets boolean false as zero status code", :not_supported_on_nano do
resource.architecture :i386
- resource.only_if "exit [int32]($env:PROCESSOR_ARCHITECTURE -ne 'X86')"
+ resource.only_if "exit [int32]($env:PROCESSOR_ARCHITECTURE -ne 'X86')"
expect(resource.should_skip?(:run)).to be_falsey
end
it "evaluates a 32-bit resource with a 32-bit guard and interprets boolean true as nonzero status code", :not_supported_on_nano do
resource.architecture :i386
- resource.only_if "exit [int32]($env:PROCESSOR_ARCHITECTURE -eq 'X86')"
+ resource.only_if "exit [int32]($env:PROCESSOR_ARCHITECTURE -eq 'X86')"
expect(resource.should_skip?(:run)).to be_truthy
end
@@ -530,7 +530,7 @@ configuration LCM
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
resource.convert_boolean_return true
- resource.only_if "$false"
+ resource.only_if "$false"
expect(resource.should_skip?(:run)).to be_truthy
end
@@ -538,53 +538,53 @@ configuration LCM
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
resource.convert_boolean_return true
- resource.not_if "$false"
+ resource.not_if "$false"
expect(resource.should_skip?(:run)).to be_falsey
end
it "evaluates a simple boolean true as 0 status code when convert_boolean_return is true for only_if" do
resource.convert_boolean_return true
- resource.only_if "$true"
+ resource.only_if "$true"
expect(resource.should_skip?(:run)).to be_falsey
end
it "evaluates a simple boolean true as 0 status code when convert_boolean_return is true for not_if" do
resource.convert_boolean_return true
- resource.not_if "$true"
+ resource.not_if "$true"
expect(resource.should_skip?(:run)).to be_truthy
end
it "evaluates a 32-bit resource with a 32-bit guard and interprets boolean false as zero status code using convert_boolean_return for only_if", :not_supported_on_nano do
resource.convert_boolean_return true
resource.architecture :i386
- resource.only_if "$env:PROCESSOR_ARCHITECTURE -eq 'X86'"
+ resource.only_if "$env:PROCESSOR_ARCHITECTURE -eq 'X86'"
expect(resource.should_skip?(:run)).to be_falsey
end
it "evaluates a 32-bit resource with a 32-bit guard and interprets boolean false as zero status code using convert_boolean_return for not_if", :not_supported_on_nano do
resource.convert_boolean_return true
resource.architecture :i386
- resource.not_if "$env:PROCESSOR_ARCHITECTURE -ne 'X86'"
+ resource.not_if "$env:PROCESSOR_ARCHITECTURE -ne 'X86'"
expect(resource.should_skip?(:run)).to be_falsey
end
it "evaluates a 32-bit resource with a 32-bit guard and interprets boolean true as nonzero status code using convert_boolean_return for only_if", :not_supported_on_nano do
resource.convert_boolean_return true
resource.architecture :i386
- resource.only_if "$env:PROCESSOR_ARCHITECTURE -ne 'X86'"
+ resource.only_if "$env:PROCESSOR_ARCHITECTURE -ne 'X86'"
expect(resource.should_skip?(:run)).to be_truthy
end
it "evaluates a 32-bit resource with a 32-bit guard and interprets boolean true as nonzero status code using convert_boolean_return for not_if", :not_supported_on_nano do
resource.convert_boolean_return true
resource.architecture :i386
- resource.not_if "$env:PROCESSOR_ARCHITECTURE -eq 'X86'"
+ resource.not_if "$env:PROCESSOR_ARCHITECTURE -eq 'X86'"
expect(resource.should_skip?(:run)).to be_truthy
end
it "raises an error when a 32-bit guard is used on Windows Nano Server", :windows_nano_only do
resource.only_if "$true", :architecture => :i386
- expect{resource.run_action(:run)}.to raise_error(
+ expect { resource.run_action(:run) }.to raise_error(
Chef::Exceptions::Win32ArchitectureIncorrect,
/cannot execute script with requested architecture 'i386' on Windows Nano Server/)
end
diff --git a/spec/functional/resource/registry_spec.rb b/spec/functional/resource/registry_spec.rb
index 9d7de1f183..6cf8524883 100644
--- a/spec/functional/resource/registry_spec.rb
+++ b/spec/functional/resource/registry_spec.rb
@@ -27,15 +27,15 @@ describe Chef::Resource::RegistryKey, :unix_only do
node = Chef::Node.new
ohai = Ohai::System.new
ohai.all_plugins
- node.consume_external_attrs(ohai.data,{})
+ node.consume_external_attrs(ohai.data, {})
run_context = Chef::RunContext.new(node, {}, events)
@resource = Chef::Resource::RegistryKey.new("HKCU\\Software", run_context)
end
context "when load_current_resource is run on a non-windows node" do
it "throws an exception because you don't have a windows registry (derp)" do
@resource.key("HKCU\\Software\\Opscode")
- @resource.values([{:name=>"Color", :type=>:string, :data=>"Orange"}])
- expect{@resource.run_action(:create)}.to raise_error(Chef::Exceptions::Win32NotWindows)
+ @resource.values([{ :name => "Color", :type => :string, :data => "Orange" }])
+ expect { @resource.run_action(:create) }.to raise_error(Chef::Exceptions::Win32NotWindows)
end
end
end
@@ -98,7 +98,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
@node = Chef::Node.new
ohai = Ohai::System.new
ohai.all_plugins
- @node.consume_external_attrs(ohai.data,{})
+ @node.consume_external_attrs(ohai.data, {})
@run_context = Chef::RunContext.new(@node, {}, @events)
@new_resource = Chef::Resource::RegistryKey.new(resource_name, @run_context)
@@ -113,8 +113,8 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
@rest_client = double("Chef::ServerAPI (mock)")
allow(@rest_client).to receive(:create_url).and_return("reports/nodes/windowsbox/runs/#{@run_id}");
- allow(@rest_client).to receive(:raw_http_request).and_return({"result"=>"ok"});
- allow(@rest_client).to receive(:post_rest).and_return({"uri"=>"https://example.com/reports/nodes/windowsbox/runs/#{@run_id}"});
+ allow(@rest_client).to receive(:raw_http_request).and_return({ "result" => "ok" });
+ allow(@rest_client).to receive(:post_rest).and_return({ "uri" => "https://example.com/reports/nodes/windowsbox/runs/#{@run_id}" });
@resource_reporter = Chef::ResourceReporter.new(@rest_client)
@events.register(@resource_reporter)
@@ -122,7 +122,6 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
@resource_reporter.run_started(@run_status)
@run_id = @resource_reporter.run_id
-
@new_resource.cookbook_name = "monkey"
@cookbook_version = double("Cookbook::Version", :version => "1.2.3")
allow(@new_resource).to receive(:cookbook_version).and_return(@cookbook_version)
@@ -138,76 +137,76 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
end
it "creates registry key, value if the key is missing" do
@new_resource.key(reg_child)
- @new_resource.values([{:name=>"Color", :type=>:string, :data=>"Orange"}])
+ @new_resource.values([{ :name => "Color", :type => :string, :data => "Orange" }])
@new_resource.run_action(:create)
expect(@registry.key_exists?(reg_child)).to eq(true)
- expect(@registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Orange"})).to eq(true)
+ expect(@registry.data_exists?(reg_child, { :name => "Color", :type => :string, :data => "Orange" })).to eq(true)
end
it "does not create the key if it already exists with same value, type and data" do
@new_resource.key(reg_child)
- @new_resource.values([{:name=>"Color", :type=>:string, :data=>"Orange"}])
+ @new_resource.values([{ :name => "Color", :type => :string, :data => "Orange" }])
@new_resource.run_action(:create)
expect(@registry.key_exists?(reg_child)).to eq(true)
- expect(@registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Orange"})).to eq(true)
+ expect(@registry.data_exists?(reg_child, { :name => "Color", :type => :string, :data => "Orange" })).to eq(true)
end
it "creates a value if it does not exist" do
@new_resource.key(reg_child)
- @new_resource.values([{:name=>"Mango", :type=>:string, :data=>"Yellow"}])
+ @new_resource.values([{ :name => "Mango", :type => :string, :data => "Yellow" }])
@new_resource.run_action(:create)
- expect(@registry.data_exists?(reg_child, {:name=>"Mango", :type=>:string, :data=>"Yellow"})).to eq(true)
+ expect(@registry.data_exists?(reg_child, { :name => "Mango", :type => :string, :data => "Yellow" })).to eq(true)
end
it "modifies the data if the key and value exist and type matches" do
@new_resource.key(reg_child)
- @new_resource.values([{:name=>"Color", :type=>:string, :data=>"Not just Orange - OpscodeOrange!"}])
+ @new_resource.values([{ :name => "Color", :type => :string, :data => "Not just Orange - OpscodeOrange!" }])
@new_resource.run_action(:create)
- expect(@registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Not just Orange - OpscodeOrange!"})).to eq(true)
+ expect(@registry.data_exists?(reg_child, { :name => "Color", :type => :string, :data => "Not just Orange - OpscodeOrange!" })).to eq(true)
end
it "modifys the type if the key and value exist and the type does not match" do
@new_resource.key(reg_child)
- @new_resource.values([{:name=>"Color", :type=>:multi_string, :data=>["Not just Orange - OpscodeOrange!"]}])
+ @new_resource.values([{ :name => "Color", :type => :multi_string, :data => ["Not just Orange - OpscodeOrange!"] }])
@new_resource.run_action(:create)
- expect(@registry.data_exists?(reg_child, {:name=>"Color", :type=>:multi_string, :data=>["Not just Orange - OpscodeOrange!"]})).to eq(true)
+ expect(@registry.data_exists?(reg_child, { :name => "Color", :type => :multi_string, :data => ["Not just Orange - OpscodeOrange!"] })).to eq(true)
end
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 => ["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 => ["OpscodeOrange", "Rules"] })).to eq(true)
end
it "gives error if action create and parent does not exist and recursive is set to false" do
@new_resource.key(reg_child + '\Missing1\Missing2')
- @new_resource.values([{:name=>"OC", :type=>:string, :data=>"MissingData"}])
+ @new_resource.values([{ :name => "OC", :type => :string, :data => "MissingData" }])
@new_resource.recursive(false)
- expect{@new_resource.run_action(:create)}.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
+ expect { @new_resource.run_action(:create) }.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
end
it "creates missing keys if action create and parent does not exist and recursive is set to true" do
@new_resource.key(reg_child + '\Missing1\Missing2')
- @new_resource.values([{:name=>"OC", :type=>:string, :data=>"MissingData"}])
+ @new_resource.values([{ :name => "OC", :type => :string, :data => "MissingData" }])
@new_resource.recursive(true)
@new_resource.run_action(:create)
expect(@registry.key_exists?(reg_child + '\Missing1\Missing2')).to eq(true)
- expect(@registry.value_exists?(reg_child + '\Missing1\Missing2', {:name=>"OC", :type=>:string, :data=>"MissingData"})).to eq(true)
+ expect(@registry.value_exists?(reg_child + '\Missing1\Missing2', { :name => "OC", :type => :string, :data => "MissingData" })).to eq(true)
end
it "creates key with multiple value as specified" do
@new_resource.key(reg_child)
- @new_resource.values([{:name=>"one", :type=>:string, :data=>"1"},{:name=>"two", :type=>:string, :data=>"2"},{:name=>"three", :type=>:string, :data=>"3"}])
+ @new_resource.values([{ :name => "one", :type => :string, :data => "1" }, { :name => "two", :type => :string, :data => "2" }, { :name => "three", :type => :string, :data => "3" }])
@new_resource.recursive(true)
@new_resource.run_action(:create)
@@ -226,12 +225,12 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
end
it "creates a key in a 32-bit registry that is not viewable in 64-bit" do
@new_resource.key(reg_child + '\Atraxi' )
- @new_resource.values([{:name=>"OC", :type=>:string, :data=>"Data"}])
+ @new_resource.values([{ :name => "OC", :type => :string, :data => "Data" }])
@new_resource.recursive(true)
@new_resource.architecture(:i386)
@new_resource.run_action(:create)
@registry.architecture = :i386
- expect(@registry.data_exists?(reg_child + '\Atraxi', {:name=>"OC", :type=>:string, :data=>"Data"})).to eq(true)
+ expect(@registry.data_exists?(reg_child + '\Atraxi', { :name => "OC", :type => :string, :data => "Data" })).to eq(true)
@registry.architecture = :x86_64
expect(@registry.key_exists?(reg_child + '\Atraxi')).to eq(false)
end
@@ -239,7 +238,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "prepares the reporting data for action :create" do
@new_resource.key(reg_child + '\Ood')
- @new_resource.values([{:name=>"ReportingVal1", :type=>:string, :data=>"report1"},{:name=>"ReportingVal2", :type=>:string, :data=>"report2"}])
+ @new_resource.values([{ :name => "ReportingVal1", :type => :string, :data => "report1" }, { :name => "ReportingVal2", :type => :string, :data => "report2" }])
@new_resource.recursive(true)
@new_resource.run_action(:create)
@report = @resource_reporter.prepare_run_data
@@ -248,8 +247,8 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
expect(@report["resources"][0]["type"]).to eq("registry_key")
expect(@report["resources"][0]["name"]).to eq(resource_name)
expect(@report["resources"][0]["id"]).to eq(reg_child + '\Ood')
- expect(@report["resources"][0]["after"][:values]).to eq([{:name=>"ReportingVal1", :type=>:string, :data=>"report1"},
- {:name=>"ReportingVal2", :type=>:string, :data=>"report2"}])
+ expect(@report["resources"][0]["after"][:values]).to eq([{ :name => "ReportingVal1", :type => :string, :data => "report1" },
+ { :name => "ReportingVal2", :type => :string, :data => "report2" }])
expect(@report["resources"][0]["before"][:values]).to eq([])
expect(@report["resources"][0]["result"]).to eq("create")
expect(@report["status"]).to eq("success")
@@ -263,7 +262,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "does not throw an exception if the keys do not exist but recursive is set to false" do
@new_resource.key(reg_child + '\Slitheen\Raxicoricofallapatorius')
- @new_resource.values([{:name=>"BriskWalk",:type=>:string,:data=>"is good for health"}])
+ @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:create) # should not raise_error
expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
@@ -271,7 +270,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
end
it "does not create key if the action is create" do
@new_resource.key(reg_child + '\Slitheen')
- @new_resource.values([{:name=>"BriskWalk",:type=>:string,:data=>"is good for health"}])
+ @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:create)
expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
@@ -286,61 +285,61 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "creates registry key, value if the key is missing" do
@new_resource.key(reg_child)
- @new_resource.values([{:name=>"Color", :type=>:string, :data=>"Orange"}])
+ @new_resource.values([{ :name => "Color", :type => :string, :data => "Orange" }])
@new_resource.run_action(:create_if_missing)
expect(@registry.key_exists?(reg_parent)).to eq(true)
expect(@registry.key_exists?(reg_child)).to eq(true)
- expect(@registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Orange"})).to eq(true)
+ expect(@registry.data_exists?(reg_child, { :name => "Color", :type => :string, :data => "Orange" })).to eq(true)
end
it "does not create the key if it already exists with same value, type and data" do
@new_resource.key(reg_child)
- @new_resource.values([{:name=>"Color", :type=>:string, :data=>"Orange"}])
+ @new_resource.values([{ :name => "Color", :type => :string, :data => "Orange" }])
@new_resource.run_action(:create_if_missing)
expect(@registry.key_exists?(reg_child)).to eq(true)
- expect(@registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Orange"})).to eq(true)
+ expect(@registry.data_exists?(reg_child, { :name => "Color", :type => :string, :data => "Orange" })).to eq(true)
end
it "creates a value if it does not exist" do
@new_resource.key(reg_child)
- @new_resource.values([{:name=>"Mango", :type=>:string, :data=>"Yellow"}])
+ @new_resource.values([{ :name => "Mango", :type => :string, :data => "Yellow" }])
@new_resource.run_action(:create_if_missing)
- expect(@registry.data_exists?(reg_child, {:name=>"Mango", :type=>:string, :data=>"Yellow"})).to eq(true)
+ expect(@registry.data_exists?(reg_child, { :name => "Mango", :type => :string, :data => "Yellow" })).to eq(true)
end
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 => ["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 => ["OpscodeOrange", "Rules"] })).to eq(true)
end
it "gives error if action create and parent does not exist and recursive is set to false" do
@new_resource.key(reg_child + '\Sontaran\Sontar')
- @new_resource.values([{:name=>"OC", :type=>:string, :data=>"MissingData"}])
+ @new_resource.values([{ :name => "OC", :type => :string, :data => "MissingData" }])
@new_resource.recursive(false)
- expect{@new_resource.run_action(:create_if_missing)}.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
+ expect { @new_resource.run_action(:create_if_missing) }.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
end
it "creates missing keys if action create and parent does not exist and recursive is set to true" do
@new_resource.key(reg_child + '\Sontaran\Sontar')
- @new_resource.values([{:name=>"OC", :type=>:string, :data=>"MissingData"}])
+ @new_resource.values([{ :name => "OC", :type => :string, :data => "MissingData" }])
@new_resource.recursive(true)
@new_resource.run_action(:create_if_missing)
expect(@registry.key_exists?(reg_child + '\Sontaran\Sontar')).to eq(true)
- expect(@registry.value_exists?(reg_child + '\Sontaran\Sontar', {:name=>"OC", :type=>:string, :data=>"MissingData"})).to eq(true)
+ expect(@registry.value_exists?(reg_child + '\Sontaran\Sontar', { :name => "OC", :type => :string, :data => "MissingData" })).to eq(true)
end
it "creates key with multiple value as specified" do
@new_resource.key(reg_child + '\Adipose')
- @new_resource.values([{:name=>"one", :type=>:string, :data=>"1"},{:name=>"two", :type=>:string, :data=>"2"},{:name=>"three", :type=>:string, :data=>"3"}])
+ @new_resource.values([{ :name => "one", :type => :string, :data => "1" }, { :name => "two", :type => :string, :data => "2" }, { :name => "three", :type => :string, :data => "3" }])
@new_resource.recursive(true)
@new_resource.run_action(:create_if_missing)
@@ -351,7 +350,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "prepares the reporting data for :create_if_missing" do
@new_resource.key(reg_child + '\Judoon')
- @new_resource.values([{:name=>"ReportingVal3", :type=>:string, :data=>"report3"}])
+ @new_resource.values([{ :name => "ReportingVal3", :type => :string, :data => "report3" }])
@new_resource.recursive(true)
@new_resource.run_action(:create_if_missing)
@report = @resource_reporter.prepare_run_data
@@ -360,7 +359,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
expect(@report["resources"][0]["type"]).to eq("registry_key")
expect(@report["resources"][0]["name"]).to eq(resource_name)
expect(@report["resources"][0]["id"]).to eq(reg_child + '\Judoon')
- expect(@report["resources"][0]["after"][:values]).to eq([{:name=>"ReportingVal3", :type=>:string, :data=>"report3"}])
+ expect(@report["resources"][0]["after"][:values]).to eq([{ :name => "ReportingVal3", :type => :string, :data => "report3" }])
expect(@report["resources"][0]["before"][:values]).to eq([])
expect(@report["resources"][0]["result"]).to eq("create_if_missing")
expect(@report["status"]).to eq("success")
@@ -374,7 +373,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "does not throw an exception if the keys do not exist but recursive is set to false" do
@new_resource.key(reg_child + '\Zygons\Zygor')
- @new_resource.values([{:name=>"BriskWalk",:type=>:string,:data=>"is good for health"}])
+ @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:create_if_missing) # should not raise_error
expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
@@ -382,7 +381,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
end
it "does nothing if the action is create_if_missing" do
@new_resource.key(reg_child + '\Zygons')
- @new_resource.values([{:name=>"BriskWalk",:type=>:string,:data=>"is good for health"}])
+ @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:create_if_missing)
expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
@@ -399,7 +398,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "takes no action if the specified key path does not exist in the system" do
expect(@registry.key_exists?(reg_parent + '\Osirian')).to eq(false)
- @new_resource.key(reg_parent+ '\Osirian')
+ @new_resource.key(reg_parent + '\Osirian')
@new_resource.recursive(false)
@new_resource.run_action(:delete)
@@ -407,53 +406,53 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
end
it "takes no action if the key exists but the value does not" do
- expect(@registry.data_exists?(reg_parent + '\Opscode', {:name=>"Color", :type=>:string, :data=>"Orange"})).to eq(true)
+ 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 => ["SeattleGrey", "OCOrange"] }])
@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.data_exists?(reg_parent + '\Opscode', { :name => "Color", :type => :string, :data => "Orange" })).to eq(true)
end
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 => ["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.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)
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 => ["Black", "Orange"] }])
@new_resource.recursive(false)
@new_resource.run_action(:delete)
- expect(@registry.value_exists?(reg_parent + '\Opscode', {:name=>"Color", :type=>:string, :data=>"Orange"})).to eq(false)
+ expect(@registry.value_exists?(reg_parent + '\Opscode', { :name => "Color", :type => :string, :data => "Orange" })).to eq(false)
end
it "prepares the reporting data for action :delete" do
@new_resource.key(reg_parent + '\ReportKey')
- @new_resource.values([{:name=>"ReportVal4", :type=>:string, :data=>"report4"},{:name=>"ReportVal5", :type=>:string, :data=>"report5"}])
+ @new_resource.values([{ :name => "ReportVal4", :type => :string, :data => "report4" }, { :name => "ReportVal5", :type => :string, :data => "report5" }])
@new_resource.recursive(true)
@new_resource.run_action(:delete)
@report = @resource_reporter.prepare_run_data
- expect(@registry.value_exists?(reg_parent + '\ReportKey', [{:name=>"ReportVal4", :type=>:string, :data=>"report4"},{:name=>"ReportVal5", :type=>:string, :data=>"report5"}])).to eq(false)
+ expect(@registry.value_exists?(reg_parent + '\ReportKey', [{ :name => "ReportVal4", :type => :string, :data => "report4" }, { :name => "ReportVal5", :type => :string, :data => "report5" }])).to eq(false)
expect(@report["action"]).to eq("end")
expect(@report["resources"].count).to eq(1)
expect(@report["resources"][0]["type"]).to eq("registry_key")
expect(@report["resources"][0]["name"]).to eq(resource_name)
expect(@report["resources"][0]["id"]).to eq(reg_parent + '\ReportKey')
- expect(@report["resources"][0]["before"][:values]).to eq([{:name=>"ReportVal4", :type=>:string, :data=>"report4"},
- {:name=>"ReportVal5", :type=>:string, :data=>"report5"}])
+ expect(@report["resources"][0]["before"][:values]).to eq([{ :name => "ReportVal4", :type => :string, :data => "report4" },
+ { :name => "ReportVal5", :type => :string, :data => "report5" }])
#Not testing for after values to match since after -> new_resource values.
expect(@report["resources"][0]["result"]).to eq("delete")
expect(@report["status"]).to eq("success")
@@ -466,7 +465,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
end
it "does nothing if the action is delete" do
@new_resource.key(reg_parent + '\OpscodeWhyRun')
- @new_resource.values([{:name=>"BriskWalk",:type=>:string,:data=>"is good for health"}])
+ @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:delete)
@@ -502,7 +501,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "raises an exception if the key has subkeys and recursive == false" do
@new_resource.key(reg_parent)
@new_resource.recursive(false)
- expect{@new_resource.run_action(:delete_key)}.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
+ expect { @new_resource.run_action(:delete_key) }.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
end
it "ignores the values under a key" do
@@ -544,13 +543,13 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "does not throw an exception if the key has subkeys but recursive is set to false" do
@new_resource.key(reg_parent + '\OpscodeWhyRun')
- @new_resource.values([{:name=>"BriskWalk",:type=>:string,:data=>"is good for health"}])
+ @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:delete_key)
end
it "does nothing if the action is delete_key" do
@new_resource.key(reg_parent + '\OpscodeWhyRun')
- @new_resource.values([{:name=>"BriskWalk",:type=>:string,:data=>"is good for health"}])
+ @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:delete_key)
diff --git a/spec/functional/resource/remote_directory_spec.rb b/spec/functional/resource/remote_directory_spec.rb
index 8e01464e86..c25e51cf2a 100644
--- a/spec/functional/resource/remote_directory_spec.rb
+++ b/spec/functional/resource/remote_directory_spec.rb
@@ -136,8 +136,8 @@ describe Chef::Resource::RemoteDirectory 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"}
+ 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)
diff --git a/spec/functional/resource/remote_file_spec.rb b/spec/functional/resource/remote_file_spec.rb
index 876467d490..b394bd0240 100644
--- a/spec/functional/resource/remote_file_spec.rb
+++ b/spec/functional/resource/remote_file_spec.rb
@@ -232,7 +232,7 @@ describe Chef::Resource::RemoteFile do
end
it "should not create the file" do
- expect{ resource.run_action(:create) }.to raise_error
+ expect { resource.run_action(:create) }.to raise_error
expect(File).not_to exist(path)
end
end
diff --git a/spec/functional/resource/template_spec.rb b/spec/functional/resource/template_spec.rb
index 6ce4a3cc3d..da8cbfc68a 100644
--- a/spec/functional/resource/template_spec.rb
+++ b/spec/functional/resource/template_spec.rb
@@ -21,7 +21,7 @@ require "spec_helper"
describe Chef::Resource::Template do
def binread(file)
- File.open(file,"rb") {|f| f.read }
+ File.open(file, "rb") { |f| f.read }
end
include_context Chef::Resource::File
@@ -73,7 +73,7 @@ describe Chef::Resource::Template do
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/useradd_spec.rb b/spec/functional/resource/user/useradd_spec.rb
index ab16a1672f..84757cc197 100644
--- a/spec/functional/resource/user/useradd_spec.rb
+++ b/spec/functional/resource/user/useradd_spec.rb
@@ -31,23 +31,22 @@ def user_provider_for_platform
end
metadata = { :unix_only => true,
- :requires_root => true,
- :not_supported_on_mac_osx => true,
- :provider => {:user => user_provider_for_platform},
+ :requires_root => true,
+ :not_supported_on_mac_osx => true,
+ :provider => { :user => user_provider_for_platform },
}
describe Chef::Provider::User::Useradd, metadata do
include Chef::Mixin::ShellOut
-
# Utility code for /etc/passwd interaction, avoid any caching of user records:
PwEntry = Struct.new(:name, :passwd, :uid, :gid, :gecos, :home, :shell)
class UserNotFound < StandardError; end
def pw_entry
- passwd_file = File.open("/etc/passwd", "rb") {|f| f.read}
+ 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(":"))
@@ -59,9 +58,9 @@ describe Chef::Provider::User::Useradd, metadata do
def etc_shadow
case ohai[:platform]
when "aix"
- File.open("/etc/security/passwd") {|f| f.read }
+ File.open("/etc/security/passwd") { |f| f.read }
else
- File.open("/etc/shadow") {|f| f.read }
+ File.open("/etc/shadow") { |f| f.read }
end
end
@@ -104,7 +103,7 @@ describe Chef::Provider::User::Useradd, metadata do
while max_retries > 0
begin
pw_entry # will raise if the user doesn't exist
- status = shell_out!("userdel", "-r", username, :returns => [0,8,12])
+ status = shell_out!("userdel", "-r", username, :returns => [0, 8, 12])
# Error code 8 during userdel indicates that the user is logged in.
# This occurs randomly because the accounts daemon holds a lock due to which userdel fails.
@@ -160,7 +159,7 @@ describe Chef::Provider::User::Useradd, metadata do
let(:expected_shadow) do
if ohai[:platform] == "aix"
- expected_shadow = "cf-test" # For aix just check user entry in shadow file
+ expected_shadow = "cf-test" # For aix just check user entry in shadow file
else
expected_shadow = "cf-test:$1$RRa/wMM/$XltKfoX5ffnexVF4dHZZf/"
end
@@ -174,7 +173,6 @@ describe Chef::Provider::User::Useradd, metadata do
expect(user_resource).to be_updated_by_last_action
end
-
it "ensures the user exists" do
expect(pw_entry.name).to eq(username)
end
@@ -194,7 +192,6 @@ describe Chef::Provider::User::Useradd, metadata do
end
end
-
context "when uid is set" do
# Should verify uid not in use...
let(:uid) { 1999 }
@@ -296,7 +293,7 @@ describe Chef::Provider::User::Useradd, metadata do
# Ubuntu 13.04 system, these are commented out, so we'll look at
# UID_MIN to find the lower limit of the non-system-user range, and
# use that value in our assertions.
- login_defs = File.open("/etc/login.defs", "rb") {|f| f.read }
+ login_defs = File.open("/etc/login.defs", "rb") { |f| f.read }
uid_min_scan = /^UID_MIN\s+(\d+)/
login_defs.match(uid_min_scan)[1]
end
@@ -455,7 +452,6 @@ describe Chef::Provider::User::Useradd, metadata do
end
end
-
it "ensures the password is set" do
password_should_be_set
expect(etc_shadow).to include(expected_shadow)
@@ -484,7 +480,6 @@ describe Chef::Provider::User::Useradd, metadata do
end
end
-
it "ensures the password is set to the desired value" do
password_should_be_set
expect(etc_shadow).to include(expected_shadow)
@@ -518,7 +513,7 @@ describe Chef::Provider::User::Useradd, metadata do
let(:user_locked_context?) { false }
def shadow_entry
- etc_shadow.lines.select {|l| l.include?(username) }.first
+ etc_shadow.lines.select { |l| l.include?(username) }.first
end
def shadow_password
@@ -596,7 +591,6 @@ describe Chef::Provider::User::Useradd, metadata do
end
end
-
it "locks the user's password" do
user_account_should_be_locked
end
diff --git a/spec/functional/resource/windows_package_spec.rb b/spec/functional/resource/windows_package_spec.rb
index 02559bcd97..bc508dc526 100644
--- a/spec/functional/resource/windows_package_spec.rb
+++ b/spec/functional/resource/windows_package_spec.rb
@@ -70,7 +70,7 @@ 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)
@@ -127,7 +127,7 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile 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" }
-
+
it "finds the correct installer type" do
subject.run_action(:install)
expect(subject.provider_for_action(:install).installer_type).to eq(:nsis)
@@ -164,5 +164,5 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
subject.run_action(:remove)
expect(subject).to be_updated_by_last_action
end
- end
-end \ No newline at end of file
+ end
+end
diff --git a/spec/functional/resource/windows_service_spec.rb b/spec/functional/resource/windows_service_spec.rb
index 6e19998995..80faaece34 100644
--- a/spec/functional/resource/windows_service_spec.rb
+++ b/spec/functional/resource/windows_service_spec.rb
@@ -23,9 +23,9 @@ describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_
include_context "using Win32::Service"
- let(:username) { "service_spec_user"}
- let(:qualified_username) { "#{ENV['COMPUTERNAME']}\\#{username}"}
- let(:password) { "1a2b3c4X!&narf"}
+ let(:username) { "service_spec_user" }
+ let(:qualified_username) { "#{ENV['COMPUTERNAME']}\\#{username}" }
+ let(:password) { "1a2b3c4X!&narf" }
let(:user_resource) {
r = Chef::Resource::User.new(username, run_context)
diff --git a/spec/functional/run_lock_spec.rb b/spec/functional/run_lock_spec.rb
index 8680816d13..288341bcb6 100644
--- a/spec/functional/run_lock_spec.rb
+++ b/spec/functional/run_lock_spec.rb
@@ -31,15 +31,16 @@ describe Chef::RunLock do
"/tmp/#{Kernel.rand(Time.now.to_i + Process.pid)}"
end
- let(:lockfile){ "#{random_temp_root}/this/long/path/does/not/exist/chef-client-running.pid" }
+ let(:lockfile) { "#{random_temp_root}/this/long/path/does/not/exist/chef-client-running.pid" }
# make sure to start with a clean slate.
- before(:each){ log_event("rm -rf before"); FileUtils.rm_r(random_temp_root) if File.exist?(random_temp_root) }
- after(:each){ log_event("rm -rf after"); FileUtils.rm_r(random_temp_root) if File.exist?(random_temp_root) }
+ before(:each) { log_event("rm -rf before"); FileUtils.rm_r(random_temp_root) if File.exist?(random_temp_root) }
+ after(:each) { log_event("rm -rf after"); FileUtils.rm_r(random_temp_root) if File.exist?(random_temp_root) }
- def log_event(message, time=Time.now.strftime("%H:%M:%S.%L"))
+ def log_event(message, time = Time.now.strftime("%H:%M:%S.%L"))
events << [ message, time ]
end
+
def events
@events ||= []
end
diff --git a/spec/functional/shell_spec.rb b/spec/functional/shell_spec.rb
index a2c44bd949..fe2abdb12a 100644
--- a/spec/functional/shell_spec.rb
+++ b/spec/functional/shell_spec.rb
@@ -30,7 +30,7 @@ describe Shell do
describe "smoke tests", :unix_only => true do
include Chef::Mixin::Command::Unix
- TIMEOUT=300
+ TIMEOUT = 300
def read_until(io, expected_value)
start = Time.new
@@ -43,7 +43,7 @@ describe Shell do
end
if Time.new - start > TIMEOUT
raise "did not read expected value `#{expected_value}' within #{TIMEOUT}s\n" +
- "Buffer so far: `#{buffer}'"
+ "Buffer so far: `#{buffer}'"
end
end
buffer
diff --git a/spec/functional/tiny_server_spec.rb b/spec/functional/tiny_server_spec.rb
index 9540234ba6..3e394f335e 100644
--- a/spec/functional/tiny_server_spec.rb
+++ b/spec/functional/tiny_server_spec.rb
@@ -26,7 +26,7 @@ describe TinyServer::API do
end
it "is a Singleton" do
- expect {TinyServer::API.new}.to raise_error
+ expect { TinyServer::API.new }.to raise_error
end
it "clears the router" do
@@ -39,26 +39,26 @@ describe TinyServer::API do
@api.get("/foo/bar", 200, "hello foobar")
# WEBrick gives you the full URI with host, Thin only gave the part after scheme+host+port
response = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => "http://localhost:1974/foo/bar")
- expect(response).to eq([200, {"Content-Type" => "application/json"}, [ "hello foobar" ]])
+ expect(response).to eq([200, { "Content-Type" => "application/json" }, [ "hello foobar" ]])
end
it "creates a route for a request with a block" do
block_called = false
@api.get("/bar/baz", 200) { block_called = true; "hello barbaz" }
response = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => "http://localhost:1974/bar/baz")
- expect(response).to eq([200, {"Content-Type" => "application/json"}, [ "hello barbaz" ]])
+ expect(response).to eq([200, { "Content-Type" => "application/json" }, [ "hello barbaz" ]])
expect(block_called).to be_truthy
end
it "returns debugging info for 404s" do
response = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => "/no_such_thing")
expect(response[0]).to eq(404)
- expect(response[1]).to eq({"Content-Type" => "application/json"})
+ expect(response[1]).to eq({ "Content-Type" => "application/json" })
expect(response[2]).to be_a_kind_of(Array)
response_obj = Chef::JSONCompat.from_json(response[2].first)
expect(response_obj["message"]).to eq("no data matches the request for /no_such_thing")
- expect(response_obj["available_routes"]).to eq({"GET"=>[], "PUT"=>[], "POST"=>[], "DELETE"=>[]})
- expect(response_obj["request"]).to eq({"REQUEST_METHOD"=>"GET", "REQUEST_URI"=>"/no_such_thing"})
+ expect(response_obj["available_routes"]).to eq({ "GET" => [], "PUT" => [], "POST" => [], "DELETE" => [] })
+ expect(response_obj["request"]).to eq({ "REQUEST_METHOD" => "GET", "REQUEST_URI" => "/no_such_thing" })
end
end
diff --git a/spec/functional/util/powershell/cmdlet_spec.rb b/spec/functional/util/powershell/cmdlet_spec.rb
index 741d8a78d4..6ddbea2f42 100644
--- a/spec/functional/util/powershell/cmdlet_spec.rb
+++ b/spec/functional/util/powershell/cmdlet_spec.rb
@@ -19,18 +19,18 @@
require "chef/json_compat"
require File.expand_path("../../../../spec_helper", __FILE__)
-describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
+describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
before(:all) do
@node = Chef::Node.new
@node.consume_external_attrs(OHAI_SYSTEM.data, {})
end
let(:cmd_output_format) { :text }
- let(:simple_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "get-childitem", cmd_output_format, {:depth => 2}) }
+ let(:simple_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "get-childitem", cmd_output_format, { :depth => 2 }) }
let(:invalid_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "get-idontexist", cmd_output_format) }
- let(:cmdlet_get_item_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "get-item", cmd_output_format, {:depth => 2}) }
- let(:cmdlet_alias_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "alias", cmd_output_format, {:depth => 2}) }
+ let(:cmdlet_get_item_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "get-item", cmd_output_format, { :depth => 2 }) }
+ let(:cmdlet_alias_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "alias", cmd_output_format, { :depth => 2 }) }
let(:etc_directory) { "#{ENV['systemroot']}\\system32\\drivers\\etc" }
- let(:architecture_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "$env:PROCESSOR_ARCHITECTURE")}
+ let(:architecture_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "$env:PROCESSOR_ARCHITECTURE") }
it "executes a simple process" do
result = simple_cmdlet.run
@@ -38,11 +38,11 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
end
it "#run does not raise a PowershellCmdletException exception if the command cannot be executed" do
- expect {invalid_cmdlet.run}.not_to raise_error
+ expect { invalid_cmdlet.run }.not_to raise_error
end
it "#run! raises a PowershellCmdletException exception if the command cannot be executed" do
- expect {invalid_cmdlet.run!}.to raise_error(Chef::Exceptions::PowershellCmdletException)
+ expect { invalid_cmdlet.run! }.to raise_error(Chef::Exceptions::PowershellCmdletException)
end
it "executes a 64-bit command on a 64-bit OS, 32-bit otherwise" do
@@ -58,17 +58,17 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
end
it "passes command line switches to the command" do
- result = cmdlet_alias_requires_switch_or_argument.run({:name => "ls"})
+ result = cmdlet_alias_requires_switch_or_argument.run({ :name => "ls" })
expect(result.succeeded?).to eq(true)
end
it "passes command line arguments to the command" do
- result = cmdlet_alias_requires_switch_or_argument.run({},{},"ls")
+ result = cmdlet_alias_requires_switch_or_argument.run({}, {}, "ls")
expect(result.succeeded?).to eq(true)
end
it "passes command line arguments and switches to the command" do
- result = cmdlet_get_item_requires_switch_or_argument.run({:path => etc_directory},{}," | select-object -property fullname | format-table -hidetableheaders")
+ result = cmdlet_get_item_requires_switch_or_argument.run({ :path => etc_directory }, {}, " | select-object -property fullname | format-table -hidetableheaders")
expect(result.succeeded?).to eq(true)
returned_directory = result.return_value
returned_directory.strip!
@@ -76,7 +76,7 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
end
it "passes execution options to the command" do
- result = cmdlet_get_item_requires_switch_or_argument.run({},{:cwd => etc_directory},". | select-object -property fullname | format-table -hidetableheaders")
+ result = cmdlet_get_item_requires_switch_or_argument.run({}, { :cwd => etc_directory }, ". | select-object -property fullname | format-table -hidetableheaders")
expect(result.succeeded?).to eq(true)
returned_directory = result.return_value
returned_directory.strip!
@@ -86,16 +86,16 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
context "when returning json" do
let(:cmd_output_format) { :json }
it "returns json format data" do
- result = cmdlet_alias_requires_switch_or_argument.run({},{},"ls")
+ result = cmdlet_alias_requires_switch_or_argument.run({}, {}, "ls")
expect(result.succeeded?).to eq(true)
- expect(lambda{Chef::JSONCompat.parse(result.return_value)}).not_to raise_error
+ expect(lambda { Chef::JSONCompat.parse(result.return_value) }).not_to raise_error
end
end
context "when returning Ruby objects" do
let(:cmd_output_format) { :object }
it "returns object format data" do
- result = simple_cmdlet.run({},{:cwd => etc_directory}, "hosts")
+ result = simple_cmdlet.run({}, { :cwd => etc_directory }, "hosts")
expect(result.succeeded?).to eq(true)
data = result.return_value
expect(data["Name"]).to eq("hosts")
@@ -105,7 +105,7 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
context "when constructor is given invalid arguments" do
let(:cmd_output_format) { :invalid }
it "throws an exception if an invalid format is passed to the constructor" do
- expect(lambda{simple_cmdlet}).to raise_error
+ expect(lambda { simple_cmdlet }).to raise_error
end
end
end
diff --git a/spec/functional/win32/crypto_spec.rb b/spec/functional/win32/crypto_spec.rb
index b12193ced0..75a8bfbd24 100644
--- a/spec/functional/win32/crypto_spec.rb
+++ b/spec/functional/win32/crypto_spec.rb
@@ -25,7 +25,7 @@ describe "Chef::ReservedNames::Win32::Crypto", :windows_only do
describe '#encrypt' do
before(:all) do
new_node = Chef::Node.new
- new_node.consume_external_attrs(OHAI_SYSTEM.data,{})
+ new_node.consume_external_attrs(OHAI_SYSTEM.data, {})
events = Chef::EventDispatch::Dispatcher.new
diff --git a/spec/functional/win32/registry_spec.rb b/spec/functional/win32/registry_spec.rb
index 5818d7c7e5..f0258ab3b9 100644
--- a/spec/functional/win32/registry_spec.rb
+++ b/spec/functional/win32/registry_spec.rb
@@ -41,7 +41,7 @@ describe "Chef::Win32::Registry", :windows_only do
#Create the node with ohai data
events = Chef::EventDispatch::Dispatcher.new
@node = Chef::Node.new
- @node.consume_external_attrs(OHAI_SYSTEM.data,{})
+ @node.consume_external_attrs(OHAI_SYSTEM.data, {})
@run_context = Chef::RunContext.new(@node, {}, events)
#Create a registry object that has access ot the node previously created
@@ -81,7 +81,7 @@ describe "Chef::Win32::Registry", :windows_only do
end
it "throws an exception if the hive does not exist" do
- expect {@registry.key_exists?("JKLM\\Software\\Branch\\Flower")}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.key_exists?("JKLM\\Software\\Branch\\Flower") }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
end
@@ -91,95 +91,95 @@ describe "Chef::Win32::Registry", :windows_only do
end
it "throws an exception if the key path does not exist" do
- expect {@registry.key_exists!("HKCU\\Software\\Branch\\Flower")}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.key_exists!("HKCU\\Software\\Branch\\Flower") }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "throws an exception if the hive does not exist" do
- expect {@registry.key_exists!("JKLM\\Software\\Branch\\Flower")}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.key_exists!("JKLM\\Software\\Branch\\Flower") }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
end
describe "value_exists?" do
it "throws an exception if the hive does not exist" do
- expect {@registry.value_exists?("JKLM\\Software\\Branch\\Flower", {:name=>"Petals"})}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.value_exists?("JKLM\\Software\\Branch\\Flower", { :name => "Petals" }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "throws an exception if the key does not exist" do
- expect {@registry.value_exists?("HKCU\\Software\\Branch\\Flower", {:name=>"Petals"})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.value_exists?("HKCU\\Software\\Branch\\Flower", { :name => "Petals" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "returns true if the value exists" do
- expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals"})).to eq(true)
+ expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals" })).to eq(true)
end
it "returns true if the value exists with a case mismatch on the value name" do
- expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"petals"})).to eq(true)
+ expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "petals" })).to eq(true)
end
it "returns false if the value does not exist" do
- expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"FOOBAR"})).to eq(false)
+ expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "FOOBAR" })).to eq(false)
end
end
describe "value_exists!" do
it "throws an exception if the hive does not exist" do
- expect {@registry.value_exists!("JKLM\\Software\\Branch\\Flower", {:name=>"Petals"})}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.value_exists!("JKLM\\Software\\Branch\\Flower", { :name => "Petals" }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "throws an exception if the key does not exist" do
- expect {@registry.value_exists!("HKCU\\Software\\Branch\\Flower", {:name=>"Petals"})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.value_exists!("HKCU\\Software\\Branch\\Flower", { :name => "Petals" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "returns true if the value exists" do
- expect(@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals"})).to eq(true)
+ expect(@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals" })).to eq(true)
end
it "returns true if the value exists with a case mismatch on the value name" do
- expect(@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"petals"})).to eq(true)
+ expect(@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "petals" })).to eq(true)
end
it "throws an exception if the value does not exist" do
- expect {@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"FOOBAR"})}.to raise_error(Chef::Exceptions::Win32RegValueMissing)
+ expect { @registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "FOOBAR" }) }.to raise_error(Chef::Exceptions::Win32RegValueMissing)
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 => ["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 => ["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 => ["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 => ["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 => ["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)
+ 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 => ["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 => ["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 => ["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 => ["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 => ["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 => ["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)
+ 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 => ["Mauve", "Delicate"] }) }.to raise_error(Chef::Exceptions::Win32RegDataMissing)
end
end
@@ -187,85 +187,85 @@ describe "Chef::Win32::Registry", :windows_only do
it "returns all values for a key if it exists" do
values = @registry.get_values("HKCU\\Software\\Root")
expect(values).to be_an_instance_of Array
- expect(values).to eq([{:name=>"RootType1", :type=>:string, :data=>"fibrous"},
- {:name=>"Roots", :type=>:multi_string, :data=>["strong roots", "healthy tree"]}])
+ expect(values).to eq([{ :name => "RootType1", :type => :string, :data => "fibrous" },
+ { :name => "Roots", :type => :multi_string, :data => ["strong roots", "healthy tree"] }])
end
it "throws an exception if the key does not exist" do
- expect {@registry.get_values("HKCU\\Software\\Branch\\Flower")}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.get_values("HKCU\\Software\\Branch\\Flower") }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "throws an exception if the hive does not exist" do
- expect {@registry.get_values("JKLM\\Software\\Branch\\Flower")}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.get_values("JKLM\\Software\\Branch\\Flower") }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
end
describe "set_value" do
it "updates a value if the key, value exist and type matches and value different" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})).to eq(true)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Yellow", "Changed Color"] })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Yellow", "Changed Color"] })).to eq(true)
end
it "updates a value if the type does match and the values are different" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:string, :data=>"Yellow"})).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:string, :data=>"Yellow"})).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})).to eq(false)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :string, :data => "Yellow" })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :string, :data => "Yellow" })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Yellow", "Changed Color"] })).to eq(false)
end
it "creates a value if key exists and value does not" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Stamen", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Stamen", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})).to eq(true)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Stamen", :type => :multi_string, :data => ["Yellow", "Changed Color"] })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Stamen", :type => :multi_string, :data => ["Yellow", "Changed Color"] })).to eq(true)
end
it "does nothing if data,type and name parameters for the value are same" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Stamen", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})).to eq(false)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Stamen", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})).to eq(true)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Stamen", :type => :multi_string, :data => ["Yellow", "Changed Color"] })).to eq(false)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Stamen", :type => :multi_string, :data => ["Yellow", "Changed Color"] })).to eq(true)
end
it "throws an exception if the key does not exist" do
- expect {@registry.set_value("HKCU\\Software\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.set_value("HKCU\\Software\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Yellow", "Changed Color"] }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "throws an exception if the hive does not exist" do
- expect {@registry.set_value("JKLM\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.set_value("JKLM\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Yellow", "Changed Color"] }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
# we are validating that the data gets .to_i called on it when type is a :dword
it "casts an integer string given as a dword into an integer" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBe32767", :type=>:dword, :data=>"32767"})).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBe32767", :type=>:dword, :data=>32767})).to eq(true)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBe32767", :type => :dword, :data => "32767" })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBe32767", :type => :dword, :data => 32767 })).to eq(true)
end
it "casts a nonsense string given as a dword into zero" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBeZero", :type=>:dword, :data=>"whatdoesthisdo"})).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBeZero", :type=>:dword, :data=>0})).to eq(true)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBeZero", :type => :dword, :data => "whatdoesthisdo" })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBeZero", :type => :dword, :data => 0 })).to eq(true)
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 => ["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.data_exists?("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 => ["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
it "stores the string representation of a number into a string if you pass it an number" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBe65535", :type=>:string, :data=>65535})).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBe65535", :type=>:string, :data=>"65535"})).to eq(true)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBe65535", :type => :string, :data => 65535 })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBe65535", :type => :string, :data => "65535" })).to eq(true)
end
# we are validating that the data gets .to_a called on it when type is a :multi_string
it "throws an exception when a multi-string is passed a number" do
- expect {@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldThrow", :type=>:multi_string, :data=>65535})}.to raise_error
+ expect { @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldThrow", :type => :multi_string, :data => 65535 }) }.to raise_error
end
it "throws an exception when a multi-string is passed a string" do
- expect {@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBeWat", :type=>:multi_string, :data=>"foo"})}.to raise_error
+ expect { @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBeWat", :type => :multi_string, :data => "foo" }) }.to raise_error
end
end
@@ -280,7 +280,7 @@ describe "Chef::Win32::Registry", :windows_only do
end
it "throws an exception if the path has missing keys but recursive set to false" do
- expect {@registry.create_key("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", false)}.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
+ expect { @registry.create_key("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", false) }.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
expect(@registry.key_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker")).to eq(false)
end
@@ -295,7 +295,7 @@ describe "Chef::Win32::Registry", :windows_only do
end
it "throws an exception of the hive does not exist" do
- expect {@registry.create_key("JKLM\\Software\\Root\\Trunk\\Peck\\Woodpecker", false)}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.create_key("JKLM\\Software\\Root\\Trunk\\Peck\\Woodpecker", false) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
end
@@ -308,21 +308,21 @@ describe "Chef::Win32::Registry", :windows_only do
end
it "deletes values if the value exists" do
- expect(@registry.delete_value("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"})).to eq(true)
- expect(@registry.value_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"})).to eq(false)
+ expect(@registry.delete_value("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", { :name => "Peter", :type => :string, :data => "Tiny" })).to eq(true)
+ expect(@registry.value_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", { :name => "Peter", :type => :string, :data => "Tiny" })).to eq(false)
end
it "does nothing if value does not exist" do
- expect(@registry.delete_value("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"})).to eq(true)
- expect(@registry.value_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"})).to eq(false)
+ expect(@registry.delete_value("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", { :name => "Peter", :type => :string, :data => "Tiny" })).to eq(true)
+ expect(@registry.value_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", { :name => "Peter", :type => :string, :data => "Tiny" })).to eq(false)
end
it "throws an exception if the key does not exist?" do
- expect {@registry.delete_value("HKCU\\Software\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.delete_value("HKCU\\Software\\Trunk\\Peck\\Woodpecker", { :name => "Peter", :type => :string, :data => "Tiny" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "throws an exception if the hive does not exist" do
- expect {@registry.delete_value("JKLM\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"})}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.delete_value("JKLM\\Software\\Root\\Trunk\\Peck\\Woodpecker", { :name => "Peter", :type => :string, :data => "Tiny" }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
end
@@ -359,7 +359,7 @@ describe "Chef::Win32::Registry", :windows_only do
end
it "throws an exception if the hive does not exist" do
- expect {@registry.delete_key("JKLM\\Software\\Root\\Branch\\Flower", false)}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.delete_key("JKLM\\Software\\Root\\Branch\\Flower", false) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
end
@@ -375,11 +375,11 @@ describe "Chef::Win32::Registry", :windows_only do
end
it "throws an exception if the hive was missing" do
- expect {@registry.has_subkeys?("LMNO\\Software\\Root")}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.has_subkeys?("LMNO\\Software\\Root") }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "throws an exception if the key is missing" do
- expect {@registry.has_subkeys?("HKCU\\Software\\Root\\Trunk\\Red")}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.has_subkeys?("HKCU\\Software\\Root\\Trunk\\Red") }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "returns true if the key has subkeys" do
@@ -394,16 +394,16 @@ describe "Chef::Win32::Registry", :windows_only do
describe "get_subkeys" do
it "throws an exception if the key is missing" do
- expect {@registry.get_subkeys("HKCU\\Software\\Trunk\\Red")}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.get_subkeys("HKCU\\Software\\Trunk\\Red") }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "throws an exception if the hive does not exist" do
- expect {@registry.get_subkeys("JKLM\\Software\\Root")}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.get_subkeys("JKLM\\Software\\Root") }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "returns the array of subkeys for a given key" do
subkeys = @registry.get_subkeys("HKCU\\Software\\Root")
reg_subkeys = []
::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root", Win32::Registry::KEY_ALL_ACCESS) do |reg|
- reg.each_key{|name| reg_subkeys << name}
+ reg.each_key { |name| reg_subkeys << name }
end
expect(reg_subkeys).to eq(subkeys)
end
@@ -422,7 +422,7 @@ describe "Chef::Win32::Registry", :windows_only do
context "registry constructor" do
it "throws an exception if requested architecture is 64bit but running on 32bit" do
- expect {Chef::Win32::Registry.new(@run_context, :x86_64)}.to raise_error(Chef::Exceptions::Win32RegArchitectureIncorrect)
+ expect { Chef::Win32::Registry.new(@run_context, :x86_64) }.to raise_error(Chef::Exceptions::Win32RegArchitectureIncorrect)
end
it "can correctly set the requested architecture to 32-bit" do
@@ -440,7 +440,7 @@ describe "Chef::Win32::Registry", :windows_only do
context "architecture setter" do
it "throws an exception if requested architecture is 64bit but running on 32bit" do
- expect {@registry.architecture = :x86_64}.to raise_error(Chef::Exceptions::Win32RegArchitectureIncorrect)
+ expect { @registry.architecture = :x86_64 }.to raise_error(Chef::Exceptions::Win32RegArchitectureIncorrect)
end
it "sets the requested architecture to :machine if passed :machine" do
@@ -545,58 +545,58 @@ describe "Chef::Win32::Registry", :windows_only do
describe "key_exists?" do
it "does not find 64-bit keys in the 32-bit registry" do
- @registry.architecture=:i386
+ @registry.architecture = :i386
expect(@registry.key_exists?("HKLM\\Software\\Root\\Mauve")).to eq(false)
end
it "finds 32-bit keys in the 32-bit registry" do
- @registry.architecture=:i386
+ @registry.architecture = :i386
expect(@registry.key_exists?("HKLM\\Software\\Root\\Poosh")).to eq(true)
end
it "does not find 32-bit keys in the 64-bit registry" do
- @registry.architecture=:x86_64
+ @registry.architecture = :x86_64
expect(@registry.key_exists?("HKLM\\Software\\Root\\Mauve")).to eq(true)
end
it "finds 64-bit keys in the 64-bit registry" do
- @registry.architecture=:x86_64
+ @registry.architecture = :x86_64
expect(@registry.key_exists?("HKLM\\Software\\Root\\Poosh")).to eq(false)
end
end
describe "value_exists?" do
it "does not find 64-bit values in the 32-bit registry" do
- @registry.architecture=:i386
- expect{@registry.value_exists?("HKLM\\Software\\Root\\Mauve", {:name=>"Alert"})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ @registry.architecture = :i386
+ expect { @registry.value_exists?("HKLM\\Software\\Root\\Mauve", { :name => "Alert" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "finds 32-bit values in the 32-bit registry" do
- @registry.architecture=:i386
- expect(@registry.value_exists?("HKLM\\Software\\Root\\Poosh", {:name=>"Status"})).to eq(true)
+ @registry.architecture = :i386
+ expect(@registry.value_exists?("HKLM\\Software\\Root\\Poosh", { :name => "Status" })).to eq(true)
end
it "does not find 32-bit values in the 64-bit registry" do
- @registry.architecture=:x86_64
- expect(@registry.value_exists?("HKLM\\Software\\Root\\Mauve", {:name=>"Alert"})).to eq(true)
+ @registry.architecture = :x86_64
+ expect(@registry.value_exists?("HKLM\\Software\\Root\\Mauve", { :name => "Alert" })).to eq(true)
end
it "finds 64-bit values in the 64-bit registry" do
- @registry.architecture=:x86_64
- expect{@registry.value_exists?("HKLM\\Software\\Root\\Poosh", {:name=>"Status"})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ @registry.architecture = :x86_64
+ expect { @registry.value_exists?("HKLM\\Software\\Root\\Poosh", { :name => "Status" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
end
describe "data_exists?" do
it "does not find 64-bit keys in the 32-bit registry" do
- @registry.architecture=:i386
- expect{@registry.data_exists?("HKLM\\Software\\Root\\Mauve", {:name=>"Alert", :type=>:string, :data=>"Universal"})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ @registry.architecture = :i386
+ expect { @registry.data_exists?("HKLM\\Software\\Root\\Mauve", { :name => "Alert", :type => :string, :data => "Universal" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "finds 32-bit keys in the 32-bit registry" do
- @registry.architecture=:i386
- expect(@registry.data_exists?("HKLM\\Software\\Root\\Poosh", {:name=>"Status", :type=>:string, :data=>"Lost"})).to eq(true)
+ @registry.architecture = :i386
+ expect(@registry.data_exists?("HKLM\\Software\\Root\\Poosh", { :name => "Status", :type => :string, :data => "Lost" })).to eq(true)
end
it "does not find 32-bit keys in the 64-bit registry" do
- @registry.architecture=:x86_64
- expect(@registry.data_exists?("HKLM\\Software\\Root\\Mauve", {:name=>"Alert", :type=>:string, :data=>"Universal"})).to eq(true)
+ @registry.architecture = :x86_64
+ expect(@registry.data_exists?("HKLM\\Software\\Root\\Mauve", { :name => "Alert", :type => :string, :data => "Universal" })).to eq(true)
end
it "finds 64-bit keys in the 64-bit registry" do
- @registry.architecture=:x86_64
- expect{@registry.data_exists?("HKLM\\Software\\Root\\Poosh", {:name=>"Status", :type=>:string, :data=>"Lost"})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ @registry.architecture = :x86_64
+ expect { @registry.data_exists?("HKLM\\Software\\Root\\Poosh", { :name => "Status", :type => :string, :data => "Lost" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
end
diff --git a/spec/functional/win32/security_spec.rb b/spec/functional/win32/security_spec.rb
index abf6b42e10..c4951f375c 100644
--- a/spec/functional/win32/security_spec.rb
+++ b/spec/functional/win32/security_spec.rb
@@ -70,7 +70,7 @@ 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
- expect(Chef::ReservedNames::Win32::Security.access_check(security_descriptor,
+ expect(Chef::ReservedNames::Win32::Security.access_check(security_descriptor,
token, desired_access, mapping)).to be true
end
end
@@ -85,7 +85,7 @@ describe "Chef::Win32::Security", :windows_only do
let(:token_rights) { Chef::ReservedNames::Win32::Security::TOKEN_ALL_ACCESS }
it "can duplicate a token" do
- expect{ token.duplicate_token(:SecurityImpersonation) }.not_to raise_error
+ expect { token.duplicate_token(:SecurityImpersonation) }.not_to raise_error
end
end
@@ -93,7 +93,7 @@ describe "Chef::Win32::Security", :windows_only do
let(:token_rights) { Chef::ReservedNames::Win32::Security::TOKEN_READ }
it "raises an exception when trying to duplicate" do
- expect{ token.duplicate_token(:SecurityImpersonation) }.to raise_error(Chef::Exceptions::Win32APIError)
+ expect { token.duplicate_token(:SecurityImpersonation) }.to raise_error(Chef::Exceptions::Win32APIError)
end
end
end
diff --git a/spec/functional/win32/service_manager_spec.rb b/spec/functional/win32/service_manager_spec.rb
index b2bf04ed0c..7f8e943367 100644
--- a/spec/functional/win32/service_manager_spec.rb
+++ b/spec/functional/win32/service_manager_spec.rb
@@ -101,8 +101,8 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
end
it "install => should say service already exists" do
- service_manager.run(["-a", "install"])
- expect(@service_manager_output.grep(/already exists/).length).to be > 0
+ service_manager.run(["-a", "install"])
+ expect(@service_manager_output.grep(/already exists/).length).to be > 0
end
context "and service is stopped" do
@@ -133,7 +133,6 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
expect(test_service_state).to eq("stopped")
end
-
["pause", "resume"].each do |action|
it "#{action} => should raise error" do
expect { service_manager.run(["-a", action]) }.to raise_error(SystemCallError)
@@ -211,7 +210,7 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
end
it "start should raise an error" do
- expect {service_manager.run(["-a", "start"])}.to raise_error(::Win32::Service::Error)
+ expect { service_manager.run(["-a", "start"]) }.to raise_error(::Win32::Service::Error)
end
end
diff --git a/spec/functional/win32/versions_spec.rb b/spec/functional/win32/versions_spec.rb
index 345df303a4..aee5bbbcd4 100644
--- a/spec/functional/win32/versions_spec.rb
+++ b/spec/functional/win32/versions_spec.rb
@@ -52,7 +52,7 @@ describe "Chef::ReservedNames::Win32::Version", :windows_only, :not_supported_on
def for_each_windows_version(&block)
@version.methods.each do |method_name|
- if Chef::ReservedNames::Win32::Version::WIN_VERSIONS.keys.find { | key | method_name.to_s == Chef::ReservedNames::Win32::Version.send(:method_name_from_marketing_name,key) }
+ if Chef::ReservedNames::Win32::Version::WIN_VERSIONS.keys.find { |key| method_name.to_s == Chef::ReservedNames::Win32::Version.send(:method_name_from_marketing_name, key) }
yield method_name
end
end