mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-08 01:06:12 +02:00
Fix editor config when an argument with a space is used
This commit is contained in:
parent
cdaf1f5a36
commit
455720f788
4 changed files with 44 additions and 4 deletions
|
@ -85,6 +85,7 @@ def open_editor_and_enter(context, text=""):
|
|||
text = text or context.text or ""
|
||||
|
||||
def _mock_editor_function(command):
|
||||
context.editor_command = command
|
||||
tmpfile = command[-1]
|
||||
with open(tmpfile, "w+") as f:
|
||||
f.write(text)
|
||||
|
@ -92,7 +93,17 @@ def open_editor_and_enter(context, text=""):
|
|||
return tmpfile
|
||||
|
||||
with patch("subprocess.call", side_effect=_mock_editor_function):
|
||||
run(context, "jrnl")
|
||||
context.execute_steps('when we run "jrnl"')
|
||||
|
||||
|
||||
@then("the editor should have been called with {num} arguments")
|
||||
def count_editor_args(context, num):
|
||||
assert len(context.editor_command) == int(num)
|
||||
|
||||
|
||||
@then('the editor arguments should contain "{arg}"')
|
||||
def contains_editor_arg(context, arg):
|
||||
assert arg in context.editor_command
|
||||
|
||||
|
||||
def _mock_getpass(inputs):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue