2018-03-04 15:09:32 +00:00
|
|
|
require_relative '../../spec_helper'
|
2017-05-07 12:04:49 +00:00
|
|
|
|
|
|
|
describe "ENV.clear" do
|
|
|
|
it "deletes all environment variables" do
|
|
|
|
orig = ENV.to_hash
|
|
|
|
begin
|
2019-10-26 20:53:01 +02:00
|
|
|
ENV.clear.should equal(ENV)
|
2017-05-07 12:04:49 +00:00
|
|
|
|
|
|
|
# This used 'env' the helper before. That shells out to 'env' which
|
|
|
|
# itself sets up certain environment variables before it runs, because
|
|
|
|
# the shell sets them up before it runs any command.
|
|
|
|
#
|
|
|
|
# Thusly, you can ONLY test this by asking through ENV itself.
|
|
|
|
ENV.size.should == 0
|
|
|
|
ensure
|
|
|
|
ENV.replace orig
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|