diff --git a/features/steps/core.py b/features/steps/core.py index d4bf1b47..66fa1e11 100644 --- a/features/steps/core.py +++ b/features/steps/core.py @@ -71,7 +71,15 @@ def set_config(context, config_file): @when('we open the editor and enter {text}') def open_editor_and_enter(context, text=""): text = (text or context.text) - with patch('subprocess.call', return_value=text): + print("open_editor_and_enter called") + def _mock_editor_function(command): + print("_mock_editor_function called") + tmpfile = command.split()[-1] + print("TMPFILE:", tmpfile) + with open(tmpfile, "w+") as f: + f.write(text) + + with patch('subprocess.call', side_effect=_mock_editor_function): run(context, "jrnl")