Add test for detecting shell when rbenv init is called from script

References #730
This commit is contained in:
Mislav Marohnić 2015-12-24 12:29:35 +01:00
parent 2c7960102c
commit f9d8b551dc

View file

@ -25,12 +25,24 @@ load test_helper
}
@test "detect parent shell" {
root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
SHELL=/bin/false run rbenv-init -
assert_success
assert_line "export RBENV_SHELL=bash"
}
@test "detect parent shell from script" {
mkdir -p "$RBENV_TEST_DIR"
cd "$RBENV_TEST_DIR"
cat > myscript.sh <<OUT
#!/bin/sh
eval "\$(rbenv-init -)"
echo \$RBENV_SHELL
OUT
chmod +x myscript.sh
run ./myscript.sh /bin/zsh
assert_success "sh"
}
@test "setup shell completions (fish)" {
root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
run rbenv-init - fish