Skip to content

Commit

Permalink
Add tests for NOTES_DIRECTORY configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Mar 18, 2018
1 parent aa0c1b7 commit 14e8f59
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/test-config.bats
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,21 @@ notes="./notes"
assert_success
assert_exists "$NOTES_DIRECTORY/test.txt"
}

@test "Configuration should be accepted if NOTES_DIR doesn't exist" {
mkdir -p $HOME/.config/notes
echo "NOTES_DIRECTORY=$NOTES_DIRECTORY/notesdir" > $HOME/.config/notes/config
run $notes new test

assert_success
}

@test "Configuration should be rejected if NOTES_DIR is a existing file" {
mkdir -p $HOME/.config/notes
touch $NOTES_DIRECTORY/testfile
echo "NOTES_DIRECTORY=$NOTES_DIRECTORY/testfile" > $HOME/.config/notes/config
run $notes new test

assert_failure
assert_line "Could not create directory $NOTES_DIRECTORY/testfile, please update your \$NOTES_DIRECTORY"
}

0 comments on commit 14e8f59

Please sign in to comment.