mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 08:38:32 +02:00
Implement directory changing and relative directory test
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
This commit is contained in:
parent
7647755e96
commit
5d4d68fe32
2 changed files with 15 additions and 3 deletions
|
@ -32,11 +32,11 @@ Feature: Journals iteracting with the file system in a way that users can see
|
|||
Then the output should contain "This is a new entry in my journal"
|
||||
|
||||
Scenario: Creating journal with relative path should update to absolute path
|
||||
Given we use the config "missingconfig"
|
||||
When we run "jrnl hello world" and enter
|
||||
test.txt
|
||||
n
|
||||
And we change directory to "features"
|
||||
Then the output should contain "Journal 'default' created"
|
||||
When we change directory to "subfolder"
|
||||
And we run "jrnl -n 1"
|
||||
Then the output should contain "hello world"
|
||||
|
||||
|
|
|
@ -141,6 +141,10 @@ def temp_dir():
|
|||
def working_dir(request):
|
||||
return os.path.join(request.config.rootpath, "tests")
|
||||
|
||||
@fixture
|
||||
def config_path(temp_dir):
|
||||
os.chdir(temp_dir.name)
|
||||
return temp_dir.name + "/jrnl.yaml"
|
||||
|
||||
@fixture
|
||||
def toml_version(working_dir):
|
||||
|
@ -197,7 +201,7 @@ def keyring_type():
|
|||
@fixture
|
||||
def config_data(config_path):
|
||||
return load_config(config_path)
|
||||
|
||||
|
||||
|
||||
@fixture
|
||||
def journal_name():
|
||||
|
@ -551,6 +555,14 @@ def journal_directory_should_contain(config_data, file_list):
|
|||
assert does_directory_contain_files(file_list, scoped_config["journal"])
|
||||
|
||||
|
||||
@when(parse('we change directory to "{directory_name}"'))
|
||||
def when_we_change_directory(directory_name):
|
||||
if not os.path.isdir(directory_name):
|
||||
os.mkdir(directory_name)
|
||||
|
||||
os.chdir(directory_name)
|
||||
|
||||
|
||||
@then(parse("the journal {should_or_should_not} exist"))
|
||||
def journal_should_not_exist(config_data, should_or_should_not):
|
||||
scoped_config = scope_config(config_data, "default")
|
||||
|
|
Loading…
Add table
Reference in a new issue