diff --git a/features/data/configs/dayone.yaml b/features/data/configs/dayone.yaml index 8807e66b..5b8f4aa4 100644 --- a/features/data/configs/dayone.yaml +++ b/features/data/configs/dayone.yaml @@ -4,6 +4,7 @@ editor: '' template: false encrypt: false highlight: true +editor: noop journals: default: features/journals/dayone.dayone linewrap: 80 diff --git a/features/dayone.feature b/features/dayone.feature index bf74dc8d..0efc7bfd 100644 --- a/features/dayone.feature +++ b/features/dayone.feature @@ -75,3 +75,9 @@ Feature: Dayone specific implementation details. and the json output should contain entries.0.creator.generation_date and the json output should contain entries.0.creator.device_agent and "entries.0.creator.software_agent" in the json output should contain "jrnl" + + Scenario: Editing Dayone with mock editor + Given we use the config "dayone.yaml" + When we run "jrnl --edit" + Then we should get no error + diff --git a/features/steps/core.py b/features/steps/core.py index 13b11bd2..00ff34a9 100644 --- a/features/steps/core.py +++ b/features/steps/core.py @@ -209,8 +209,13 @@ def run(context, command, cache_dir=None): args = ushlex(command) + def _mock_editor(command): + context.editor_command = command + try: - with patch("sys.argv", args): + with patch("sys.argv", args), patch( + "subprocess.call", side_effect=_mock_editor + ): cli.run(args[1:]) context.exit_status = 0 except SystemExit as e: