diff options
author | dheerajd-msys <dheeraj.dubey@msystechnologies.com> | 2020-07-31 09:25:28 +0530 |
---|---|---|
committer | dheerajd-msys <dheeraj.dubey@msystechnologies.com> | 2020-07-31 12:27:09 +0530 |
commit | 183b65ae8b77ee8189b2aa147ca651620c4c8297 (patch) | |
tree | 3ddaa5f2ca02641c95d925e1eff6765fc37301d9 | |
parent | 29e73bcc8b38cf587a72a6c24f30b60eb686ad87 (diff) | |
download | chef-183b65ae8b77ee8189b2aa147ca651620c4c8297.tar.gz |
additional tests
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 aa568c7093..5b4062f34c 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) @@ -60,4 +61,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 |