summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2014-10-13 05:36:41 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2014-10-13 05:36:41 -0700
commit0570d5ca7f040ba1d6a677f5094616364dc1582f (patch)
treea5506026d687e4e78d12dfd8916eff63dd9a42b3 /spec
parent0cbe1b778df3b6e10b7e7552d3b0699c843465ce (diff)
parentc28d33e22c7de34217012f11cf17080810b3542d (diff)
downloadchef-0570d5ca7f040ba1d6a677f5094616364dc1582f.tar.gz
Merge pull request #2208 from opscode/jdmundrawala/env-path-spec-fix
restore ENV['PATH'] in env_spec after test is complete
Diffstat (limited to 'spec')
-rwxr-xr-xspec/functional/resource/env_spec.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/spec/functional/resource/env_spec.rb b/spec/functional/resource/env_spec.rb
index 24fe5e1dff..cf77fef703 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)
@@ -142,9 +143,7 @@ describe Chef::Resource::Env, :windows_only do
test_resource.key_name('PATH')
test_resource.value(path_before)
test_resource.run_action(:create)
- 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