summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Magnus Rakvåg <tor.magnus@outlook.com>2019-10-07 19:37:02 +0200
committerTor Magnus Rakvåg <tor.magnus@outlook.com>2019-10-07 19:37:02 +0200
commit7a9fe3dcea22b74dbcd69ad7293d8743e5e47919 (patch)
treed09d35bca3af8bcf7669943f2144ff452d002823
parent2f6c1141bba783b1d5ceb1a29397f28c0a7a02c4 (diff)
downloadchef-7a9fe3dcea22b74dbcd69ad7293d8743e5e47919.tar.gz
fix chefstyle errors
Signed-off-by: Tor Magnus Rakvåg <tor.magnus@outlook.com>
-rw-r--r--lib/chef/resource/windows_firewall_rule.rb4
-rw-r--r--spec/unit/resource/windows_firewall_rule_spec.rb20
2 files changed, 12 insertions, 12 deletions
diff --git a/lib/chef/resource/windows_firewall_rule.rb b/lib/chef/resource/windows_firewall_rule.rb
index 0dbf9ec6b0..b09c5a5fcd 100644
--- a/lib/chef/resource/windows_firewall_rule.rb
+++ b/lib/chef/resource/windows_firewall_rule.rb
@@ -72,8 +72,8 @@ class Chef
description: "The profile the firewall rule applies to.",
coerce: proc { |p| Array(p).map(&:downcase).map(&:to_sym).sort },
callbacks: {
- 'contains values not in :public, :private :domain, :any or :notapplicable' => lambda {
- |p| p.all? { |e| %i{public private domain any notapplicable}.include?(e) }
+ "contains values not in :public, :private :domain, :any or :notapplicable" => lambda { |p|
+ p.all? { |e| %i{public private domain any notapplicable}.include?(e) }
}
}
diff --git a/spec/unit/resource/windows_firewall_rule_spec.rb b/spec/unit/resource/windows_firewall_rule_spec.rb
index d8d88941c4..bd2e6793c2 100644
--- a/spec/unit/resource/windows_firewall_rule_spec.rb
+++ b/spec/unit/resource/windows_firewall_rule_spec.rb
@@ -154,19 +154,19 @@ describe Chef::Resource::WindowsFirewallRule do
it "the profile property raises on any unknown values" do
expect { resource.profile(:other) }.to raise_error(Chef::Exceptions::ValidationFailed)
- expect { resource.profile([:public, :other]) }.to raise_error(Chef::Exceptions::ValidationFailed)
+ expect { resource.profile(%i{public other}) }.to raise_error(Chef::Exceptions::ValidationFailed)
end
it "the profile property coerces strings to symbols" do
resource.profile("Public")
expect(resource.profile).to eql([:public])
resource.profile([:private, "Public"])
- expect(resource.profile).to eql([:private, :public])
+ expect(resource.profile).to eql(%i{private public})
end
it "the profile property supports multiple profiles" do
- resource.profile(["Private", "Public"])
- expect(resource.profile).to eql([:private, :public])
+ resource.profile(%w{Private Public})
+ expect(resource.profile).to eql(%i{private public})
end
it "the program property accepts strings" do
@@ -258,7 +258,7 @@ describe Chef::Resource::WindowsFirewallRule do
end
it "sets multiple LocalPorts" do
- resource.local_port(["80", "RPC"])
+ resource.local_port(%w{80 RPC})
expect(provider.firewall_command("New")).to eql("New-NetFirewallRule -Name 'test_rule' -DisplayName 'test_rule' -Description 'Firewall rule' -LocalPort '80', 'RPC' -Direction 'inbound' -Protocol 'TCP' -Action 'allow' -Profile 'any' -InterfaceType 'any' -Enabled 'true'")
end
@@ -278,7 +278,7 @@ describe Chef::Resource::WindowsFirewallRule do
end
it "sets multiple RemotePorts" do
- resource.remote_port(["443", "445"])
+ resource.remote_port(%w{443 445})
expect(provider.firewall_command("New")).to eql("New-NetFirewallRule -Name 'test_rule' -DisplayName 'test_rule' -Description 'Firewall rule' -RemotePort '443', '445' -Direction 'inbound' -Protocol 'TCP' -Action 'allow' -Profile 'any' -InterfaceType 'any' -Enabled 'true'")
end
@@ -301,9 +301,9 @@ describe Chef::Resource::WindowsFirewallRule do
resource.profile(:private)
expect(provider.firewall_command("New")).to eql("New-NetFirewallRule -Name 'test_rule' -DisplayName 'test_rule' -Description 'Firewall rule' -Direction 'inbound' -Protocol 'TCP' -Action 'allow' -Profile 'private' -InterfaceType 'any' -Enabled 'true'")
end
-
+
it "sets multiple Profiles" do
- resource.profile([:private, :public])
+ resource.profile(%i{private public})
expect(provider.firewall_command("New")).to eql("New-NetFirewallRule -Name 'test_rule' -DisplayName 'test_rule' -Description 'Firewall rule' -Direction 'inbound' -Protocol 'TCP' -Action 'allow' -Profile 'private', 'public' -InterfaceType 'any' -Enabled 'true'")
end
@@ -372,7 +372,7 @@ describe Chef::Resource::WindowsFirewallRule do
end
it "sets multiple LocalPorts" do
- resource.local_port(["80", "8080"])
+ resource.local_port(%w{80 8080})
expect(provider.firewall_command("Set")).to eql("Set-NetFirewallRule -Name 'test_rule' -Description 'Firewall rule' -LocalPort '80', '8080' -Direction 'inbound' -Protocol 'TCP' -Action 'allow' -Profile 'any' -InterfaceType 'any' -Enabled 'true'")
end
@@ -392,7 +392,7 @@ describe Chef::Resource::WindowsFirewallRule do
end
it "sets multiple RemotePorts" do
- resource.remote_port(["443", "445"])
+ resource.remote_port(%w{443 445})
expect(provider.firewall_command("Set")).to eql("Set-NetFirewallRule -Name 'test_rule' -Description 'Firewall rule' -RemotePort '443', '445' -Direction 'inbound' -Protocol 'TCP' -Action 'allow' -Profile 'any' -InterfaceType 'any' -Enabled 'true'")
end