Files

29 lines
708 B
Python

"""Step definitions for the placeholder feature."""
from __future__ import annotations
import contextlib
import io
from typing import Any
from behave import then, when
from boilerplate.cli import main
@when("I run the boilerplate CLI without arguments")
def step_run_cli(context: Any) -> None:
buffer = io.StringIO()
with contextlib.redirect_stdout(buffer):
exit_code = main([])
context.result = {
"exit_code": exit_code,
"output": buffer.getvalue(),
}
@then('the output should contain "Hello, World!"')
def step_output_contains_greeting(context: Any) -> None:
assert context.result["exit_code"] == 0
assert "Hello, World!" in context.result["output"]