diff --git a/tests/helpers/create_and_save_tmux_test_environment.exp b/tests/helpers/create_and_save_tmux_test_environment.exp index 19c7edf..feef033 100755 --- a/tests/helpers/create_and_save_tmux_test_environment.exp +++ b/tests/helpers/create_and_save_tmux_test_environment.exp @@ -34,8 +34,7 @@ new_tmux_window # session yellow new_tmux_session "yellow" -run_shell_command "mkdir bar" -run_shell_command "cd bar" +run_shell_command "cd /tmp/bar" start_resurrect_save diff --git a/tests/helpers/resurrect_helpers.sh b/tests/helpers/resurrect_helpers.sh index fba4642..e584085 100644 --- a/tests/helpers/resurrect_helpers.sh +++ b/tests/helpers/resurrect_helpers.sh @@ -1,8 +1,11 @@ install_tmux_resurrect_helper() { - rm -rf ~/.tmux/plugins/tmux-resurrect/ - cd "$CURRENT_DIR" - git clone --recursive ../ ~/.tmux/plugins/tmux-resurrect/ >/dev/null 2>&1 - cd - >/dev/null + local plugin_path="${HOME}/.tmux/plugins/tmux-resurrect/" + rm -rf "$plugin_path" + if [ -n "$TRAVIS" ]; then + git clone --recursive https://github.com/tmux-plugins/tmux-resurrect --branch "$TRAVIS_BRANCH" "$plugin_path" >/dev/null 2>&1 + else # used on vagrant + git clone --recursive "${CURRENT_DIR}/../" "$plugin_path" >/dev/null 2>&1 + fi } # we want "fixed" dimensions no matter the size of real display diff --git a/tests/test_resurrect_restore.sh b/tests/test_resurrect_restore.sh index 8a1dad2..f022e2e 100755 --- a/tests/test_resurrect_restore.sh +++ b/tests/test_resurrect_restore.sh @@ -5,10 +5,14 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source $CURRENT_DIR/helpers/helpers.sh source $CURRENT_DIR/helpers/resurrect_helpers.sh -setup_file_for_restore() { +setup_before_restore() { + # setup restore file mkdir -p ~/.tmux/resurrect/ cp tests/fixtures/restore_file.txt "${HOME}/.tmux/resurrect/restore_file.txt" ln -sf restore_file.txt "${HOME}/.tmux/resurrect/last" + + # directory used in restored tmux session + mkdir -p /tmp/bar } restore_tmux_environment_and_save_again() { @@ -21,7 +25,7 @@ restore_tmux_environment_and_save_again() { main() { install_tmux_resurrect_helper - setup_file_for_restore + setup_before_restore restore_tmux_environment_and_save_again if last_save_file_differs_helper "tests/fixtures/restore_file.txt"; then diff --git a/tests/test_resurrect_save.sh b/tests/test_resurrect_save.sh index dad344e..36297be 100755 --- a/tests/test_resurrect_save.sh +++ b/tests/test_resurrect_save.sh @@ -15,6 +15,7 @@ create_tmux_test_environment_and_save() { main() { install_tmux_resurrect_helper + mkdir -p /tmp/bar # setup required dirs create_tmux_test_environment_and_save if last_save_file_differs_helper "tests/fixtures/save_file.txt"; then