abra/tests/integration/dirs.bats

54 lines
1.3 KiB
Bash

#!/usr/bin/env bash
setup(){
load "$PWD/tests/integration/helpers/common"
_common_setup
if [[ -d "$ABRA_DIR" ]]; then
rm -rf "$ABRA_DIR"
fi
}
@test "ABRA_DIR is overriden" {
ABRA_DIR="$HOME/.abra_foo"
run $ABRA app ls
# no servers yet, so will fail. however, it will run the required code which
# checks if it should create these base directories and that is what we want
assert_failure
assert_exists "$HOME/.abra_foo"
run rm -rf "$ABRA_DIR"
assert_success
}
@test "abra directory is created" {
run $ABRA app ls
# no servers yet, so will fail. however, it will run the required code which
# checks if it should create these base directories and that is what we want
assert_failure
assert_exists "$ABRA_DIR"
assert_exists "$ABRA_DIR/servers"
assert_exists "$ABRA_DIR/recipes"
assert_exists "$ABRA_DIR/backups"
assert_exists "$ABRA_DIR/vendor"
assert_exists "$ABRA_DIR/catalogue"
}
@test "catalogue recipe is a git repository" {
run $ABRA app ls
# no servers yet, so will fail. however, it will run the required code which
# checks if it should create these base directories and that is what we want
assert_failure
assert_output --partial 'local recipe catalogue is missing'
assert_exists "$ABRA_DIR/catalogue"
assert_exists "$ABRA_DIR/catalogue/.git"
}