mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 08:38:32 +02:00
Tests for writing entries from the command line
This commit is contained in:
parent
cd67ad73ea
commit
af16165159
2 changed files with 16 additions and 3 deletions
|
@ -1,10 +1,10 @@
|
|||
Feature: Basic reading and writing to a journal
|
||||
|
||||
Scenario: Loading a sample journal
|
||||
Given we use "basic.json"
|
||||
Given we use the config "basic.json"
|
||||
When we run "jrnl -n 2"
|
||||
Then we should get no error
|
||||
Then the output should be
|
||||
And the output should be
|
||||
"""
|
||||
2013-06-09 15:39 My first entry.
|
||||
| Everything is alright
|
||||
|
@ -12,3 +12,10 @@ Feature: Basic reading and writing to a journal
|
|||
2013-06-10 15:40 Life is good.
|
||||
| But I'm better.
|
||||
"""
|
||||
|
||||
Scenario: Writing an entry from command line
|
||||
Given we use the config "basic.json"
|
||||
When we run "jrnl 23 july 2013: A cold and stormy day. I ate crisps on the sofa."
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -n 1"
|
||||
Then the output should contain "2013-07-23 09:00 A cold and stormy day."
|
||||
|
|
|
@ -2,7 +2,7 @@ from behave import *
|
|||
from jrnl import Journal, jrnl
|
||||
import os
|
||||
|
||||
@given('we use "{config_file}"')
|
||||
@given('we use the config "{config_file}"')
|
||||
def set_config(context, config_file):
|
||||
full_path = os.path.join("features/configs", config_file)
|
||||
jrnl.CONFIG_PATH = os.path.abspath(full_path)
|
||||
|
@ -22,3 +22,9 @@ def check_output(context):
|
|||
out = context.stdout_capture.getvalue().strip().splitlines()
|
||||
for line_text, line_out in zip(text, out):
|
||||
assert line_text.strip() == line_out.strip()
|
||||
|
||||
@then('the output should contain "{text}"')
|
||||
def check_output(context, text):
|
||||
out = context.stdout_capture.getvalue()
|
||||
print out
|
||||
assert text in out
|
||||
|
|
Loading…
Add table
Reference in a new issue