diff options
author | Davin Taddeo <davin@chef.io> | 2020-06-15 20:12:39 -0400 |
---|---|---|
committer | Davin Taddeo <davin@chef.io> | 2020-06-15 20:12:39 -0400 |
commit | 12f3e9b66a34f76a43547caed94191c06e3aa5f8 (patch) | |
tree | f4e5b26758bb86a24dd5e6d180bacb2cc57ec7b3 | |
parent | 557146fd421cfff6c047a55dbcd401f52f5e69e6 (diff) | |
download | chef-12f3e9b66a34f76a43547caed94191c06e3aa5f8.tar.gz |
unit test fix and chefstyle fixes
Signed-off-by: Davin Taddeo <davin@chef.io>
-rw-r--r-- | lib/chef/resource/windows_firewall_profile.rb | 8 | ||||
-rw-r--r-- | spec/unit/resource/windows_firewall_policy_spec.rb | 20 |
2 files changed, 14 insertions, 14 deletions
diff --git a/lib/chef/resource/windows_firewall_profile.rb b/lib/chef/resource/windows_firewall_profile.rb index cc6feb0d67..9c98177644 100644 --- a/lib/chef/resource/windows_firewall_profile.rb +++ b/lib/chef/resource/windows_firewall_profile.rb @@ -76,7 +76,7 @@ class Chef description: "Set the default policy for outbound network traffic" property :allow_inbound_rules, String, equal_to: %w{ True False NotConfigured }, description: "Allow users to set inbound firewall rules" - property :allow_local_firewall_rules, String, equal_to: %w{ True False NotConfigured },description: "Merges inbound firewall rules into the policy" + property :allow_local_firewall_rules, String, equal_to: %w{ True False NotConfigured }, description: "Merges inbound firewall rules into the policy" property :allow_local_ipsec_rules, String, equal_to: %w{ True False NotConfigured }, description: "Allow users to manage local connection security rules" property :allow_user_apps, String, equal_to: %w{ True False NotConfigured }, description: "Allow user applications to manage firewall" property :allow_user_ports, String, equal_to: %w{ True False NotConfigured }, description: "Allow users to manage firewall port rules" @@ -106,9 +106,9 @@ class Chef action :enable do converge_if_changed :default_inbound_action, :default_outbound_action, :allow_inbound_rules, :allow_local_firewall_rules, :allow_local_ipsec_rules, :allow_user_apps, :allow_user_ports, :allow_unicast_response, :display_notification do - fw_cmd = firewall_command(new_resource.profile) - powershell_exec!(fw_cmd) - end + fw_cmd = firewall_command(new_resource.profile) + powershell_exec!(fw_cmd) + end unless firewall_enabled?(new_resource.profile) converge_by "Enable the #{new_resource.profile} Firewall Profile" do cmd = "Set-NetFirewallProfile -Profile #{new_resource.profile} -Enabled \"True\"" diff --git a/spec/unit/resource/windows_firewall_policy_spec.rb b/spec/unit/resource/windows_firewall_policy_spec.rb index 7b548c950a..347234121c 100644 --- a/spec/unit/resource/windows_firewall_policy_spec.rb +++ b/spec/unit/resource/windows_firewall_policy_spec.rb @@ -36,39 +36,39 @@ describe Chef::Resource::WindowsFirewallProfile do it "the resource's default_inbound_action property only strings Block, Allow, or NotConfigured" do expect { resource.default_inbound_action "AllowSome" }.to raise_error(ArgumentError) - expect { resource.default_inbound_action "Block"}.not_to raise_error + expect { resource.default_inbound_action "Block" }.not_to raise_error end it "the resource's default_outbound_action property only accepts strings Block, Allow, or NotConfigured" do expect { resource.default_outbound_action "BlockMost" }.to raise_error(ArgumentError) - expect { resource.default_outbound_action "Allow"}.not_to raise_error + expect { resource.default_outbound_action "Allow" }.not_to raise_error end it "the resource's allow_inbound_rules property only accepts strings True, False, or NotConfigured" do expect { resource.allow_inbound_rules "Yes" }.to raise_error(ArgumentError) - expect { resource.allow_inbound_rules "True"}.not_to raise_error + expect { resource.allow_inbound_rules "True" }.not_to raise_error end it "the resource's allow_local_firewall_rules property only accepts strings True, False, or NotConfigured" do expect { resource.allow_local_firewall_rules "No" }.to raise_error(ArgumentError) - expect { resource.allow_local_firewall_rules "False"}.not_to raise_error + expect { resource.allow_local_firewall_rules "False" }.not_to raise_error end it "the resource's allow_local_ipsec_rules property only accepts strings True, False, or NotConfigured" do expect { resource.allow_local_ipsec_rules "Yes" }.to raise_error(ArgumentError) - expect { resource.allow_local_ipsec_rules "True"}.not_to raise_error + expect { resource.allow_local_ipsec_rules "True" }.not_to raise_error end it "the resource's allow_user_apps property only accepts strings True, False, or NotConfigured" do expect { resource.allow_user_apps "No" }.to raise_error(ArgumentError) - expect { resource.allow_user_apps "False"}.not_to raise_error + expect { resource.allow_user_apps "False" }.not_to raise_error end it "the resource's allow_user_ports property only accepts strings True, False, or NotConfigured" do - expect { resource.allow_user_ports nil }.to raise_error(ArgumentError) - expect { resource.allow_user_ports "NotConfigured"}.not_to raise_error + expect { resource.allow_user_ports false }.to raise_error(ArgumentError) + expect { resource.allow_user_ports "NotConfigured" }.not_to raise_error end it "the resource's allow_unicast_response property only accepts strings True, False, or NotConfigured" do expect { resource.allow_unicast_response true }.to raise_error(ArgumentError) - expect { resource.allow_unicast_response "True"}.not_to raise_error + expect { resource.allow_unicast_response "True" }.not_to raise_error end it "the resource's display_notification property only accepts strings True, False, or NotConfigured" do expect { resource.display_notification false }.to raise_error(ArgumentError) - expect { resource.display_notification "False"}.not_to raise_error + expect { resource.display_notification "False" }.not_to raise_error end it "sets the default action as :configure" do |