tests: Set environment variable USER if not set

These two tests fail if the enivornment variable USER is not set:

./test/utils/user_spec.rb:6 # User should eq nil
./test/utils/user_spec.rb:22 # User#gui? when the current user is in a
console session gui? should equal true
This commit is contained in:
Shaun Jackman 2019-02-20 09:33:00 -08:00
parent 4d68bee1be
commit cb0fe44af3

View File

@ -49,6 +49,8 @@ module Homebrew
ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if args.generic?
ENV["HOMEBREW_TEST_ONLINE"] = "1" if args.online?
ENV["USER"] ||= Utils.popen_read("id", "-nu").chomp
# Avoid local configuration messing with tests e.g. git being configured
# to use GPG to sign by default
ENV["HOME"] = "#{HOMEBREW_LIBRARY_PATH}/test"