Module: TTYtest::Matchers

Included in:
Capture
Defined in:
lib/ttytest/matchers.rb

Constant Summary collapse

METHODS =
public_instance_methods

Instance Method Summary collapse

Instance Method Details

#assert_cursor_position(x:, y:) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/ttytest/matchers.rb', line 10

def assert_cursor_position(x:, y:)
  expected = [x, y]
  actual = cursor_position
  if actual != expected
    raise MatchError, "expected cursor to be at #{expected.inspect} but was at #{actual.inspect}\nEntire screen:\n#{to_s}"
  end
end

#assert_row(row_number, expected) ⇒ Object



3
4
5
6
7
8
# File 'lib/ttytest/matchers.rb', line 3

def assert_row(row_number, expected)
  actual = row(row_number)
  if actual != expected
    raise MatchError, "expected row #{row_number} to be #{expected.inspect} but got #{actual.inspect}\nEntire screen:\n#{to_s}"
  end
end