summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-07-05 13:41:00 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-07-05 13:41:00 -0700
commit174a2748b54a5dbd746005e2aead59221b80f2b9 (patch)
tree55e4bacca96b540526f3c19a00d666e68610ea6e /spec/support
parent3b10f9ca503dcbce747241281b9151d3d010f9ef (diff)
downloadchef-174a2748b54a5dbd746005e2aead59221b80f2b9.tar.gz
fix 4 cops
- Layout/MultilineMethodCallBraceLayout - Layout/ClosingParenthesisIndentation - Layout/IndentFirstArgument EnforcedStyle: consistent - Layout/BlockEndNewline the first of these autocorrected to horrible looking code which exposed that we really needed the other three as well, which also cleaned up a bunch of other terrible looking code. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared/functional/http.rb38
-rw-r--r--spec/support/shared/functional/windows_script.rb3
-rw-r--r--spec/support/shared/integration/app_server_support.rb7
-rw-r--r--spec/support/shared/unit/application_dot_d.rb12
4 files changed, 30 insertions, 30 deletions
diff --git a/spec/support/shared/functional/http.rb b/spec/support/shared/functional/http.rb
index 58189e543f..f006c6a24a 100644
--- a/spec/support/shared/functional/http.rb
+++ b/spec/support/shared/functional/http.rb
@@ -74,10 +74,9 @@ module ChefHTTPShared
@api.get("/nyan_cat_content_length.png", 200, nil,
{
"Content-Length" => nyan_uncompressed_size.to_s,
- }
- ) do
- File.open(nyan_uncompressed_filename, "rb", &:read)
- end
+ }) do
+ File.open(nyan_uncompressed_filename, "rb", &:read)
+ end
# (expected_content should be uncompressed)
@api.get("/nyan_cat_content_length_compressed.png", 200, nil,
@@ -85,10 +84,9 @@ module ChefHTTPShared
"Content-Length" => nyan_compressed_size.to_s,
"Content-Type" => "application/gzip",
"Content-Encoding" => "gzip",
- }
- ) do
- File.open(nyan_compressed_filename, "rb", &:read)
- end
+ }) do
+ File.open(nyan_compressed_filename, "rb", &:read)
+ end
#
# endpoints that simulate truncated downloads (bad content-length header)
@@ -98,10 +96,9 @@ module ChefHTTPShared
@api.get("/nyan_cat_truncated.png", 200, nil,
{
"Content-Length" => (nyan_uncompressed_size + 1).to_s,
- }
- ) do
- File.open(nyan_uncompressed_filename, "rb", &:read)
- end
+ }) do
+ File.open(nyan_uncompressed_filename, "rb", &:read)
+ end
# (expected_content should be uncompressed)
@api.get("/nyan_cat_truncated_compressed.png", 200, nil,
@@ -109,10 +106,9 @@ module ChefHTTPShared
"Content-Length" => (nyan_compressed_size + 1).to_s,
"Content-Type" => "application/gzip",
"Content-Encoding" => "gzip",
- }
- ) do
- File.open(nyan_compressed_filename, "rb", &:read)
- end
+ }) do
+ File.open(nyan_compressed_filename, "rb", &:read)
+ end
#
# in the presence of a transfer-encoding header, we must ignore the content-length (this bad content-length should work)
@@ -123,10 +119,9 @@ module ChefHTTPShared
{
"Content-Length" => (nyan_uncompressed_size + 1).to_s,
"Transfer-Encoding" => "anything",
- }
- ) do
- File.open(nyan_uncompressed_filename, "rb", &:read)
- end
+ }) do
+ File.open(nyan_uncompressed_filename, "rb", &:read)
+ end
#
# 403 with a Content-Length
@@ -134,8 +129,7 @@ module ChefHTTPShared
@api.get("/forbidden", 403, "Forbidden",
{
"Content-Length" => "Forbidden".bytesize.to_s,
- }
- )
+ })
@api.post("/posty", 200, "Hi!")
diff --git a/spec/support/shared/functional/windows_script.rb b/spec/support/shared/functional/windows_script.rb
index 5eb68952d7..49fd727055 100644
--- a/spec/support/shared/functional/windows_script.rb
+++ b/spec/support/shared/functional/windows_script.rb
@@ -114,7 +114,8 @@ shared_context Chef::Resource::WindowsScript do
resource.only_if resource_guard_command, architecture: guard_architecture
expect { resource.run_action(:run) }.to raise_error(
Chef::Exceptions::Win32ArchitectureIncorrect,
- /cannot execute script with requested architecture 'i386' on Windows Nano Server/)
+ /cannot execute script with requested architecture 'i386' on Windows Nano Server/
+ )
end
end
end
diff --git a/spec/support/shared/integration/app_server_support.rb b/spec/support/shared/integration/app_server_support.rb
index 7f05b14689..317a5a2679 100644
--- a/spec/support/shared/integration/app_server_support.rb
+++ b/spec/support/shared/integration/app_server_support.rb
@@ -27,10 +27,9 @@ module AppServerSupport
Rack::Handler::WEBrick.run(app,
Port: 9018,
AccessLog: [],
- Logger: WEBrick::Log.new(StringIO.new, 7)
- ) do |found_server|
- server = found_server
- end
+ Logger: WEBrick::Log.new(StringIO.new, 7)) do |found_server|
+ server = found_server
+ end
end
Timeout.timeout(30) do
sleep(0.01) until server && server.status == :Running
diff --git a/spec/support/shared/unit/application_dot_d.rb b/spec/support/shared/unit/application_dot_d.rb
index 505fe08190..0f2f06eff8 100644
--- a/spec/support/shared/unit/application_dot_d.rb
+++ b/spec/support/shared/unit/application_dot_d.rb
@@ -33,7 +33,9 @@ shared_examples_for "an application that loads a dot d" do
# make sure that we are correctly globbing.
let(:client_d_dir) do
Chef::Util::PathHelper.cleanpath(
- File.join(File.dirname(__FILE__), "../../../data/client.d_00")) end
+ File.join(File.dirname(__FILE__), "../../../data/client.d_00")
+ )
+ end
it "loads the configuration in order" do
expect(IO).to receive(:read).with(Pathname.new("#{client_d_dir}/00-foo.rb").cleanpath.to_s).and_return("foo 0")
@@ -50,7 +52,9 @@ shared_examples_for "an application that loads a dot d" do
context "when client_d_dir is set to a directory without configuration" do
let(:client_d_dir) do
Chef::Util::PathHelper.cleanpath(
- File.join(File.dirname(__FILE__), "../../data/client.d_01")) end
+ File.join(File.dirname(__FILE__), "../../data/client.d_01")
+ )
+ end
# client.d_01 has a nested folder with a rb file that if
# executed, would raise an exception. If it is executed,
@@ -66,7 +70,9 @@ shared_examples_for "an application that loads a dot d" do
# foo.rb as a directory should be ignored
let(:client_d_dir) do
Chef::Util::PathHelper.cleanpath(
- File.join(File.dirname(__FILE__), "../../data/client.d_02")) end
+ File.join(File.dirname(__FILE__), "../../data/client.d_02")
+ )
+ end
it "does not raise an exception" do
expect { app.reconfigure }.not_to raise_error