diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-02-28 14:05:40 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2017-02-28 14:05:40 -0800 |
commit | 60e84d96d8fbe63e71eb497d9da0d931dc594ed4 (patch) | |
tree | f5d7dbfb906185898de9294d18fafb41a64b5800 | |
parent | 442f03a3aa00c189779f4aec2f73879db9bf702c (diff) | |
download | chef-60e84d96d8fbe63e71eb497d9da0d931dc594ed4.tar.gz |
fix powershell_script tests for mandatory code blocks
yet another lesson that doing too much in the initializer is
poor coding practice.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | spec/unit/provider/powershell_script_spec.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/unit/provider/powershell_script_spec.rb b/spec/unit/provider/powershell_script_spec.rb index 4fd3f3534d..d7a1620530 100644 --- a/spec/unit/provider/powershell_script_spec.rb +++ b/spec/unit/provider/powershell_script_spec.rb @@ -1,6 +1,6 @@ # # Author:: Adam Edwards (<adamed@chef.io>) -# Copyright:: Copyright 2013-2016, Chef Software Inc. +# Copyright:: Copyright 2013-2017, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,10 +30,20 @@ describe Chef::Provider::PowershellScript, "action_run" do node end - let(:provider) do - empty_events = Chef::EventDispatch::Dispatcher.new - run_context = Chef::RunContext.new(node, {}, empty_events) + # code block is mandatory for the powershell provider + let(:code) { "" } + + let(:events) { Chef::EventDispatch::Dispatcher.new } + + let(:run_context) { run_context = Chef::RunContext.new(node, {}, events) } + + let(:new_resource) do new_resource = Chef::Resource::PowershellScript.new("run some powershell code", run_context) + new_resource.code code + new_resource + end + + let(:provider) do Chef::Provider::PowershellScript.new(new_resource, run_context) end |