From 25dcc4b2234ddb768b76a5f4bd928a4817022bb4 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 22 Nov 2014 17:54:49 +0200 Subject: Add scenario for multiple drafts --- yarns/020-basic-workflow.yarn | 22 +++++++++++++++++++++- yarns/900-implementations.yarn | 20 ++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/yarns/020-basic-workflow.yarn b/yarns/020-basic-workflow.yarn index 2572076..07f4a7c 100644 --- a/yarns/020-basic-workflow.yarn +++ b/yarns/020-basic-workflow.yarn @@ -23,4 +23,24 @@ draft, and exit the editor when done. THEN file SRC/drafts/0.mdwn doesn't exist AND file SRC/notes/2014/11/22/title.mdwn exists -This is how you create a note, in the simplest case. +This is how you create a note, in the simplest case. A more complex +case is when there's more than one draft at a time. + + SCENARIO multiple drafts + GIVEN an empty journal in SRC + AND the time is 2014-11-22 17:30:45 + + WHEN I run jt new FIRST + THEN file SRC/drafts/0.mdwn matches title="FIRST" + + WHEN I run jt new SECOND + THEN file SRC/drafts/1.mdwn matches title="SECOND" + +Now, finishing drafts requires naming them explicitly. + + WHEN I try to run jt finish + THEN it fails + + WHEN I run jt finish 1 + THEN file SRC/drafts/0.mdwn matches title="FIRST" + AND file SRC/notes/2014/11/22/second.mdwn matches title="SECOND" diff --git a/yarns/900-implementations.yarn b/yarns/900-implementations.yarn index 35398a6..80798af 100644 --- a/yarns/900-implementations.yarn +++ b/yarns/900-implementations.yarn @@ -65,6 +65,26 @@ user, and with specific settings to make the test suite run smoother. --layout=pkb \ --no-git \ $MATCH_1 + echo 0 > "$DATADIR/jt.exit" + +Sometimes we expect `jt` to fail. In that case, the scenario step +shouldn't fail. + + IMPLEMENTS WHEN I try to run jt (.*) + set +e + EDITOR=true \ + "$SRCDIR/jt" --no-default-config \ + --config "$DATADIR/source.conf" \ + --config "$DATADIR/time.conf" \ + --layout=pkb \ + --no-git \ + $MATCH_1 + echo "$?" > "$DATADIR/jt.exit" + +Check that the latest invocation of `jt` didn't fail. + + IMPLEMENTS THEN it fails + ! grep -Fx 0 "$DATADIR/jt.exit" Checking file existence -- cgit v1.2.1