summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-06-26 21:19:20 -0700
committerTim Smith <tsmith@chef.io>2018-06-26 22:36:02 -0700
commitc36147dea6c1147da2c8159cfe3c4d034572eab9 (patch)
tree97c9862c0d1e8ee288149edf0437ed9e6f3fbdcf /spec/unit
parent21a1a909ffe0819c884c58da7298b49df9099f70 (diff)
downloadchef-c36147dea6c1147da2c8159cfe3c4d034572eab9.tar.gz
Use ALLUSERSPROFILE ENV variable vs. hardcoding the path
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/resource/chocolatey_config_spec.rb11
-rw-r--r--spec/unit/resource/chocolatey_source_spec.rb11
2 files changed, 22 insertions, 0 deletions
diff --git a/spec/unit/resource/chocolatey_config_spec.rb b/spec/unit/resource/chocolatey_config_spec.rb
index 5f4d9c78de..e92280307b 100644
--- a/spec/unit/resource/chocolatey_config_spec.rb
+++ b/spec/unit/resource/chocolatey_config_spec.rb
@@ -38,6 +38,17 @@ describe Chef::Resource::ChocolateyConfig do
CONFIG
end
+ # we save off the ENV and set ALLUSERSPROFILE so these specs will work on *nix and non-C drive Windows installs
+ before(:each) do
+ @original_env = ENV.to_hash
+ ENV['ALLUSERSPROFILE'] = 'C:\ProgramData'
+ end
+
+ after(:each) do
+ ENV.clear
+ ENV.update(@original_env)
+ end
+
it "has a resource name of :chocolatey_config" do
expect(resource.resource_name).to eql(:chocolatey_config)
end
diff --git a/spec/unit/resource/chocolatey_source_spec.rb b/spec/unit/resource/chocolatey_source_spec.rb
index ee8d098b0b..ee179f931b 100644
--- a/spec/unit/resource/chocolatey_source_spec.rb
+++ b/spec/unit/resource/chocolatey_source_spec.rb
@@ -38,6 +38,17 @@ describe Chef::Resource::ChocolateySource do
CONFIG
end
+ # we save off the ENV and set ALLUSERSPROFILE so these specs will work on *nix and non-C drive Windows installs
+ before(:each) do
+ @original_env = ENV.to_hash
+ ENV['ALLUSERSPROFILE'] = 'C:\ProgramData'
+ end
+
+ after(:each) do
+ ENV.clear
+ ENV.update(@original_env)
+ end
+
it "has a resource name of :chocolatey_source" do
expect(resource.resource_name).to eql(:chocolatey_source)
end