ttytest2 0.9.13 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd614376f0369112c875543a1d8cc498b0de69dd436e6158fd6d8f06bd4ee87f
4
- data.tar.gz: 59373cd7e5699a8e6c96a3c0071efc4164d09ddfb71365291cf4a5d086b69bd1
3
+ metadata.gz: 4322aa40df769e1ed8a2095f5766199175afae71233c8308b3a6ef30322fedb2
4
+ data.tar.gz: 3d94b40f20cbea852a6462d23d3922a6a1e7ef95573815320047279f47e8c76d
5
5
  SHA512:
6
- metadata.gz: 77eb7d0d56818eaa11b3f0ac84230f5100a50bfc0ccf45c67c34a0389005b55317b5a85d23ed68f5b65c923fe8a51efe620304dcc345c7cd4cf902ff80b8e8d4
7
- data.tar.gz: 2a3d270669408488cd1e636231b336cd62e3606d1cd20dfd267858ca3e0a544ded977ecc657df82f2833a2a2a77c9f8d422428b84715377314e6c7faf57b81e7
6
+ metadata.gz: 90580621915fddc1ba3b6390fc58e7787fdfa86336cb576abd3224a68c8cb88fbf665425d960153bd0cf4d170aa02afb63f14f53acc2f1f37711d8bbb0c244a1
7
+ data.tar.gz: 44047668527313f4bcea17522d2c8ee77bf9e0695ebd89a6c68a01411305cd3389eb5e22e43c1c4861662414b7721b6772fd26d84b1364a8a447d9363af0ab04
data/.bundle/config CHANGED
File without changes
File without changes
data/.gitignore CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/README.md CHANGED
@@ -6,7 +6,7 @@ ttytest2 is a fork and a drop-in replacement for [ttytest](https://github.com/jh
6
6
 
7
7
  It works by running commands inside a tmux session, capturing the pane, and comparing the content to your assertions.
8
8
 
9
- The assertions will wait a specified amount of time (default 2 seconds) for the expected content to appear.
9
+ The assertions will wait a specified amount of time (configurable, default 2 seconds) for the expected content to appear.
10
10
 
11
11
  [![Gem Version](https://badge.fury.io/rb/ttytest2.svg?icon=si%3Arubygems)](https://badge.fury.io/rb/ttytest2)
12
12
 
@@ -77,15 +77,25 @@ Assertions will be retried for up to 2 seconds when called through TTYtest::Term
77
77
  Available assertions:
78
78
 
79
79
  * `assert_row(row_number, expected_text)`
80
+
80
81
  * `assert_row_at(row_number, column_start_position, column_end_position, expected_text)`
82
+
81
83
  * `assert_row_like(row_number, expected_text)`
84
+
82
85
  * `assert_row_starts_with(row_number, expected_text)`
86
+
83
87
  * `assert_row_ends_with(row_number, expected_text)`
88
+
84
89
  * `assert_row_regexp(row_number, regexp_str)`
90
+
85
91
  * `assert_cursor_position(x: x, y: y)`
92
+
86
93
  * `assert_cursor_visible`
94
+
87
95
  * `assert_cursor_hidden`
96
+
88
97
  * `assert_contents(lines_of_terminal)`
98
+
89
99
  * `assert_contents_at(row_start, row_end, expected_text)`
90
100
 
91
101
  ### Output
@@ -118,21 +128,30 @@ Helper functions to make sending output easier! They use the methods above under
118
128
  * `send_newlines(number_of_times)` # equivalent to calling send_newline number_of_times
119
129
  * `send_enter` # alias for send_newline
120
130
  * `send_enters(number_of_times)` # alias for send_newlines
131
+
121
132
  * `send_backspace` # simulate hitting backspace, equivalent to @tty.send_keys(TTYtest::BACKSPACE)
122
133
  * `send_backspaces(number_of_times)` # equivalent to calling send_backspace number_of_times
134
+
123
135
  * `send_delete` # simulate hitting delete, equivalent to calling send_keys_exact(%(DC))
124
136
  * `send_deletes` # equivalent to calling send_delete number_of_times
137
+
125
138
  * `send_right_arrow`
126
139
  * `send_right_arrows(number_of_times)`
140
+
127
141
  * `send_left_arrow`
128
142
  * `send_left_arrows(number_of_times)`
143
+
129
144
  * `send_up_arrow`
130
145
  * `send_up_arrows(number_of_times)`
146
+
131
147
  * `send_down_arrow`
132
148
  * `send_down_arrows(number_of_times)`
149
+
133
150
  * `send_home` # simulate pressing the Home key
134
151
  * `send_end` # simulate pressing the End key
152
+
135
153
  * `send_clear` # clear the screen by sending clear ascii code
154
+
136
155
  * `send_escape`
137
156
  * `send_escapes`
138
157
 
@@ -227,7 +246,7 @@ There are some commonly used keys available as constants to make interacting wit
227
246
  TTYtest::CLEAR # clear the screen
228
247
  ```
229
248
 
230
- ### Tips
249
+ ## Tips
231
250
 
232
251
  If you are using ttyest2 to test your CLI, using sh is easier than bash because you don't have to worry about user, current working directory, etc. as shown in the examples.
233
252
 
data/Rakefile CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -39,6 +39,14 @@ module TTYtest
39
39
  Terminal.new(session)
40
40
  end
41
41
 
42
+ def new_default_sh_terminal
43
+ new_terminal(%(PS1='$ ' /bin/sh), width: 80, height: 24)
44
+ end
45
+
46
+ def new_sh_terminal(width: 80, height: 24)
47
+ new_terminal(%(PS1='$ ' /bin/sh), width: width, height: height)
48
+ end
49
+
42
50
  # @api private
43
51
  def tmux(*args)
44
52
  ensure_available
@@ -80,9 +80,9 @@ module TTYtest
80
80
  sleep sleep_time
81
81
  end
82
82
 
83
- def send_line_then_sleep_and_repeat(*lines)
83
+ def send_line_then_sleep_and_repeat(*lines, sleep_time)
84
84
  lines.each do |line|
85
- send_line_then_sleep(line)
85
+ send_line_then_sleep(line, sleep_time)
86
86
  end
87
87
  end
88
88
 
File without changes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TTYtest
4
- VERSION = '0.9.13'
4
+ VERSION = '1.0.0'
5
5
  end
data/lib/ttytest.rb CHANGED
@@ -17,7 +17,15 @@ module TTYtest
17
17
  # @param [Integer] width width of the new terminal
18
18
  # @param [Integer] height height of the new terminal
19
19
  # @return [Terminal] a new terminal running the specified command
20
- def_delegators :driver, :new_terminal
20
+
21
+ # @!method new_default_sh_terminal
22
+ # Create a new terminal using '/bin/sh' with width: 80 and height: 24.
23
+ # Useful for Unixes.
24
+
25
+ # @!method new_sh_terminal(width: 80, height: 24)
26
+ # Create a new terminal using '/bin/sh' with ability to set width and height.
27
+ # Useful for Unixes.
28
+ def_delegators :driver, :new_terminal, :new_default_sh_terminal, :new_sh_terminal
21
29
  end
22
30
 
23
31
  class MatchError < StandardError; end
data/notes.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  to push new version to github
2
- git tag v0.9.13
2
+ git tag v1.0.0
3
3
  git push origin --tags
4
4
 
5
5
  to push new version to rubygems.org
6
6
  gem build ttytest2.gemspec
7
- gem push ttytest2-0.9.13.gem
7
+ gem push ttytest2-1.0.0.gem
data/ttytest2.gemspec CHANGED
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ttytest2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.13
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Eski
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-03 00:00:00.000000000 Z
11
+ date: 2025-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler