summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-02-09 07:53:56 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-02-09 07:53:56 -0800
commitf073747786abbe6ada55ed24b696a03e39c3c45d (patch)
tree7971d871e89d522a58291713761a6c83f68e8d19 /spec/support
parentc6e69783705cfd48bfea0c943dc071964dd21311 (diff)
downloadchef-f073747786abbe6ada55ed24b696a03e39c3c45d.tar.gz
auto fixing some rubocops
Style/NegatedWhile Style/ParenthesesAroundCondition Style/WhileUntilDo Style/WordArray Performance/ReverseEach Style/ColonMethodCall
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/platforms/win32/spec_service.rb2
-rw-r--r--spec/support/shared/functional/directory_resource.rb4
-rw-r--r--spec/support/shared/functional/file_resource.rb8
-rw-r--r--spec/support/shared/functional/windows_script.rb2
-rw-r--r--spec/support/shared/integration/app_server_support.rb4
-rw-r--r--spec/support/shared/unit/platform_introspector.rb6
-rw-r--r--spec/support/shared/unit/provider/file.rb2
-rw-r--r--spec/support/shared/unit/provider/useradd_based_user_provider.rb2
8 files changed, 15 insertions, 15 deletions
diff --git a/spec/support/platforms/win32/spec_service.rb b/spec/support/platforms/win32/spec_service.rb
index c196e13b6a..5548a79afc 100644
--- a/spec/support/platforms/win32/spec_service.rb
+++ b/spec/support/platforms/win32/spec_service.rb
@@ -24,7 +24,7 @@ class SpecService < ::Win32::Daemon
end
def service_main(*startup_parameters)
- while running? do
+ while running?
if !File.exists?(@test_service_file)
File.open(@test_service_file, "wb") do |f|
f.write("This file is created by SpecService")
diff --git a/spec/support/shared/functional/directory_resource.rb b/spec/support/shared/functional/directory_resource.rb
index 084cd43009..5e5e2bb360 100644
--- a/spec/support/shared/functional/directory_resource.rb
+++ b/spec/support/shared/functional/directory_resource.rb
@@ -163,11 +163,11 @@ shared_context Chef::Resource::Directory do
end
before do
- FileUtils::mkdir_p(test_file_dir)
+ FileUtils.mkdir_p(test_file_dir)
end
after do
- FileUtils::rm_rf(test_file_dir)
+ FileUtils.rm_rf(test_file_dir)
end
after(:each) do
diff --git a/spec/support/shared/functional/file_resource.rb b/spec/support/shared/functional/file_resource.rb
index 5f34f1efe6..bb8db772be 100644
--- a/spec/support/shared/functional/file_resource.rb
+++ b/spec/support/shared/functional/file_resource.rb
@@ -781,11 +781,11 @@ shared_examples_for "a configured file resource" do
let(:test_socket_dir) { File.join(Dir.tmpdir, "sockets") }
before do
- FileUtils::mkdir_p(test_socket_dir)
+ FileUtils.mkdir_p(test_socket_dir)
end
after do
- FileUtils::rm_rf(test_socket_dir)
+ FileUtils.rm_rf(test_socket_dir)
end
let(:path) do
@@ -1035,7 +1035,7 @@ shared_context Chef::Resource::File do
end
before do
- FileUtils::mkdir_p(test_file_dir)
+ FileUtils.mkdir_p(test_file_dir)
end
after(:each) do
@@ -1044,6 +1044,6 @@ shared_context Chef::Resource::File do
end
after do
- FileUtils::rm_rf(test_file_dir)
+ FileUtils.rm_rf(test_file_dir)
end
end
diff --git a/spec/support/shared/functional/windows_script.rb b/spec/support/shared/functional/windows_script.rb
index 67a53306ba..eb456b191f 100644
--- a/spec/support/shared/functional/windows_script.rb
+++ b/spec/support/shared/functional/windows_script.rb
@@ -24,7 +24,7 @@ require "chef/platform/query_helpers"
shared_context Chef::Resource::WindowsScript do
before(:all) do
@ohai_reader = Ohai::System.new
- @ohai_reader.all_plugins(["platform", "kernel"])
+ @ohai_reader.all_plugins(%w(platform kernel))
new_node = Chef::Node.new
new_node.consume_external_attrs(@ohai_reader.data, {})
diff --git a/spec/support/shared/integration/app_server_support.rb b/spec/support/shared/integration/app_server_support.rb
index c504c7ca99..8327caf1c9 100644
--- a/spec/support/shared/integration/app_server_support.rb
+++ b/spec/support/shared/integration/app_server_support.rb
@@ -27,12 +27,12 @@ module AppServerSupport
Rack::Handler::WEBrick.run(app,
:Port => 9018,
:AccessLog => [],
- :Logger => WEBrick::Log::new(StringIO.new, 7),
+ :Logger => WEBrick::Log.new(StringIO.new, 7),
) do |found_server|
server = found_server
end
end
- Timeout::timeout(30) do
+ Timeout.timeout(30) do
until server && server.status == :Running
sleep(0.01)
end
diff --git a/spec/support/shared/unit/platform_introspector.rb b/spec/support/shared/unit/platform_introspector.rb
index 2e6f74fb14..e458e1b941 100644
--- a/spec/support/shared/unit/platform_introspector.rb
+++ b/spec/support/shared/unit/platform_introspector.rb
@@ -26,7 +26,7 @@ shared_examples_for "a platform introspector" do
"1.2.3" => "#{x}-1.2.3",
}
end
- @platform_hash["debian"] = { ["5", "6"] => "debian-5/6", "default" => "debian" }
+ @platform_hash["debian"] = { %w(5 6) => "debian-5/6", "default" => "debian" }
@platform_hash["default"] = "default"
# The following @platform_hash keys are used for testing version constraints
@platform_hash["exact_match"] = { "1.2.3" => "exact", ">= 1.0" => "not exact" }
@@ -130,7 +130,7 @@ shared_examples_for "a platform introspector" do
it "returns true if the node is a provided platform and platforms are provided as strings" do
node.automatic_attrs[:platform] = "ubuntu"
- expect(platform_introspector.platform?(["redhat", "ubuntu"])).to eq(true)
+ expect(platform_introspector.platform?(%w(redhat ubuntu))).to eq(true)
end
it "returns false if the node is not of the provided platforms" do
@@ -148,7 +148,7 @@ shared_examples_for "a platform introspector" do
it "returns true if the node is a provided platform and platforms are provided as strings" do
node.automatic_attrs[:platform_family] = "rhel"
- expect(platform_introspector.platform_family?(["rhel", "debian"])).to eq(true)
+ expect(platform_introspector.platform_family?(%w(rhel debian))).to eq(true)
end
it "returns false if the node is not of the provided platforms" do
diff --git a/spec/support/shared/unit/provider/file.rb b/spec/support/shared/unit/provider/file.rb
index 5e5fc058e7..7ddd51db80 100644
--- a/spec/support/shared/unit/provider/file.rb
+++ b/spec/support/shared/unit/provider/file.rb
@@ -142,7 +142,7 @@ shared_examples_for Chef::Provider::File do
end
after do
- tempfile.close if (tempfile && !tempfile.closed?)
+ tempfile.close if tempfile && !tempfile.closed?
File.unlink(tempfile.path) rescue nil
end
diff --git a/spec/support/shared/unit/provider/useradd_based_user_provider.rb b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
index 6694aa346c..0b024b5b60 100644
--- a/spec/support/shared/unit/provider/useradd_based_user_provider.rb
+++ b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
@@ -315,7 +315,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
expect { provider.check_lock }.to raise_error(Chef::Exceptions::User)
end
- ["redhat", "centos"].each do |os|
+ %w(redhat centos).each do |os|
it "should not raise a Chef::Exceptions::User if passwd -S exits with 1 on #{os} and the passwd package is version 0.73-1" do
@node.automatic_attrs[:platform] = os
expect(passwd_s_status).to receive(:exitstatus).and_return(1)