tests: Disable tests that require being non-root

Set the environment variable USER=root which is required by
brew tests --only=utils/user

Fix these tests:
rspec ./test/diagnostic_checks_spec.rb:26 # Homebrew::Diagnostic::Checks #check_access_directories
rspec ./test/pathname_spec.rb:120 # Pathname#ensure_writable makes a file writable and restores permissions
rspec ./test/utils/user_spec.rb:22 # User#gui? when the current user is in a console session gui? should equal true
rspec ./test/utils/user_spec.rb:6 # User should eq nil
This commit is contained in:
Shaun Jackman 2019-02-16 12:16:02 -08:00
parent f3716fe2d8
commit 3bcffeae15
3 changed files with 3 additions and 1 deletions

View File

@ -1,3 +1,3 @@
sut: sut:
build: . build: .
command: brew test-bot command: env USER=root brew test-bot

View File

@ -24,6 +24,7 @@ describe Homebrew::Diagnostic::Checks do
end end
specify "#check_access_directories" do specify "#check_access_directories" do
skip "User is root so everything is writable." if Process.euid.zero?
begin begin
dirs = [ dirs = [
HOMEBREW_CACHE, HOMEBREW_CACHE,

View File

@ -118,6 +118,7 @@ describe Pathname do
describe "#ensure_writable" do describe "#ensure_writable" do
it "makes a file writable and restores permissions afterwards" do it "makes a file writable and restores permissions afterwards" do
skip "User is root so everything is writable." if Process.euid.zero?
touch file touch file
chmod 0555, file chmod 0555, file
expect(file).not_to be_writable expect(file).not_to be_writable