Module: TTYtest::Matchers
- Included in:
- Capture
- Defined in:
- lib/ttytest/matchers.rb
Constant Summary collapse
- METHODS =
public_instance_methods
Instance Method Summary collapse
- #assert_cursor_hidden ⇒ Object
- #assert_cursor_position(x:, y:) ⇒ Object
- #assert_cursor_visible ⇒ Object
- #assert_row(row_number, expected) ⇒ Object
Instance Method Details
#assert_cursor_hidden ⇒ Object
24 25 26 27 28 |
# File 'lib/ttytest/matchers.rb', line 24 def assert_cursor_hidden if !cursor_hidden? raise MatchError, "expected cursor to be hidden was visible\nEntire screen:\n#{to_s}" end end |
#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_cursor_visible ⇒ Object
18 19 20 21 22 |
# File 'lib/ttytest/matchers.rb', line 18 def assert_cursor_visible if !cursor_visible? raise MatchError, "expected cursor to be visible was hidden\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 |