summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Vagrantfile3
-rw-r--r--test/test-lib.bash16
-rwxr-xr-xtest/test_travis2
-rw-r--r--test/tests/plugin-dir.bash2
-rw-r--r--test/tests/plugin.bash2
-rw-r--r--test/tests/shim.bash29
6 files changed, 38 insertions, 16 deletions
diff --git a/test/Vagrantfile b/test/Vagrantfile
index 8ce1739..05d6747 100644
--- a/test/Vagrantfile
+++ b/test/Vagrantfile
@@ -2,8 +2,7 @@ Vagrant.configure(2) do |config|
config.vm.box = 'debian/stretch64'
# sync by copying for isolation
- config.vm.synced_folder "..", "/dotbot", type: "rsync",
- rsync__exclude: ".git/"
+ config.vm.synced_folder "..", "/dotbot", type: "rsync"
# disable default synced folder
config.vm.synced_folder ".", "/vagrant", disabled: true
diff --git a/test/test-lib.bash b/test/test-lib.bash
index 008c2f8..7b5e9ca 100644
--- a/test/test-lib.bash
+++ b/test/test-lib.bash
@@ -1,10 +1,6 @@
DEBUG=${DEBUG:-false}
USE_VAGRANT=${USE_VAGRANT:-true}
-if ${USE_VAGRANT}; then
- DOTBOT_EXEC=${DOTBOT_EXEC:-"python /dotbot/bin/dotbot"}
-else
- DOTBOT_EXEC=${DOTBOT_EXEC:-"/dotbot/bin/dotbot"}
-fi
+DOTBOT_EXEC=${DOTBOT_EXEC:-"python /dotbot/bin/dotbot"}
DOTFILES="/home/$(whoami)/dotfiles"
INSTALL_CONF='install.conf.yaml'
INSTALL_CONF_JSON='install.conf.json'
@@ -51,17 +47,15 @@ initialize() {
run_dotbot() {
(
- cd "${DOTFILES}"
- cat > "${INSTALL_CONF}"
- ${DOTBOT_EXEC} -d . -c "${INSTALL_CONF}" "${@}"
+ cat > "${DOTFILES}/${INSTALL_CONF}"
+ ${DOTBOT_EXEC} -d "${DOTFILES}" -c "${DOTFILES}/${INSTALL_CONF}" "${@}"
)
}
run_dotbot_json() {
(
- cd "${DOTFILES}"
- cat > "${INSTALL_CONF_JSON}"
- ${DOTBOT_EXEC} -d . -c "${INSTALL_CONF_JSON}" "${@}"
+ cat > "${DOTFILES}/${INSTALL_CONF_JSON}"
+ ${DOTBOT_EXEC} -d "${DOTFILES}" -c "${DOTFILES}/${INSTALL_CONF_JSON}" "${@}"
)
}
diff --git a/test/test_travis b/test/test_travis
index 20ec1ae..79439e1 100755
--- a/test/test_travis
+++ b/test/test_travis
@@ -6,7 +6,7 @@ set -e
# set -x
# set -v
-BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+export BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# Prevent execution outside of Travis CI builds
if [[ "${TRAVIS}" != true || "${CI}" != true ]]; then
diff --git a/test/tests/plugin-dir.bash b/test/tests/plugin-dir.bash
index 299f144..f3a5e94 100644
--- a/test/tests/plugin-dir.bash
+++ b/test/tests/plugin-dir.bash
@@ -19,7 +19,7 @@ EOF
'
test_expect_success 'run' '
-run_dotbot --plugin-dir plugins <<EOF
+run_dotbot --plugin-dir ${DOTFILES}/plugins <<EOF
- test: ~
EOF
'
diff --git a/test/tests/plugin.bash b/test/tests/plugin.bash
index 960e9ce..bdf0c7f 100644
--- a/test/tests/plugin.bash
+++ b/test/tests/plugin.bash
@@ -18,7 +18,7 @@ EOF
'
test_expect_success 'run' '
-run_dotbot --plugin test.py <<EOF
+run_dotbot --plugin ${DOTFILES}/test.py <<EOF
- test: ~
EOF
'
diff --git a/test/tests/shim.bash b/test/tests/shim.bash
new file mode 100644
index 0000000..2ed7d54
--- /dev/null
+++ b/test/tests/shim.bash
@@ -0,0 +1,29 @@
+test_description='install shim works'
+. '../test-lib.bash'
+
+test_expect_success 'setup' '
+cd ${DOTFILES}
+git init
+if ${USE_VAGRANT}; then
+ git submodule add /dotbot dotbot
+else
+ git submodule add ${BASEDIR} dotbot
+fi
+cp ./dotbot/tools/git-submodule/install .
+echo "pear" > ${DOTFILES}/foo
+'
+
+test_expect_success 'run' '
+cat > ${DOTFILES}/install.conf.yaml <<EOF
+- link:
+ ~/.foo: foo
+EOF
+if ! ${USE_VAGRANT}; then
+ sed -i "" "1 s/sh$/python/" ${DOTFILES}/dotbot/bin/dotbot
+fi
+${DOTFILES}/install
+'
+
+test_expect_success 'test' '
+grep "pear" ~/.foo
+'