struct Athena::Console::Spec::ApplicationTester

Overview

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

Defined in:

spec.cr

Constructors

Instance Method Summary

Instance methods inherited from module Athena::Console::Spec::Tester

assert_command_is_successful(message : String = "", *, file : String = __FILE__, line : Int32 = __LINE__) : Nil assert_command_is_successful, display(normalize : Bool = false) : String display, error_output(normalize : Bool = false) : String error_output, inputs(*args : String) : Nil inputs, inputs=(inputs : Array(String)) inputs=, output : ACON::Output::Interface output, output? : ACON::Output::Interface | Nil output?, status : ACON::Command::Status | Nil status

Constructor Detail

def self.new(application : ACON::Application) #

[View source]

Instance Method Detail

def application : ACON::Application #

Returns the ACON::Application instance being tested.


[View source]

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


[View source]
def input? : ACON::Input::Interface | Nil #

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


[View source]
def 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.


[View source]
def 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.


[View source]
def status : ACON::Command::Status | Nil #

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


[View source]