aboutsummaryrefslogtreecommitdiff
path: root/test/segments/kubecontext.spec
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2018-07-24 17:24:33 +0300
committerDominik Ritter <dritter03@googlemail.com>2018-07-24 17:24:33 +0300
commit4972f0b8eba711f0dafc46cdbb4e191d550da091 (patch)
treecac634f7706fc43973785ca467c2285423608d39 /test/segments/kubecontext.spec
parent822b820a6e0d7cec4ec60de23faecec6b77712b6 (diff)
Improve tests by making use of local variables
Diffstat (limited to 'test/segments/kubecontext.spec')
-rwxr-xr-xtest/segments/kubecontext.spec15
1 files changed, 7 insertions, 8 deletions
diff --git a/test/segments/kubecontext.spec b/test/segments/kubecontext.spec
index 63810378..46fe8724 100755
--- a/test/segments/kubecontext.spec
+++ b/test/segments/kubecontext.spec
@@ -66,32 +66,31 @@ function mockKubectlOtherNamespace() {
}
function testKubeContext() {
- alias kubectl=mockKubectl
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext)
+ alias kubectl=mockKubectl
assertEquals "%K{magenta} %F{white%}⎈ %f%F{white}minikube/default %k%F{magenta}%f " "$(build_left_prompt)"
- unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unalias kubectl
}
function testKubeContextOtherNamespace() {
- alias kubectl=mockKubectlOtherNamespace
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext)
+ alias kubectl=mockKubectlOtherNamespace
assertEquals "%K{magenta} %F{white%}⎈ %f%F{white}minikube/kube-system %k%F{magenta}%f " "$(build_left_prompt)"
- unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unalias kubectl
}
function testKubeContextPrintsNothingIfKubectlNotAvailable() {
- alias kubectl=noKubectl
- POWERLEVEL9K_CUSTOM_WORLD='echo world'
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world kubecontext)
+ local POWERLEVEL9K_CUSTOM_WORLD='echo world'
+ alias kubectl=noKubectl
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
- unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
- unset POWERLEVEL9K_CUSTOM_WORLD
unalias kubectl
}