Skip to content

Commit

Permalink
jrnl: add proper functionality test
Browse files Browse the repository at this point in the history
Closes #2564.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
  • Loading branch information
DomT4 committed Jul 2, 2016
1 parent c6d3a7e commit bda61ca
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Formula/jrnl.rb
Expand Up @@ -65,6 +65,24 @@ def install
end

test do
system "#{bin}/jrnl", "-v"
(testpath/"write_journal.sh").write <<-EOS.undent
#!/usr/bin/expect -f
set timeout -1
spawn #{bin}/jrnl today: Wrote this fancy test.
expect -exact "Path to your journal file (leave blank for ~/journal.txt):"
send -- "#{testpath}/journal\n"
expect -exact "Enter password for journal (leave blank for no encryption): "
send -- "Homebrew\n"
expect "Do you want to store the password in your keychain?"
send -- "N\n"
expect -exact "Journal will be encrypted."
expect "Entry added to default journal"
expect eof
EOS
chmod 0755, testpath/"write_journal.sh"

system "./write_journal.sh"
assert File.exist?("journal")
assert File.exist?(".jrnl_config")
end
end

0 comments on commit bda61ca

Please sign in to comment.