summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2018-01-03 17:31:49 +0000
committerGitHub <noreply@github.com>2018-01-03 17:31:49 +0000
commit7bdb7a24519840b08b1086c68f3c5eed84f9a3e2 (patch)
tree9a71786703571ad91a118bccb8bc887a23747d69
parent5efb3f2ada9718b8c1f72cd6c4703b972491f6cd (diff)
parent49dfa83f72a46428365fbc7f2b46d091edfc839e (diff)
downloadchef-7bdb7a24519840b08b1086c68f3c5eed84f9a3e2.tar.gz
Merge pull request #6699 from chef/windows_path
Modernize windows_path resource
-rw-r--r--lib/chef/provider/windows_path.rb3
-rw-r--r--lib/chef/resource/windows_path.rb12
-rw-r--r--spec/unit/resource/windows_path_spec.rb2
3 files changed, 5 insertions, 12 deletions
diff --git a/lib/chef/provider/windows_path.rb b/lib/chef/provider/windows_path.rb
index e31ecaf2a0..1c78e20606 100644
--- a/lib/chef/provider/windows_path.rb
+++ b/lib/chef/provider/windows_path.rb
@@ -23,9 +23,10 @@ require "chef/exceptions"
class Chef
class Provider
class WindowsPath < Chef::Provider
-
include Chef::Mixin::WindowsEnvHelper if Chef::Platform.windows?
+ provides :windows_path
+
def load_current_resource
@current_resource = Chef::Resource::WindowsPath.new(new_resource.name)
@current_resource.path(new_resource.path)
diff --git a/lib/chef/resource/windows_path.rb b/lib/chef/resource/windows_path.rb
index 9274415755..7da24a3c06 100644
--- a/lib/chef/resource/windows_path.rb
+++ b/lib/chef/resource/windows_path.rb
@@ -24,20 +24,12 @@ class Chef
#
# @since 13.4
class WindowsPath < Chef::Resource
-
- provides :windows_path, os: "windows"
+ resource_name :windows_path
+ provides :windows_path
allowed_actions :add, :remove
default_action :add
- def initialize(name, run_context = nil)
- super
- @resource_name = :windows_path
- @path = name
- @provider = Chef::Provider::WindowsPath
- @action = :add
- end
-
property :path, String, name_property: true
end
end
diff --git a/spec/unit/resource/windows_path_spec.rb b/spec/unit/resource/windows_path_spec.rb
index bde39fec9e..8f29a11e4e 100644
--- a/spec/unit/resource/windows_path_spec.rb
+++ b/spec/unit/resource/windows_path_spec.rb
@@ -30,7 +30,7 @@ describe Chef::Resource::WindowsPath do
end
it "sets the default action as :add" do
- expect(resource.action).to eql(:add)
+ expect(resource.action).to eql([:add])
end
it "supports :add and :remove actions" do