Skip to content

struct Athena::Console::Spec::ApplicationTester
inherits Struct #

Functionally similar to ACON::Spec::CommandTester, but used for testing entire ACON::Applications.

Can be useful if your project extends the base application in order to customize it in some way.

Note

Be sure to set ACON::Application#auto_exit= to false, when testing an entire application.

Included modules

Athena::Console::Spec::Tester

Constructors#

.new(application : ACON::Application)#

Methods#

#application : ACON::Application#

Returns the ACON::Application instance being tested.

#input : ACON::Input::Interface#

Returns the ACON::Input::Interface being used by the tester.

#input? : ACON::Input::Interface | ::Nil#

Returns the ACON::Input::Interface being used by the tester.

#run(input : Hash(String, _) = Hash(String, String).new, *, decorated : Bool | Nil = nil, interactive : Bool | Nil = nil, capture_stderr_separately : Bool = false, verbosity : ACON::Output::Verbosity | Nil = nil) : ACON::Command::Status#

Runs the application, with the provided input being used as the input of ACON::Application#run.

Custom values for decorated, interactive, and verbosity can also be provided and will be forwarded to their respective types. capture_stderr_separately makes it so output to STDERR is captured separately, in case you wanted to test error output. Otherwise both error and normal output are captured via ACON::Spec::Tester#display.

#run(decorated : Bool = false, interactive : Bool | Nil = nil, capture_stderr_separately : Bool = false, verbosity : ACON::Output::Verbosity | Nil = nil, **input : _)#

Runs the application, with the provided input being used as the input of ACON::Application#run.

Custom values for decorated, interactive, and verbosity can also be provided and will be forwarded to their respective types. capture_stderr_separately makes it so output to STDERR is captured separately, in case you wanted to test error output. Otherwise both error and normal output are captured via ACON::Spec::Tester#display.

#status : ACON::Command::Status | ::Nil#

Returns the ACON::Command::Status of the command execution, or nil if it has not yet been executed.