summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-03-14 18:47:22 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2015-03-20 14:38:06 -0700
commit302c5f1f928a40267e26bf93a7248aae75dfe2d6 (patch)
treee44438862ed4715f4caadd514502416a1bbf856c
parent2e4f13f04f9bc25fc0646e9f3ad6c07f93f0f26f (diff)
downloadchef-302c5f1f928a40267e26bf93a7248aae75dfe2d6.tar.gz
spec for when Invoke-DscResource is available and RefreshMode=Disabled
-rw-r--r--spec/unit/provider/dsc_resource_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/unit/provider/dsc_resource_spec.rb b/spec/unit/provider/dsc_resource_spec.rb
index 34705673b9..39404b97fa 100644
--- a/spec/unit/provider/dsc_resource_spec.rb
+++ b/spec/unit/provider/dsc_resource_spec.rb
@@ -41,4 +41,32 @@ describe Chef::Provider::DscResource do
Chef::Exceptions::NoProviderAvailable, /5\.0\.10018\.0/)
end
end
+
+ context 'when Powershell supports Invoke-DscResource' do
+ let (:node) {
+ node = Chef::Node.new
+ node.automatic[:languages][:powershell][:version] = '5.0.10018.0'
+ node
+ }
+ context 'when RefreshMode is set to Disabled' do
+ let (:meta_configuration) { {'RefreshMode' => 'Disabled'}}
+
+ it 'does not update the resource if it is up to date' do
+ expect(provider).to receive(:meta_configuration).and_return(
+ meta_configuration)
+ expect(provider).to receive(:test_resource).and_return(true)
+ provider.run_action(:run)
+ expect(resource).not_to be_updated
+ end
+
+ it 'converges the resource if it is not up to date' do
+ expect(provider).to receive(:meta_configuration).and_return(
+ meta_configuration)
+ expect(provider).to receive(:test_resource).and_return(false)
+ expect(provider).to receive(:set_resource)
+ provider.run_action(:run)
+ expect(resource).to be_updated
+ end
+ end
+ end
end