class TTYtest::Terminal

@attr [Integer] max_wait_time the maximum amount of time (in seconds) to retry assertions before failing.

Attributes

max_wait_time[RW]

Public Class Methods

new(driver_terminal, max_wait_time: nil) click to toggle source

@api private @see TTYtest.new_terminal

# File lib/ttytest/terminal.rb, line 14
def initialize(driver_terminal, max_wait_time: nil)
  @driver_terminal = driver_terminal
  @max_wait_time = max_wait_time || TTYtest.default_max_wait_time
end

Private Instance Methods

synchronize(seconds=max_wait_time) { || ... } click to toggle source
# File lib/ttytest/terminal.rb, line 63
def synchronize(seconds=max_wait_time)
  start_time = Time.now
  begin
    yield
  rescue MatchError => e
    raise e if (Time.now - start_time) >= seconds
    sleep 0.05
    retry
  end
end