summaryrefslogtreecommitdiff
path: root/spec/unit/platform
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2014-09-04 12:05:25 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2014-09-19 12:48:08 -0700
commite473325de679718ab0695d4d3177eeeef20dc994 (patch)
tree87450c0f1e85094ab75cdcf354072202ade9ee52 /spec/unit/platform
parentce46528db4c9a7f06a34d16ee37017a59e8aab73 (diff)
downloadchef-e473325de679718ab0695d4d3177eeeef20dc994.tar.gz
DscScript resource will raise an error if dsc is not available
Diffstat (limited to 'spec/unit/platform')
-rw-r--r--spec/unit/platform/query_helpers_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/unit/platform/query_helpers_spec.rb b/spec/unit/platform/query_helpers_spec.rb
index 2414bdf552..6adea5eecf 100644
--- a/spec/unit/platform/query_helpers_spec.rb
+++ b/spec/unit/platform/query_helpers_spec.rb
@@ -30,3 +30,26 @@ describe "Chef::Platform#windows_server_2003?" do
expect { Thread.fork { Chef::Platform.windows_server_2003? }.join }.not_to raise_error
end
end
+
+describe 'Chef::Platform#supports_dsc?' do
+ it 'returns false if powershell is not present' do
+ node = Chef::Node.new
+ Chef::Platform.supports_dsc?(node).should be_false
+ end
+
+ ['1.0', '2.0', '3.0'].each do |version|
+ it "returns false for Powershell #{version}" do
+ node = Chef::Node.new
+ node.automatic[:languages][:powershell][:version] = version
+ Chef::Platform.supports_dsc?(node).should be_false
+ end
+ end
+
+ ['4.0', '5.0'].each do |version|
+ it "returns true for Powershell #{version}" do
+ node = Chef::Node.new
+ node.automatic[:languages][:powershell][:version] = version
+ Chef::Platform.supports_dsc?(node).should be_true
+ end
+ end
+end