Class: TTY::Prompt::Test

Inherits:
TTY::Prompt show all
Defined in:
lib/tty/prompt/test.rb

Constant Summary

Constants inherited from TTY::Prompt

ArgumentRequired, ArgumentValidation, ConfigurationError, ConversionAlreadyDefined, ConversionError, Error, InvalidArgument, UnsupportedConversion, VERSION, ValidationCoercion

Instance Attribute Summary

Attributes inherited from TTY::Prompt

#active_color, #cursor, #enabled_color, #error_color, #help_color, #input, #output, #prefix, #quiet, #reader, #symbols

Instance Method Summary collapse

Methods inherited from TTY::Prompt

#ask, #collect, #debug, #decorate, #enum_select, #error, #expand, #inspect, #invoke_question, #invoke_select, #keypress, #mask, messages, #multi_select, #multiline, #no?, #ok, #say, #select, #slider, #stderr, #stdin, #stdout, #suggest, #tty?, #warn, #yes?

Constructor Details

#initialize(**options) ⇒ Test

Returns a new instance of Test.



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/tty/prompt/test.rb', line 21

def initialize(**options)
  @input = StringIO.new
  @input.extend(StringIOExtensions)
  @output = StringIO.new

  options.merge!({
    input: @input,
    output: @output,
    env: { "TTY_TEST" => true },
    enable_color: options.fetch(:enable_color, true)
  })
  super(**options)
end