From 518148383ecebe2536bf9db7c316c4e646cb5f8a Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Tue, 31 Jul 2018 00:48:12 +0200 Subject: [PATCH] Fix Test for context segment This fixes an error on travis, because there is no sudo allowed. We could allow it, but I think it is better to mock sudo anyway. --- test/segments/context.spec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/segments/context.spec b/test/segments/context.spec index b350caf7..2cef90dd 100755 --- a/test/segments/context.spec +++ b/test/segments/context.spec @@ -31,6 +31,9 @@ function testContextSegmentDoesNotGetRenderedWithDefaultUser() { } function testContextSegmentDoesGetRenderedWhenSshConnectionIsOpen() { + function sudo() { + return 0 + } local SSH_CLIENT="putty" local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) @@ -39,6 +42,8 @@ function testContextSegmentDoesGetRenderedWhenSshConnectionIsOpen() { source powerlevel9k.zsh-theme assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)" + + unfunction sudo } function testContextSegmentWithForeignUser() {