summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-07-02 15:50:39 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-07-02 15:50:39 -0700
commitf50ffe2b1b3b0afc7aa2b01a9356e439f78a5fcd (patch)
tree204cefb3c64929278dc7e6a7f3de220475154533 /spec
parent36075b93536da78cd50ffe4eebe1ae4613a04ec9 (diff)
downloadchef-f50ffe2b1b3b0afc7aa2b01a9356e439f78a5fcd.tar.gz
tweak Lint/BlockAlignment
Lint/BlockAlignment: Enabled: true EnforcedStyleAlignWith: start_of_block this works better with Layout/MultilineMethodCallIndentation to force indentation of multiline method calls that wind up with multiline blocks. i'd probably pull back the end to match with the start of the expression but this gets the indentation level inside the block correct. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r--spec/support/mock/platform.rb4
-rw-r--r--spec/unit/knife/core/node_editor_spec.rb16
-rw-r--r--spec/unit/property/state_spec.rb44
-rw-r--r--spec/unit/provider/mount/mount_spec.rb22
-rw-r--r--spec/unit/provider/powershell_script_spec.rb20
-rw-r--r--spec/unit/provider/service/windows_spec.rb16
-rw-r--r--spec/unit/resource/windows_service_spec.rb10
7 files changed, 66 insertions, 66 deletions
diff --git a/spec/support/mock/platform.rb b/spec/support/mock/platform.rb
index c6670827f9..2cf605c741 100644
--- a/spec/support/mock/platform.rb
+++ b/spec/support/mock/platform.rb
@@ -19,7 +19,7 @@ def platform_mock(platform = :unix)
mock_constants({ "RUBY_PLATFORM" => (platform == :windows ? "i386-mingw32" : "x86_64-darwin11.2.0"),
"File::PATH_SEPARATOR" => (platform == :windows ? ";" : ":"),
"File::ALT_SEPARATOR" => (platform == :windows ? "\\" : nil) }) do
- yield
- end
+ yield
+ end
end
end
diff --git a/spec/unit/knife/core/node_editor_spec.rb b/spec/unit/knife/core/node_editor_spec.rb
index ccf6776593..493de3c5b1 100644
--- a/spec/unit/knife/core/node_editor_spec.rb
+++ b/spec/unit/knife/core/node_editor_spec.rb
@@ -44,13 +44,13 @@ describe Chef::Knife::NodeEditor do
describe "#view" do
it "returns a Hash with only the name, chef_environment, normal, " +
"policy_name, policy_group, and run_list properties" do
- expected = node_data.select do |key,|
- %w{ name chef_environment normal
- policy_name policy_group run_list }.include?(key)
- end
+ expected = node_data.select do |key,|
+ %w{ name chef_environment normal
+ policy_name policy_group run_list }.include?(key)
+ end
- expect(subject.view).to eq(expected)
- end
+ expect(subject.view).to eq(expected)
+ end
context "when config[:all_attributes] == true" do
let(:config) { base_config.merge(all_attributes: true) }
@@ -190,8 +190,8 @@ describe Chef::Knife::NodeEditor do
it "returns an array of property names that doesn't include " +
"the non-editable properties" do
- expect(subject.updated?).to eql %w{ chef_environment normal policy_name policy_group run_list }
- end
+ expect(subject.updated?).to eql %w{ chef_environment normal policy_name policy_group run_list }
+ end
end
end
diff --git a/spec/unit/property/state_spec.rb b/spec/unit/property/state_spec.rb
index ca2cd99214..1283fd2456 100644
--- a/spec/unit/property/state_spec.rb
+++ b/spec/unit/property/state_spec.rb
@@ -257,29 +257,29 @@ describe "Chef::Resource#identity and #state" do
with_property ":x, identity: true, default: 'xxx'",
":y, identity: true, default: 'yyy'",
":z, identity: true, default: 'zzz'" do
- it "identity_property raises an error if multiple identity values are defined" do
- expect { resource_class.identity_property }.to raise_error Chef::Exceptions::MultipleIdentityError
- end
- it "identity_attr raises an error if multiple identity values are defined" do
- expect { resource_class.identity_attr }.to raise_error Chef::Exceptions::MultipleIdentityError
- end
- it "identity returns all identity values in a hash if multiple are defined" do
- resource.x "foo"
- resource.y "bar"
- resource.z "baz"
- expect(resource.identity).to eq(x: "foo", y: "bar", z: "baz")
- end
- it "identity returns all values whether any value is set or not" do
- expect(resource.identity).to eq(x: "xxx", y: "yyy", z: "zzz")
- end
- it "identity_properties wipes out any other identity attributes if multiple are defined" do
- resource_class.identity_properties :y
- resource.x "foo"
- resource.y "bar"
- resource.z "baz"
- expect(resource.identity).to eq "bar"
+ it "identity_property raises an error if multiple identity values are defined" do
+ expect { resource_class.identity_property }.to raise_error Chef::Exceptions::MultipleIdentityError
+ end
+ it "identity_attr raises an error if multiple identity values are defined" do
+ expect { resource_class.identity_attr }.to raise_error Chef::Exceptions::MultipleIdentityError
+ end
+ it "identity returns all identity values in a hash if multiple are defined" do
+ resource.x "foo"
+ resource.y "bar"
+ resource.z "baz"
+ expect(resource.identity).to eq(x: "foo", y: "bar", z: "baz")
+ end
+ it "identity returns all values whether any value is set or not" do
+ expect(resource.identity).to eq(x: "xxx", y: "yyy", z: "zzz")
+ end
+ it "identity_properties wipes out any other identity attributes if multiple are defined" do
+ resource_class.identity_properties :y
+ resource.x "foo"
+ resource.y "bar"
+ resource.z "baz"
+ expect(resource.identity).to eq "bar"
+ end
end
- end
with_property ":x, identity: true, name_property: true" do
it "identity when x is not defined returns the value of x" do
diff --git a/spec/unit/provider/mount/mount_spec.rb b/spec/unit/provider/mount/mount_spec.rb
index 866b548d4e..5e1ffbf208 100644
--- a/spec/unit/provider/mount/mount_spec.rb
+++ b/spec/unit/provider/mount/mount_spec.rb
@@ -67,18 +67,18 @@ describe Chef::Provider::Mount::Mount do
describe "when dealing with network mounts" do
{ "nfs" => "nfsserver:/vol/path",
"cifs" => "//cifsserver/share" }.each do |type, fs_spec|
- it "should detect network fs_spec (#{type})" do
- @new_resource.device fs_spec
- expect(@provider.network_device?).to be_truthy
+ it "should detect network fs_spec (#{type})" do
+ @new_resource.device fs_spec
+ expect(@provider.network_device?).to be_truthy
+ end
+
+ it "should ignore trailing slash and set mounted to true for network mount (#{type})" do
+ @new_resource.device fs_spec
+ allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "#{fs_spec}/ on /tmp/foo type #{type} (rw)\n"))
+ @provider.load_current_resource
+ expect(@provider.current_resource.mounted).to be_truthy
+ end
end
-
- it "should ignore trailing slash and set mounted to true for network mount (#{type})" do
- @new_resource.device fs_spec
- allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "#{fs_spec}/ on /tmp/foo type #{type} (rw)\n"))
- @provider.load_current_resource
- expect(@provider.current_resource.mounted).to be_truthy
- end
- end
end
it "should raise an error if the mount device does not exist" do
diff --git a/spec/unit/provider/powershell_script_spec.rb b/spec/unit/provider/powershell_script_spec.rb
index 61c415f88d..a247c26651 100644
--- a/spec/unit/provider/powershell_script_spec.rb
+++ b/spec/unit/provider/powershell_script_spec.rb
@@ -107,19 +107,19 @@ describe Chef::Provider::PowershellScript, "action_run" do
"3.6" => "Bypass",
"4.0" => "Bypass",
"5.0" => "Bypass" }.each do |version_policy|
- let(:powershell_version) { version_policy[0].to_f }
- context "when running PowerShell version #{version_policy[0]}" do
let(:powershell_version) { version_policy[0].to_f }
-
- it "sets default -ExecutionPolicy flag to '#{version_policy[1]}'" do
- expect(execution_policy_flag.downcase).to eq(version_policy[1].downcase)
- end
- it "sets user defined -ExecutionPolicy flag to 'RemoteSigned'" do
- set_user_defined_flag
- expect(execution_policy_flag.downcase).to eq("RemoteSigned".downcase)
+ context "when running PowerShell version #{version_policy[0]}" do
+ let(:powershell_version) { version_policy[0].to_f }
+
+ it "sets default -ExecutionPolicy flag to '#{version_policy[1]}'" do
+ expect(execution_policy_flag.downcase).to eq(version_policy[1].downcase)
+ end
+ it "sets user defined -ExecutionPolicy flag to 'RemoteSigned'" do
+ set_user_defined_flag
+ expect(execution_policy_flag.downcase).to eq("RemoteSigned".downcase)
+ end
end
end
- end
end
end
end
diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb
index 9145a0caf4..8cda32973e 100644
--- a/spec/unit/provider/service/windows_spec.rb
+++ b/spec/unit/provider/service/windows_spec.rb
@@ -357,14 +357,14 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
# properties that are Strings
%i{binary_path_name load_order_group dependencies run_as_user
display_name description}.each do |attr|
- it "configures service if #{attr} has changed" do
- provider.current_resource.send("#{attr}=", "old value")
- provider.new_resource.send("#{attr}=", "new value")
-
- expect(Win32::Service).to receive(:configure)
- provider.action_configure
- end
- end
+ it "configures service if #{attr} has changed" do
+ provider.current_resource.send("#{attr}=", "old value")
+ provider.new_resource.send("#{attr}=", "new value")
+
+ expect(Win32::Service).to receive(:configure)
+ provider.action_configure
+ end
+ end
# properties that are Integers
%i{service_type error_control}.each do |attr|
diff --git a/spec/unit/resource/windows_service_spec.rb b/spec/unit/resource/windows_service_spec.rb
index 53cf1bc0f8..a416ca0a05 100644
--- a/spec/unit/resource/windows_service_spec.rb
+++ b/spec/unit/resource/windows_service_spec.rb
@@ -84,11 +84,11 @@ describe Chef::Resource::WindowsService, "initialize" do
# Properties that are Strings
%i{description service_name binary_path_name load_order_group dependencies
run_as_user run_as_password display_name}.each do |prop|
- it "support setting #{prop} property with a String" do
- resource.send("#{prop}=", "some value")
- expect(resource.send(prop)).to eq("some value")
- end
- end
+ it "support setting #{prop} property with a String" do
+ resource.send("#{prop}=", "some value")
+ expect(resource.send(prop)).to eq("some value")
+ end
+ end
# Properties that are Integers
%i{desired_access error_control service_type}.each do |prop|