ttytest2 0.8.3 → 0.8.4

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: 995f1309860d889b44e0634247e1ae64cda8fc975a8a02de97de55605bd2958e
4
- data.tar.gz: a7a2c819970a4a6b432b7067ef3bf2feb8d349332b731df4c1639b4db659140d
3
+ metadata.gz: 8801fe1b91cd7d371a9b1dc5668ad64b395e80778a6846c21ea004dd635b3107
4
+ data.tar.gz: fe6847ef687fa1ece179ab5201173145f5ee1b243fa62f533ce5deddc290137a
5
5
  SHA512:
6
- metadata.gz: 83f652b2a5c2815e798cff48d6cd6c83b1a2d325e49306b9f883c11d6a01392c1b0c5303a175b1065238ea01d3628f06cc8a8a96cfa31c42e83d37746cd8cb63
7
- data.tar.gz: 3916165f772f1607ab7c03b497848213d30c7e7e93ce584fb911f081c5236d76722e3090b3c2a26889b3c52294e153d66be5df532d45f91a19ce9e0b362b3644
6
+ metadata.gz: 85b636e54bd9845b50b5d6cc5c9feaa3fac871ee4bf724409f191e38e86649fa695bb6a4917ea877b5d59d6d8dbb2fd0697aacff6122501fba14d6ae56f00654
7
+ data.tar.gz: 38485e1cae3446068272b40a00d44eb12ce854442c87a8a0dbbd638d9b52a80a82b4c93a10e7f2c83312fef32aa88e771c7fe564d09d8db5e509907e68015bee
data/README.md CHANGED
@@ -6,10 +6,7 @@ Forked from https://github.com/jhawthorn/ttytest, because I had some features I
6
6
 
7
7
  It works by running commands inside a tmux session, capturing the pane, and comparing the content. The assertions will wait a specified amount of time (default 2 seconds) for the expected content to appear.
8
8
 
9
- [![Gem Version](https://badge.fury.io/rb/ttytest2.svg)](https://badge.fury.io/rb/ttytest2)
10
-
11
- ## Gem at RubyGems.org
12
- https://rubygems.org/gems/ttytest2
9
+ [![Gem Version](https://badge.fury.io/rb/ttytest2.svg?icon=si%3Arubygems)](https://badge.fury.io/rb/ttytest2)
13
10
 
14
11
  ## Minimum Requirements
15
12
 
@@ -18,6 +15,21 @@ https://rubygems.org/gems/ttytest2
18
15
 
19
16
  ## Usage
20
17
 
18
+ ### Assertions
19
+
20
+ The main way to use TTYtest is through assertions. When called on a `TTYtest::Terminal`, each of these will be retried (for up to 2 seconds).
21
+
22
+ Available assertions:
23
+ * `assert_row(row_number, expected_text)`
24
+ * `assert_row_like(row_number, expected_text)`
25
+ * `assert_row_starts_with(row_number, expected_text)`
26
+ * `assert_row_ends_with(row_number, expected_text)`
27
+ * `assert_cursor_position(x: x, y: y)`
28
+ * `assert_cursor_visible`
29
+ * `assert_cursor_hidden`
30
+ * `assert_contents(lines_of_terminal)`
31
+
32
+
21
33
  ### Example Canonical CLI/Shell
22
34
  Most people should use send_keys, if you are writing or working with a noncanonical shell/CLI, you will probably know it. Most are canonical.
23
35
 
@@ -52,23 +64,9 @@ require 'ttytest'
52
64
 
53
65
  @tty.send_keys_one_at_a_time('ls')
54
66
  @tty.assert_row_ends_with(0, 'ls')
55
- @tty.send_keys_one_at_a_time(%(\n))
67
+ @tty.send_keys(%(\n)) # make sure to use send_keys for 'multi-character' characters like \n, \r, \t, etc.
56
68
  ```
57
69
 
58
- ### Assertions
59
-
60
- The main way to use TTYtest is through assertions. When called on a `TTYtest::Terminal`, each of these will be retried (for up to 2 seconds by default).
61
-
62
- Available assertions:
63
- * `assert_row(row_number, expected_text)`
64
- * `assert_row_like(row_number, expected_text)`
65
- * `assert_row_starts_with(row_number, expected_text)`
66
- * `assert_row_ends_with(row_number, expected_text)`
67
- * `assert_cursor_position(x: x, y: y)`
68
- * `assert_cursor_visible`
69
- * `assert_cursor_hidden`
70
- * `assert_contents(lines_of_terminal)`
71
-
72
70
  ## Docker
73
71
 
74
72
  Easy to use from Docker. Add this to your dockerfile to get started.
@@ -77,20 +75,9 @@ Easy to use from Docker. Add this to your dockerfile to get started.
77
75
  RUN apt update && \
78
76
  apt install gcc make ruby tmux -y && \
79
77
  gem install ttytest2
80
- ```
81
-
82
- ## TravisCI
83
-
84
- TTYtest can run on [TravisCI](https://travis-ci.org/), but the version of tmux made available with their default ubuntu 12.04 environment is too old. However the TravisCI ubuntu 14.04 "trusty" image provides tmux 1.8, which works great.
85
-
86
- Ensure the following is in your `.travis.yml` (see [this project's .travis.yml](./.travis.yml) for an example)
87
78
 
88
- ``` yaml
89
- dist: trusty
90
- addons:
91
- apt:
92
- packages:
93
- - tmux
79
+ # add this if you have issues
80
+ # ENV RUBYOPT="-KU -E utf-8:utf-8"
94
81
  ```
95
82
 
96
83
  ## Contributing
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # some constants that can be used with send_keys, just to help out people creating tests
4
+ # may not work with all terminal emulators
5
+ module TTYtest
6
+ BACKSPACE = 127.chr
7
+ TAB = 9.chr
8
+ CTRLF = 6.chr
9
+ CTRLC = 3.chr
10
+ CTRLD = '\004'
11
+ ESCAPE = 27.chr
12
+ NEWLINE = '\n'
13
+
14
+ UP_ARROW = "#{ESCAPE}[A".freeze
15
+ DOWN_ARROW = "#{ESCAPE}[B".freeze
16
+ RIGHT_ARROW = "#{ESCAPE}[C".freeze
17
+ LEFT_ARROW = "#{ESCAPE}[D".freeze
18
+
19
+ CLEAR = 'clear'
20
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TTYtest
4
- VERSION = '0.8.3'
4
+ VERSION = '0.8.4'
5
5
  end
data/lib/ttytest.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'forwardable'
4
+ require 'ttytest/constants'
4
5
  require 'ttytest/tmux/driver'
5
6
  require 'ttytest/tmux/session'
6
7
 
data/notes.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  to push new version to github,
2
- git tag v0.8.3
2
+ git tag v0.8.4
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.8.3.gem
7
+ gem push ttytest2-0.8.4.gem
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ttytest2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Eski
@@ -81,6 +81,7 @@ files:
81
81
  - Rakefile
82
82
  - lib/ttytest.rb
83
83
  - lib/ttytest/capture.rb
84
+ - lib/ttytest/constants.rb
84
85
  - lib/ttytest/matchers.rb
85
86
  - lib/ttytest/terminal.rb
86
87
  - lib/ttytest/tmux/driver.rb