diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-10-10 09:02:27 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-10-10 14:53:05 -0700 |
commit | 709c985dd9e637d79df75b0369f86e43ef184e5b (patch) | |
tree | 86ded5eb03416cf2259118c95be3be008dd75cfc | |
parent | 07b7c3aafd0a29b121e5bcc9717b609acd8ae50f (diff) | |
download | chef-709c985dd9e637d79df75b0369f86e43ef184e5b.tar.gz |
restore ENV['PATH'] in env_spec after test is complete
-rwxr-xr-x | spec/functional/resource/env_spec.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/spec/functional/resource/env_spec.rb b/spec/functional/resource/env_spec.rb index 24fe5e1dff..e0a72b2030 100755 --- a/spec/functional/resource/env_spec.rb +++ b/spec/functional/resource/env_spec.rb @@ -126,7 +126,8 @@ describe Chef::Resource::Env, :windows_only do context 'when using PATH' do let(:random_name) { Time.now.to_i } let(:env_val) { "#{env_value_expandable}_#{random_name}"} - let(:path_before) { test_resource.provider_for_action(test_resource.action).env_value('PATH') } + let!(:path_before) { test_resource.provider_for_action(test_resource.action).env_value('PATH') } + let!(:env_path_before) { ENV['PATH'] } it 'should expand PATH' do path_before.should_not include(env_val) @@ -145,6 +146,7 @@ describe Chef::Resource::Env, :windows_only do if test_resource.provider_for_action(test_resource.action).env_value('PATH') != path_before raise 'Failed to cleanup after ourselves' end + ENV['PATH'] = env_path_before end end |