mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 19:48:31 +02:00
Requested changes PR 1482
This commit is contained in:
parent
28a278695f
commit
658fb8eb4e
4 changed files with 16 additions and 11 deletions
|
@ -434,7 +434,7 @@ def open_journal(journal_name, config, legacy=False):
|
||||||
if not config["encrypt"]:
|
if not config["encrypt"]:
|
||||||
if legacy:
|
if legacy:
|
||||||
return LegacyJournal(journal_name, **config).open()
|
return LegacyJournal(journal_name, **config).open()
|
||||||
if config["journal"].endswith("/") or config["journal"].endswith("\\"):
|
if config["journal"].endswith(os.sep):
|
||||||
from . import FolderJournal
|
from . import FolderJournal
|
||||||
|
|
||||||
return FolderJournal.Folder(journal_name, **config).open()
|
return FolderJournal.Folder(journal_name, **config).open()
|
||||||
|
|
|
@ -31,7 +31,8 @@ Feature: Journals iteracting with the file system in a way that users can see
|
||||||
When we run "jrnl -99 --short"
|
When we run "jrnl -99 --short"
|
||||||
Then the output should contain "This is a new entry in my journal"
|
Then the output should contain "This is a new entry in my journal"
|
||||||
|
|
||||||
Scenario: If the directory for a Folder journal ending in a slash ('/' or '\') doesn't exist, then it should be created
|
@on_posix
|
||||||
|
Scenario: If the directory for a Folder journal ending in a slash ('/') doesn't exist, then it should be created
|
||||||
Given we use the config "missing_directory.yaml"
|
Given we use the config "missing_directory.yaml"
|
||||||
Then the journal "endslash" directory should not exist
|
Then the journal "endslash" directory should not exist
|
||||||
When we run "jrnl endslash This is a new entry in my journal"
|
When we run "jrnl endslash This is a new entry in my journal"
|
||||||
|
@ -39,6 +40,15 @@ Feature: Journals iteracting with the file system in a way that users can see
|
||||||
When we run "jrnl endslash -1"
|
When we run "jrnl endslash -1"
|
||||||
Then the output should contain "This is a new entry in my journal"
|
Then the output should contain "This is a new entry in my journal"
|
||||||
|
|
||||||
|
@on_win
|
||||||
|
Scenario: If the directory for a Folder journal ending in a backslash ('\') doesn't exist, then it should be created
|
||||||
|
Given we use the config "missing_directory.yaml"
|
||||||
|
Then the journal "endbackslash" directory should not exist
|
||||||
|
When we run "jrnl endbackslash This is a new entry in my journal"
|
||||||
|
Then the journal "endbackslash" directory should exist
|
||||||
|
When we run "jrnl endbackslash -1"
|
||||||
|
Then the output should contain "This is a new entry in my journal"
|
||||||
|
|
||||||
Scenario: Creating journal with relative path should update to absolute path
|
Scenario: Creating journal with relative path should update to absolute path
|
||||||
Given we use no config
|
Given we use no config
|
||||||
When we run "jrnl hello world" and enter
|
When we run "jrnl hello world" and enter
|
||||||
|
|
|
@ -6,6 +6,7 @@ highlight: true
|
||||||
journals:
|
journals:
|
||||||
default: features/journals/missing_directory/simple.journal
|
default: features/journals/missing_directory/simple.journal
|
||||||
endslash: features/journals/missing_folder/
|
endslash: features/journals/missing_folder/
|
||||||
|
endbackslash: features\journals\missing_folder\
|
||||||
linewrap: 80
|
linewrap: 80
|
||||||
tagsymbols: "@"
|
tagsymbols: "@"
|
||||||
template: false
|
template: false
|
||||||
|
|
|
@ -214,16 +214,10 @@ def journal_should_not_exist(config_on_disk, should_or_should_not):
|
||||||
def directory_should_not_exist(config_on_disk, should_or_should_not, journal_name):
|
def directory_should_not_exist(config_on_disk, should_or_should_not, journal_name):
|
||||||
scoped_config = scope_config(config_on_disk, journal_name)
|
scoped_config = scope_config(config_on_disk, journal_name)
|
||||||
expected_path = scoped_config["journal"]
|
expected_path = scoped_config["journal"]
|
||||||
|
we_should = parse_should_or_should_not(should_or_should_not)
|
||||||
dir_exists = os.path.isdir(expected_path)
|
dir_exists = os.path.isdir(expected_path)
|
||||||
if should_or_should_not == "should":
|
|
||||||
assert dir_exists
|
assert dir_exists == we_should
|
||||||
elif should_or_should_not == "should not":
|
|
||||||
assert not dir_exists
|
|
||||||
else:
|
|
||||||
raise Exception(
|
|
||||||
"should_or_should_not valid values are 'should' or 'should not'"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@then(parse('the content of file "{file_path}" in the cache should be\n{file_content}'))
|
@then(parse('the content of file "{file_path}" in the cache should be\n{file_content}'))
|
||||||
|
|
Loading…
Add table
Reference in a new issue