summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorPatrick Schaumburg <pschaumburg@tecracer.de>2020-03-30 13:15:58 +0200
committerPatrick Schaumburg <pschaumburg@tecracer.de>2020-03-30 13:15:58 +0200
commit4c09b31540a62320c896b65d716cc00937cb774a (patch)
tree3b076be119e163c7a51b78e78a5c72332c446b61 /spec/unit
parentdbe1f2831b51fc9ea0535093121af05772ac6df3 (diff)
downloadchef-4c09b31540a62320c896b65d716cc00937cb774a.tar.gz
redo unit checks for is_set_properly?
Signed-off-by: Patrick Schaumburg <pschaumburg@tecracer.de>
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/resource/windows_firewall_rule_spec.rb85
1 files changed, 57 insertions, 28 deletions
diff --git a/spec/unit/resource/windows_firewall_rule_spec.rb b/spec/unit/resource/windows_firewall_rule_spec.rb
index 9620daa76c..c936a0ccd0 100644
--- a/spec/unit/resource/windows_firewall_rule_spec.rb
+++ b/spec/unit/resource/windows_firewall_rule_spec.rb
@@ -502,64 +502,93 @@ describe Chef::Resource::WindowsFirewallRule do
end
end
end
+
describe "#is_set_properly?" do
context "#TCP" do
- it "protocol is TCP and icmp_type is empty" do
- expect(Chef::Resource::WindowsFirewallRule.is_set_properly?("", "TCP")).to be false
+ it "icmp_type is empty" do
+ resource.icmp_type("")
+ resource.protocol("TCP")
+ expect(provider.is_set_properly?).to eql(false)
end
- it "protocol is TCP and icmp_type is 'Any'" do
- expect(Chef::Resource::WindowsFirewallRule.is_set_properly?("Any", "TCP")).to be true
+ it "icmp_type is 'Any'" do
+ resource.icmp_type("Any")
+ resource.protocol("TCP")
+ expect(provider.is_set_properly?).to eql(true)
end
- it "protocol is TCP and icmp_type is 123 as String" do
- expect(Chef::Resource::WindowsFirewallRule.is_set_properly?("123", "TCP")).to be false
+ it "icmp_type is 123 as String" do
+ resource.icmp_type("123")
+ resource.protocol("TCP")
+ expect(provider.is_set_properly?).to eql(false)
end
- it "protocol is TCP and icmp_type is 123 as Integer" do
- expect(Chef::Resource::WindowsFirewallRule.is_set_properly?(123, "TCP")).to be false
+ it "icmp_type is 123 as Integer" do
+ resource.icmp_type(123)
+ resource.protocol("TCP")
+ expect(provider.is_set_properly?).to eql(false)
end
- it "protocol is TCP and icmp_type is '1:3' as code pair" do
- expect(Chef::Resource::WindowsFirewallRule.is_set_properly?("1:3", "TCP")).to be false
+ it "icmp_type is '1:3' as code pair" do
+ resource.icmp_type("1:3")
+ resource.protocol("TCP")
+ expect(provider.is_set_properly?).to eql(false)
end
- it "protocol is TCP and icmp_type is '123:456' as code pair out of range" do
- expect(Chef::Resource::WindowsFirewallRule.is_set_properly?("123:456", "TCP")).to be false
+ it "icmp_type is '123:456' as code pair out of range" do
+ resource.icmp_type("123:456")
+ resource.protocol("TCP")
+ expect(provider.is_set_properly?).to eql(false)
end
- it "protocol is TCP and icmp_type is nil" do
- expect(Chef::Resource::WindowsFirewallRule.is_set_properly?(nil, "TCP")).to be false
+ it "icmp_type is nil" do
+ resource.icmp_type(nil)
+ resource.protocol("TCP")
+ expect(provider.is_set_properly?).to eql(false)
end
end
context "#ICMPv6" do
- it "protocol is ICMPv6 and icmp_type is empty" do
- expect(Chef::Resource::WindowsFirewallRule.is_set_properly?("", "ICMPv6")).to be false
+ it "icmp_type is empty" do
+ resource.icmp_type("")
+ resource.protocol("ICMPv6")
+ expect(provider.is_set_properly?).to eql(false)
end
- it "protocol is ICMPv6 and icmp_type is 'Any'" do
- expect(Chef::Resource::WindowsFirewallRule.is_set_properly?("Any", "ICMPv6")).to be true
+ it "icmp_type is 'Any'" do
+ resource.icmp_type("Any")
+ resource.protocol("ICMPv6")
+ expect(provider.is_set_properly?).to eql(true)
end
- it "protocol is ICMPv6 and icmp_type is 123 as String" do
- expect(Chef::Resource::WindowsFirewallRule.is_set_properly?("123", "ICMPv6")).to be true
+ it "icmp_type is 123 as String" do
+ resource.icmp_type("123")
+ resource.protocol("ICMPv6")
+ expect(provider.is_set_properly?).to eql(true)
end
- it "protocol is ICMPv6 and icmp_type is 123 as Integer" do
- expect(Chef::Resource::WindowsFirewallRule.is_set_properly?(123, "ICMPv6")).to be true
+ it "icmp_type is 123 as Integer" do
+ resource.icmp_type(123)
+ resource.protocol("ICMPv6")
+ expect(provider.is_set_properly?).to eql(true)
end
- it "protocol is ICMPv6 and icmp_type is '1:3' as code pair" do
- expect(Chef::Resource::WindowsFirewallRule.is_set_properly?("1:3", "ICMPv6")).to be true
+ it "icmp_type is '1:3' as code pair" do
+ resource.icmp_type("1:3")
+ resource.protocol("ICMPv6")
+ expect(provider.is_set_properly?).to eql(true)
end
- it "protocol is ICMPv6 and icmp_type is '123:456' as code pair out of range" do
- expect(Chef::Resource::WindowsFirewallRule.is_set_properly?("123:456", "ICMPv6")).to be false
+ it "icmp_type is '123:456' as code pair out of range" do
+ resource.icmp_type("123:456")
+ resource.protocol("ICMPv6")
+ expect(provider.is_set_properly?).to eql(false)
end
- it "protocol is ICMPv6 and icmp_type is nil" do
- expect(Chef::Resource::WindowsFirewallRule.is_set_properly?(nil, "ICMPv6")).to be false
+ it "icmp_type is nil" do
+ resource.icmp_type(nil)
+ resource.protocol("ICMPv6")
+ expect(provider.is_set_properly?).to eql(false)
end
end
end