41 lines
941 B
Bash
41 lines
941 B
Bash
#!/usr/bin/env bash
|
|
|
|
setup() {
|
|
DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )"
|
|
source "$DIR/helpers.sh"
|
|
_setup_env
|
|
|
|
if [[ -f "$HOME/.local/bin/abra" ]]; then
|
|
mv "$HOME/.local/bin/abra" "$HOME/.local/bin/abra_before_test"
|
|
fi
|
|
}
|
|
|
|
@test "abra upgrade" {
|
|
run $ABRA upgrade
|
|
assert_success
|
|
assert_output --partial 'Public interest infrastructure'
|
|
|
|
assert [ -f "$HOME/.local/bin/abra" ]
|
|
run $HOME/.local/bin/abra -v
|
|
assert_output --partial 'beta'
|
|
}
|
|
|
|
@test "abra upgrade release candidate" {
|
|
run $ABRA upgrade --rc
|
|
assert_success
|
|
assert_output --partial 'Public interest infrastructure'
|
|
|
|
assert [ -f "$HOME/.local/bin/abra" ]
|
|
run $HOME/.local/bin/abra -v
|
|
assert_output --partial '-rc'
|
|
}
|
|
|
|
teardown(){
|
|
_default_teardown
|
|
|
|
if [[ -f "$HOME/.local/bin/abra_before_test" ]]; then
|
|
rm -rf "$HOME/.local/bin/abra"
|
|
mv "$HOME/.local/bin/abra_before_test" "$HOME/.local/bin/abra"
|
|
fi
|
|
}
|