diff options
author | dheerajd-msys <dheeraj.dubey@msystechnologies.com> | 2020-07-31 09:25:28 +0530 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-08-17 21:44:34 -0700 |
commit | b464890d6a717c488c3f7ad83e0ff06034278627 (patch) | |
tree | a5b77645e480b4ad099b204712bd07e326ff13de | |
parent | 57caa54495f6194cfea6a3e29b6cca5bcda6edcd (diff) | |
download | chef-b464890d6a717c488c3f7ad83e0ff06034278627.tar.gz |
additional testswin_feature
Signed-off-by: dheerajd-msys <dheeraj.dubey@msystechnologies.com>
-rw-r--r-- | spec/unit/resource/windows_feature_powershell_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/unit/resource/windows_feature_powershell_spec.rb b/spec/unit/resource/windows_feature_powershell_spec.rb index fbe9be3bf0..ef2da38334 100644 --- a/spec/unit/resource/windows_feature_powershell_spec.rb +++ b/spec/unit/resource/windows_feature_powershell_spec.rb @@ -22,6 +22,7 @@ describe Chef::Resource::WindowsFeaturePowershell do let(:events) { Chef::EventDispatch::Dispatcher.new } let(:run_context) { Chef::RunContext.new(node, {}, events) } let(:resource) { Chef::Resource::WindowsFeaturePowershell.new(%w{SNMP DHCP}, run_context) } + let(:provider) { resource.provider_for_action(:install) } it "sets resource name as :windows_feature_powershell" do expect(resource.resource_name).to eql(:windows_feature_powershell) @@ -75,4 +76,23 @@ describe Chef::Resource::WindowsFeaturePowershell do resource.feature_name "SNMP, DHCP" expect { resource.action :install }.not_to raise_error end + + it "does not attempt to install features that have been removed" do + node.default["powershell_features_cache"] ||= {} + node.default["powershell_features_cache"]["disabled"] = ["dhcp"] + node.default["powershell_features_cache"]["removed"] = ["snmp"] + resource.feature_name "dhcp, snmp" + + expect(provider.features_to_install).to eq(["dhcp"]) + end + + it "attempts to install features that have been removed when source is set" do + node.default["powershell_features_cache"] ||= {} + node.default["powershell_features_cache"]["disabled"] = ["dhcp"] + node.default["powershell_features_cache"]["removed"] = ["snmp"] + resource.feature_name "dhcp, snmp" + resource.source 'D:\\sources\\sxs' + + expect(provider.features_to_install).to eq(%w{dhcp snmp}) + end end |