aruba 2.3.2 → 2.4.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: 7e3c87e4029e5aac0df41dedf149ae5daef179adf10fb42d0ca849777137aa04
4
- data.tar.gz: d9a69eb20c0f03bdfc25fdeabfbfc47e08f46942ef98a90505b6a7b677bed07e
3
+ metadata.gz: 355026fa14aea82eab3f58fd0f42702aeb67b9c925ae2582cf42b39b11c2e459
4
+ data.tar.gz: c4275785c79d44fd5511dfb740eb42ee9459ad6a8aaea240f594a7aaca3f322a
5
5
  SHA512:
6
- metadata.gz: ec3a9fed492a0063cbda426bce29b786be7ba969bcdabe39ffa5fad7e0eff1c80d4bfd672c79b693c2006bd806e63e1a1a9252af14e6d8842f7317a39362905f
7
- data.tar.gz: 1c17367e3c927ed38f832bfe879e71773a64850ef6ad566a8a97d6a78ff6b0c57a49dbff021eb63a9a028bc020b693de848d645b3a9cf5306de3f50f75ef9dfe
6
+ metadata.gz: cb0da11ceb2b6d01fc0b7d714b0e160126629b60c3b181469bab243be7adcd84c9764164fe67dfa216c8214368d91c19c7e4d67c6441cf3583f4355757ad26b9
7
+ data.tar.gz: 75e9ff485d87d2551211187d7597836a275de7c70851071a0c819c8926a0cb4543ac2f228127dbd8cb66545582da613d7e1764c57870cbbe838127e7972a333e
data/CHANGELOG.md CHANGED
@@ -6,11 +6,46 @@ This project adheres to [Semantic Versioning][1].
6
6
 
7
7
  This document is formatted according to the principles of [Keep A CHANGELOG][2].
8
8
 
9
+ ## [2.4.0] / 2026-05-02
10
+
11
+ * Allow multiple arguments to xProcess#write ([#634] by [mvz])
12
+ * Add step definitions to check the exit status of a specific command
13
+ ([#978] by [mvz])
14
+ * Improve cucumber step wording ([#982] by [mvz])
15
+ * Support Ruby 4.0 ([#969], [#972] and [#974] by [mvz])
16
+ * Documentation improvements ([#976], [#977] and [#987] by [mvz])
17
+ * Support Cucumber 11.0 ([#1006] by [mvz])
18
+
19
+ [#634]: https://github.com/cucumber/aruba/pull/634
20
+ [#969]: https://github.com/cucumber/aruba/pull/969
21
+ [#972]: https://github.com/cucumber/aruba/pull/972
22
+ [#974]: https://github.com/cucumber/aruba/pull/974
23
+ [#976]: https://github.com/cucumber/aruba/pull/976
24
+ [#977]: https://github.com/cucumber/aruba/pull/977
25
+ [#978]: https://github.com/cucumber/aruba/pull/978
26
+ [#982]: https://github.com/cucumber/aruba/pull/982
27
+ [#987]: https://github.com/cucumber/aruba/pull/987
28
+ [#1006]: https://github.com/cucumber/aruba/pull/1006
29
+
30
+ [2.4.0]: https://github.com/cucumber/aruba/compare/v2.3.3...v2.4.0
31
+
32
+ ## [2.3.3] / 2025-12-05
33
+
34
+ * Remove bundler version upper limit constraint ([#962] by [hsbt])
35
+
36
+ [hsbt]: https://github.com/hsbt
37
+ [#962]: https://github.com/cucumber/aruba/pull/962
38
+
39
+ [2.3.3]: https://github.com/cucumber/aruba/compare/v2.3.2...v2.3.3
40
+
9
41
  ## [2.3.2] / 2025-09-13
10
42
 
11
43
  * Relax RSpec verson constraint to allow RSpec 4.x ([#956] by [pirj])
12
44
 
13
45
  [pirj]: https://github.com/pirj
46
+ [#956]: https://github.com/cucumber/aruba/pull/956
47
+
48
+ [2.3.2]: https://github.com/cucumber/aruba/compare/v2.3.1...v2.3.2
14
49
 
15
50
  ## [2.3.1] / 2025-06-13
16
51
 
data/CONTRIBUTING.md CHANGED
@@ -58,7 +58,7 @@ Please...
58
58
  * Make sure your patch is well covered by tests. We don't accept changes that
59
59
  aren't tested.
60
60
  * Do not change the `Rakefile`, gem version number in `version.rb`, or
61
- [`CHANGELOG.md`][].
61
+ [`CHANGELOG.md`][changelog].
62
62
  (If you want to have your own version, that is fine but bump version in a
63
63
  separate commit, so that we can ignore that commit when we merge your change.)
64
64
  * Make sure your pull request complies with our development style guidelines.
@@ -75,7 +75,7 @@ Please...
75
75
  changes you might expected to break the build.
76
76
  * Commit smaller changes directly to `main`, e.g. fixing typos, adding tests or
77
77
  adding documentation.
78
- * Update [`CHANGELOG.md`][] when a pull request is merged.
78
+ * Update [`CHANGELOG.md`][changelog] when a pull request is merged.
79
79
  * Make sure all tests are green before merging a pull request.
80
80
 
81
81
  ### Development style guidelines
@@ -102,7 +102,7 @@ Please...
102
102
  6. Wrap the body at 72 characters
103
103
  7. Use the body to explain what and why vs. how (optional if subject is self-explanatory)
104
104
 
105
- ## Getting started as a "Contributor"
105
+ ## Getting started as a contributor
106
106
 
107
107
  ### Requirements
108
108
 
@@ -195,56 +195,19 @@ bundle exec rake install
195
195
  bundle exec rake install:local
196
196
  ```
197
197
 
198
- ## Getting started as a "Maintainer"
199
-
200
- ### Release Process
198
+ ## Release Process
201
199
 
202
200
  * Bump the version number in `lib/aruba/version.rb`
203
- * Make sure [`CHANGELOG.md`] is updated with the upcoming version number, and has
204
- entries for all fixes.
205
- * No need to add a [`CHANGELOG.md`] header at this point - this should be done
206
- later, when a new change is made.
207
-
208
- Now release it:
209
-
210
- ```bash
211
- # update dependencies
212
- bundle update
213
-
214
- # Run test suite
215
- bundle exec rake
216
-
217
- # Release gem
218
- git commit -m "Version bump"
219
- bundle exec rake release
220
- ```
201
+ * Make sure [`CHANGELOG.md`][changelog] is updated with the upcoming version
202
+ number, and has entries for all fixes.
203
+ * Make sure [`README.md`][readme] is up-to-date.
204
+ * No need to add a [`CHANGELOG.md`][changelog] header at this point - this
205
+ should be done later, when a new change is made.
221
206
 
222
- Now send a PR to [cucumber/website] adding an article
223
- with details of the new release. Then merge it - an aruba maintainer should
224
- normally be allowed to merge PRs on [cucumber/website]. A copy of an old
225
- announcement can be used as basis for the new article.
226
-
227
- Now, send an email with the link to the article to `cukes@googlegroups.com`.
228
-
229
- ### Gaining Release Karma
230
-
231
- To become a release manager, create a pull request adding your name to the list
232
- below, and include your Rubygems email address in the ticket. One of the
233
- existing Release managers will then add you.
234
-
235
- Current release managers:
236
- * Aslak Hellesøy ([@aslakhellesoy](https://github.com/aslakhellesoy))
237
- * Matt Wynne ([@mattwynne](https://github.com/mattwynne))
238
- * Matijs van Zuijlen ([@mvz](https://github.com/mvz))
239
-
240
- To grant release karma, issue the following command:
241
-
242
- ```bash
243
- gem owner aruba --add <NEW OWNER RUBYGEMS EMAIL>
244
- ```
207
+ See [the general Cucumber project release process](https://github.com/cucumber/.github/blob/main/RELEASING.md).
245
208
 
246
- [`CHANGELOG.md`]: CHANGELOG.md
247
- [CHANGELOG.md]: CHANGELOG.md
209
+ [changelog]: CHANGELOG.md
210
+ [readme]: README.md
248
211
 
249
212
  [`rubocop`]: https://github.com/bbatsov/rubocop
250
213
  [Ruby Community Style Guide]: https://github.com/bbatsov/ruby-style-guide
data/README.md CHANGED
@@ -3,14 +3,14 @@
3
3
  [![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/cucumber/aruba/main/LICENSE)
4
4
  [![Gem Version](https://badge.fury.io/rb/aruba.svg)](http://badge.fury.io/rb/aruba)
5
5
  [![Support](https://img.shields.io/badge/cucumber-support-orange.svg)](https://cucumber.io/support)
6
- [![Build Status](https://github.com/cucumber/aruba/actions/workflows/ruby.yml/badge.svg)](https://github.com/cucumber/aruba/actions/workflows/ruby.yml)
6
+ [![CI](https://github.com/cucumber/aruba/actions/workflows/test.yml/badge.svg)](https://github.com/cucumber/aruba/actions/workflows/test.yml)
7
7
 
8
8
  ## Install
9
9
 
10
10
  Add this line to your application's `Gemfile`:
11
11
 
12
12
  ```ruby
13
- gem 'aruba', '~> 2.3'
13
+ gem 'aruba', '~> 2.4'
14
14
  ```
15
15
 
16
16
  And then execute:
@@ -79,16 +79,17 @@ bump.
79
79
  ## Supported Ruby versions
80
80
 
81
81
  Aruba is supported on Ruby 3.0 and up, and tested against CRuby 3.0, 3.1, 3.2,
82
- 3.3 and 3.4, and JRuby 9.4.
82
+ 3.3, 3.4 and 4.0, and JRuby 9.4 and 10.0.
83
83
 
84
84
  ## Supported Cucumber versions
85
85
 
86
- Aruba is supported on and tested with Cucumber versions 8 and 9.
86
+ Aruba is supported on and tested with Cucumber versions 8, 9, 10 and 11.
87
87
 
88
88
  ## Supported operating systems
89
89
 
90
90
  Aruba is fully tested in CI on Linux and MacOS. On Windows, only RSpec tests
91
- are run, so YMMV. Full Windows support is a work in progress.
91
+ and some of the Cucumber scenarios are run, so YMMV. Full Windows support is a
92
+ work in progress.
92
93
 
93
94
  ## Contributing
94
95
 
@@ -36,9 +36,10 @@ module Aruba
36
36
  # The file which should be used to pipe in data
37
37
  def pipe_in_file(file_name)
38
38
  file_name = expand_path(file_name)
39
-
40
- File.open(file_name, 'r').each_line do |line|
41
- last_command_started.write(line)
39
+ File.open(file_name, 'r') do |file|
40
+ file.each_line do |line|
41
+ last_command_started.write(line)
42
+ end
42
43
  end
43
44
  end
44
45
 
@@ -212,7 +213,7 @@ module Aruba
212
213
  def type(input)
213
214
  return close_input if input == "\u0004"
214
215
 
215
- last_command_started.write("#{input}\n")
216
+ last_command_started.write(input, "\n")
216
217
  end
217
218
 
218
219
  # Close stdin
@@ -40,8 +40,13 @@ When 'I run {command} interactively' do |cmd|
40
40
  run_command(sanitize_text(cmd))
41
41
  end
42
42
 
43
- # Merge interactive and background after refactoring with event queue
43
+ When 'I run {command} in the background' do |cmd|
44
+ run_command(sanitize_text(cmd))
45
+ end
46
+
44
47
  When 'I run {command} in background' do |cmd|
48
+ Aruba.platform.deprecated \
49
+ 'This cucumber step is deprecated. Use "I run {command} in the background" instead.'
45
50
  run_command(sanitize_text(cmd))
46
51
  end
47
52
 
@@ -78,53 +83,63 @@ end
78
83
  When(/^I stop the command(?: started last)? if (output|stdout|stderr) contains:$/) \
79
84
  do |channel, expected|
80
85
 
81
- Timeout.timeout(aruba.config.exit_timeout) do
82
- loop do
83
- output = last_command_started.public_send channel.to_sym, wait_for_io: 0
86
+ start_time = Time.now
87
+ loop do
88
+ output = last_command_started.public_send channel.to_sym, wait_for_io: 0
84
89
 
85
- output = sanitize_text(output)
86
- expected = sanitize_text(expected)
90
+ output = sanitize_text(output)
91
+ expected = sanitize_text(expected)
87
92
 
88
- if output.include? expected
89
- last_command_started.terminate
93
+ if output.include? expected
94
+ last_command_started.terminate
90
95
 
91
- break
92
- end
96
+ break
97
+ end
93
98
 
94
- sleep 0.1
99
+ if Time.now - start_time > aruba.config.exit_timeout
100
+ last_command_started.terminate
101
+ break
95
102
  end
103
+
104
+ sleep 0.1
96
105
  end
97
- rescue Timeout::Error
98
- last_command_started.terminate
99
106
  end
100
107
 
101
108
  When 'I wait for output/stdout to contain:' do |expected|
102
- Timeout.timeout(aruba.config.exit_timeout) do
103
- loop do
104
- output = last_command_started.stdout wait_for_io: 0
109
+ start_time = Time.now
110
+ loop do
111
+ output = last_command_started.stdout wait_for_io: 0
105
112
 
106
- output = sanitize_text(output)
107
- expected = sanitize_text(expected)
113
+ output = sanitize_text(output)
114
+ expected = sanitize_text(expected)
108
115
 
109
- break if output.include? expected
116
+ break if output.include? expected
110
117
 
111
- sleep 0.1
118
+ elapsed_time = Time.now - start_time
119
+ if elapsed_time > aruba.config.exit_timeout
120
+ raise "Operation timed out after #{elapsed_time} seconds"
112
121
  end
122
+
123
+ sleep 0.1
113
124
  end
114
125
  end
115
126
 
116
127
  When 'I wait for output/stdout to contain {string}' do |expected|
117
- Timeout.timeout(aruba.config.exit_timeout) do
118
- loop do
119
- output = last_command_started.stdout wait_for_io: 0
128
+ start_time = Time.now
129
+ loop do
130
+ output = last_command_started.stdout wait_for_io: 0
120
131
 
121
- output = sanitize_text(output)
122
- expected = sanitize_text(expected)
132
+ output = sanitize_text(output)
133
+ expected = sanitize_text(expected)
123
134
 
124
- break if output.include? expected
135
+ break if output.include? expected
125
136
 
126
- sleep 0.1
137
+ elapsed_time = Time.now - start_time
138
+ if elapsed_time > aruba.config.exit_timeout
139
+ raise "Operation timed out after #{elapsed_time} seconds"
127
140
  end
141
+
142
+ sleep 0.1
128
143
  end
129
144
  end
130
145
 
@@ -354,7 +369,34 @@ Then(/^the exit status should( not)? be (\d+)$/) do |negated, exit_status|
354
369
  end
355
370
  end
356
371
 
372
+ Then('the exit status of {command} should be {int}') do |command, exit_status|
373
+ cmd = aruba.command_monitor.find(command)
374
+ cmd.stop
375
+
376
+ expect(cmd).to have_exit_status exit_status
377
+ end
378
+
379
+ Then('the exit status of {command} should not be {int}') do |command, exit_status|
380
+ cmd = aruba.command_monitor.find(command)
381
+ cmd.stop
382
+
383
+ expect(cmd).not_to have_exit_status exit_status
384
+ end
385
+
386
+ Then(/^it should (pass|fail)$/) do |pass_fail|
387
+ last_command_started.stop
388
+
389
+ if pass_fail == 'pass'
390
+ expect(last_command_stopped).to be_successfully_executed
391
+ else
392
+ expect(last_command_stopped).not_to be_successfully_executed
393
+ end
394
+ end
395
+
357
396
  Then(/^it should not (pass|fail) with "(.*?)"$/) do |pass_fail, expected|
397
+ Aruba.platform.deprecated \
398
+ 'This cucumber step has confusing behavior and is deprecated.' \
399
+ "Use 'it should #{pass_fail}' with a negative output matcher step instead."
358
400
  last_command_started.stop
359
401
 
360
402
  if pass_fail == 'pass'
@@ -379,6 +421,9 @@ Then(/^it should (pass|fail) with "(.*?)"$/) do |pass_fail, expected|
379
421
  end
380
422
 
381
423
  Then(/^it should not (pass|fail) with:$/) do |pass_fail, expected|
424
+ Aruba.platform.deprecated \
425
+ 'This cucumber step has confusing behavior and is deprecated.' \
426
+ "Use 'it should #{pass_fail}' with a negative output matcher step instead."
382
427
  last_command_started.stop
383
428
 
384
429
  if pass_fail == 'pass'
@@ -403,6 +448,9 @@ Then(/^it should (pass|fail) with:$/) do |pass_fail, expected|
403
448
  end
404
449
 
405
450
  Then(/^it should not (pass|fail) with exactly:$/) do |pass_fail, expected|
451
+ Aruba.platform.deprecated \
452
+ 'This cucumber step has confusing behavior and is deprecated.' \
453
+ "Use 'it should #{pass_fail}' with a negative output matcher step instead."
406
454
  last_command_started.stop
407
455
 
408
456
  if pass_fail == 'pass'
@@ -427,6 +475,9 @@ Then(/^it should (pass|fail) with exactly:$/) do |pass_fail, expected|
427
475
  end
428
476
 
429
477
  Then(/^it should not (pass|fail) (?:with regexp?|matching):$/) do |pass_fail, expected|
478
+ Aruba.platform.deprecated \
479
+ 'This cucumber step has confusing behavior and is deprecated.' \
480
+ "Use 'it should #{pass_fail}' with a negative output matcher step instead."
430
481
  last_command_started.stop
431
482
 
432
483
  if pass_fail == 'pass'
@@ -459,20 +510,18 @@ end
459
510
  Then(/^(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:$/) \
460
511
  do |channel, negated, table|
461
512
  table.raw.flatten.each do |expected|
462
- _matcher = case channel
463
- when 'output'; then :have_output
464
- when 'stderr'; then :have_output_on_stderr
465
- when 'stdout'; then :have_output_on_stdout
466
- end
467
-
468
- # TODO: This isn't actually using the above. It's hardcoded to use have_output only
513
+ matcher = case channel
514
+ when 'output'; then :have_output
515
+ when 'stderr'; then :have_output_on_stderr
516
+ when 'stdout'; then :have_output_on_stdout
517
+ end
469
518
 
470
519
  if negated
471
520
  expect(all_commands)
472
- .not_to include have_output an_output_string_including(expected)
521
+ .not_to include send(matcher, an_output_string_including(expected))
473
522
  else
474
523
  expect(all_commands)
475
- .to include have_output an_output_string_including(expected)
524
+ .to include send(matcher, an_output_string_including(expected))
476
525
  end
477
526
  end
478
527
  end
@@ -1,123 +1,219 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ #
3
4
  # Cucumber
5
+ #
6
+ # This defines the following steps:
7
+ #
8
+ # 1. Simple pass/not pass/fail
9
+ # 2. Pass/not pass/fail with a multiline string or regex
10
+ #
11
+ # For item 2, the 'not pass' variant is deprecated because the wording makes it
12
+ # unclear how the negation should be applied.
13
+ #
14
+ Then(/^the feature(?:s)? should fail$/) do
15
+ expect(all_output).to include_output_string ' failed)'
16
+ expect(last_command_stopped).to have_exit_status 1
17
+ end
18
+
4
19
  Then(/^the feature(?:s)? should not(?: all)? pass$/) do
5
- step 'the output should contain " failed)"'
6
- step 'the exit status should be 1'
20
+ expect(all_output).to include_output_string ' failed)'
21
+ expect(last_command_stopped).to have_exit_status 1
7
22
  end
8
23
 
9
- # Cucumber
10
24
  Then(/^the feature(?:s)? should(?: all)? pass$/) do
11
- step 'the output should not contain " failed)"'
12
- step 'the output should not contain " undefined)"'
13
- step 'the exit status should be 0'
25
+ expect(all_output).not_to include_output_string ' failed)'
26
+ expect(all_output).not_to include_output_string ' undefined)'
27
+ expect(last_command_stopped).to have_exit_status 0
28
+ end
29
+
30
+ Then(/^the feature(?:s)? should fail with( regex)?:$/) do |regex, string|
31
+ expect(all_output).to include_output_string ' failed)'
32
+ expect(last_command_stopped).to have_exit_status 1
33
+
34
+ if regex
35
+ expect(all_output).to match_output_string(string)
36
+ else
37
+ expect(all_output).to include_output_string(string)
38
+ end
14
39
  end
15
40
 
16
- # Cucumber
17
41
  Then(/^the feature(?:s)? should not(?: all)? pass with( regex)?:$/) do |regex, string|
18
- step 'the output should contain " failed)"'
19
- step 'the exit status should be 1'
42
+ Aruba.platform.deprecated \
43
+ 'This cucumber step has confusing wording and is deprecated.' \
44
+ "Use 'the feature(s) should fail with#{regex}:' instead."
45
+ expect(all_output).to include_output_string ' failed)'
46
+ expect(last_command_stopped).to have_exit_status 1
20
47
 
21
48
  if regex
22
- step "the output should match %r<#{string}>"
49
+ expect(all_output).to match_output_string(string)
23
50
  else
24
- step 'the output should contain:', string
51
+ expect(all_output).to include_output_string(string)
25
52
  end
26
53
  end
27
54
 
28
- # Cucumber
29
55
  Then(/^the feature(?:s)? should(?: all)? pass with( regex)?:$/) do |regex, string|
30
- step 'the output should not contain " failed)"'
31
- step 'the output should not contain " undefined)"'
32
- step 'the exit status should be 0'
56
+ expect(all_output).not_to include_output_string ' failed)'
57
+ expect(all_output).not_to include_output_string ' undefined)'
58
+ expect(last_command_stopped).to have_exit_status 0
33
59
 
34
60
  if regex
35
- step "the output should match %r<#{string}>"
61
+ expect(all_output).to match_output_string(string)
36
62
  else
37
- step 'the output should contain:', string
63
+ expect(all_output).to include_output_string(string)
38
64
  end
39
65
  end
40
66
 
67
+ #
41
68
  # RSpec
42
- Then(/^the spec(?:s)? should not(?: all)? pass(?: with (\d+) failures?)?$/) \
43
- do |count_failures|
44
- if count_failures.nil?
45
- step 'the output should not contain "0 failures"'
46
- else
47
- step %(the output should contain "#{count_failures} failures")
48
- end
69
+ #
70
+ # This defines the following steps:
71
+ #
72
+ # 1. Simple pass/not pass/fail
73
+ # 2. Not pass/fail with a failure count
74
+ # 3. Pass/not pass/fail with a multiline string or regex
75
+ #
76
+ # For items 2 and 3, the 'not pass' variant is deprecated because the wording
77
+ # makes it unclear how the negation should be applied.
78
+ #
79
+ Then(/^the spec(?:s)? should fail$/) do
80
+ expect(all_output).not_to include_output_string '0 failures'
81
+ expect(last_command_stopped).to have_exit_status 1
82
+ end
49
83
 
50
- step 'the exit status should be 1'
84
+ Then(/^the spec(?:s)? should not(?: all)? pass$/) do
85
+ expect(all_output).not_to include_output_string '0 failures'
86
+ expect(last_command_stopped).to have_exit_status 1
51
87
  end
52
88
 
53
- # RSpec
54
- Then(/^the spec(?:s)? should all pass$/) do
55
- step 'the output should contain "0 failures"'
56
- step 'the exit status should be 0'
89
+ Then(/^the spec(?:s)? should(?: all)? pass$/) do
90
+ expect(all_output).to include_output_string '0 failures'
91
+ expect(last_command_stopped).to have_exit_status 0
92
+ end
93
+
94
+ Then(/^the spec(?:s)? should fail with (\d+) failures?$/) do |count|
95
+ expect(all_output).to include_output_string "#{count} failures"
96
+
97
+ expect(last_command_stopped).to have_exit_status 1
98
+ end
99
+
100
+ Then(/^the spec(?:s)? should not(?: all)? pass with (\d+) failures?$/) do |count|
101
+ Aruba.platform.deprecated \
102
+ 'This rspec step has confusing wording and is deprecated.' \
103
+ "Use 'the spec(s) should fail with #{count} failures' instead."
104
+ expect(all_output).to include_output_string "#{count} failures"
105
+
106
+ expect(last_command_stopped).to have_exit_status 1
107
+ end
108
+
109
+ Then(/^the spec(?:s)? should fail with( regex)?:$/) do |regex, string|
110
+ expect(all_output).not_to include_output_string '0 failures'
111
+ expect(last_command_stopped).to have_exit_status 1
112
+
113
+ if regex
114
+ expect(all_output).to match_output_string(string)
115
+ else
116
+ expect(all_output).to include_output_string(string)
117
+ end
57
118
  end
58
119
 
59
- # RSpec
60
120
  Then(/^the spec(?:s)? should not(?: all)? pass with( regex)?:$/) do |regex, string|
61
- step 'the output should not contain "0 failures"'
62
- step 'the exit status should be 1'
121
+ Aruba.platform.deprecated \
122
+ 'This rspec step has confusing wording and is deprecated.' \
123
+ "Use 'the spec(s) should fail with#{regex}:' instead."
124
+ expect(all_output).not_to include_output_string '0 failures'
125
+ expect(last_command_stopped).to have_exit_status 1
63
126
 
64
127
  if regex
65
- step "the output should match %r<#{string}>"
128
+ expect(all_output).to match_output_string(string)
66
129
  else
67
- step 'the output should contain:', string
130
+ expect(all_output).to include_output_string(string)
68
131
  end
69
132
  end
70
133
 
71
- # RSpec
72
134
  Then(/^the spec(?:s)? should(?: all)? pass with( regex)?:$/) do |regex, string|
73
- step 'the output should contain "0 failures"'
74
- step 'the exit status should be 0'
135
+ expect(all_output).to include_output_string '0 failures'
136
+ expect(last_command_stopped).to have_exit_status 0
75
137
 
76
138
  if regex
77
- step "the output should match %r<#{string}>"
139
+ expect(all_output).to match_output_string(string)
78
140
  else
79
- step 'the output should contain:', string
141
+ expect(all_output).to include_output_string(string)
80
142
  end
81
143
  end
82
144
 
145
+ #
83
146
  # Minitest
84
- Then(/^the tests(?:s)? should not(?: all)? pass(?: with (\d+) failures?)?$/) \
85
- do |count_failures|
86
- if count_failures.nil?
87
- step 'the output should not contain "0 errors"'
88
- else
89
- step %(the output should contain "#{count_failures} errors")
90
- end
147
+ #
148
+ # This defines the following steps:
149
+ #
150
+ # 1. Simple pass/not pass/fail
151
+ # 2. Not pass/fail with a failure count
152
+ # 3. Pass/not pass/fail with a multiline string or regex
153
+ #
154
+ # For items 2 and 3, the 'not pass' variant is deprecated because the wording
155
+ # makes it unclear how the negation should be applied.
156
+ #
157
+ Then(/^the test(?:s)? should fail$/) do
158
+ expect(all_output).not_to include_output_string '0 errors'
159
+ expect(last_command_stopped).to have_exit_status 1
160
+ end
91
161
 
92
- step 'the exit status should be 1'
162
+ Then(/^the tests(?:s)? should not(?: all)? pass$/) do
163
+ expect(all_output).not_to include_output_string '0 errors'
164
+ expect(last_command_stopped).to have_exit_status 1
93
165
  end
94
166
 
95
- # Minitest
96
- Then(/^the tests(?:s)? should all pass$/) do
97
- step 'the output should contain "0 errors"'
98
- step 'the exit status should be 0'
167
+ Then(/^the tests(?:s)? should(?: all)? pass$/) do
168
+ expect(all_output).to include_output_string '0 errors'
169
+ expect(last_command_stopped).to have_exit_status 0
170
+ end
171
+
172
+ Then(/^the test(?:s)? should fail with (\d+) errors?$/) do |count|
173
+ expect(all_output).to include_output_string "#{count} errors"
174
+ expect(last_command_stopped).to have_exit_status 1
175
+ end
176
+
177
+ Then(/^the tests(?:s)? should not(?: all)? pass with (\d+) failures?$/) do |count|
178
+ Aruba.platform.deprecated \
179
+ 'This minitest step has confusing wording and is deprecated.' \
180
+ "Use 'the test(s) should fail #{count} errors' instead."
181
+ expect(all_output).to include_output_string "#{count} errors"
182
+ expect(last_command_stopped).to have_exit_status 1
183
+ end
184
+
185
+ Then(/^the test(?:s)? should fail with( regex)?:$/) do |regex, string|
186
+ expect(all_output).not_to include_output_string '0 errors'
187
+ expect(last_command_stopped).to have_exit_status 1
188
+
189
+ if regex
190
+ expect(all_output).to match_output_string(string)
191
+ else
192
+ expect(all_output).to include_output_string(string)
193
+ end
99
194
  end
100
195
 
101
- # Minitest
102
196
  Then(/^the test(?:s)? should not(?: all)? pass with( regex)?:$/) do |regex, string|
103
- step 'the output should contain "0 errors"'
104
- step 'the exit status should be 1'
197
+ Aruba.platform.deprecated \
198
+ 'This minitest step has confusing wording and is deprecated.' \
199
+ "Use 'the test(s) should fail with#{regex}:' instead."
200
+ expect(all_output).not_to include_output_string '0 errors'
201
+ expect(last_command_stopped).to have_exit_status 1
105
202
 
106
203
  if regex
107
- step "the output should match %r<#{string}>"
204
+ expect(all_output).to match_output_string(string)
108
205
  else
109
- step 'the output should contain:', string
206
+ expect(all_output).to include_output_string(string)
110
207
  end
111
208
  end
112
209
 
113
- # Minitest
114
210
  Then(/^the test(?:s)? should(?: all)? pass with( regex)?:$/) do |regex, string|
115
- step 'the output should not contain "0 errors"'
116
- step 'the exit status should be 0'
211
+ expect(all_output).not_to include_output_string '0 errors'
212
+ expect(last_command_stopped).to have_exit_status 0
117
213
 
118
214
  if regex
119
- step "the output should match %r<#{string}>"
215
+ expect(all_output).to match_output_string(string)
120
216
  else
121
- step 'the output should contain:', string
217
+ expect(all_output).to include_output_string(string)
122
218
  end
123
219
  end
@@ -26,9 +26,9 @@ module Aruba
26
26
  end
27
27
 
28
28
  content = if File.exist? file
29
- file_ends_with_carriage_return =
30
- File.open(file, 'r').readlines.last.match(/.*\n$/)
31
-
29
+ file_ends_with_carriage_return = File.open(file, 'r') do |f|
30
+ f.readlines.last.match(/.*\n$/)
31
+ end
32
32
  prefix = file_ends_with_carriage_return ? '' : "\n"
33
33
 
34
34
  %(#{prefix}gem 'aruba', '~> #{Aruba::VERSION}')
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'shellwords'
4
4
  require 'aruba/colorizer'
5
+ require 'aruba/platforms/simple_table'
5
6
 
6
7
  Aruba::Colorizer.coloring = false if !$stdout.tty? && !ENV.key?('AUTOTEST')
7
8
 
@@ -82,6 +83,10 @@ module Aruba
82
83
 
83
84
  private
84
85
 
86
+ def simple_table(hash, **opts)
87
+ SimpleTable.new(hash, **opts).to_s
88
+ end
89
+
85
90
  def after_init
86
91
  output_format :changed_configuration, proc { |n, v| format('# %s = %s', n, v) }
87
92
  output_format :changed_environment,
@@ -93,7 +98,7 @@ module Aruba
93
98
  output_format :full_environment,
94
99
  proc { |h|
95
100
  format("<<-ENVIRONMENT\n%s\nENVIRONMENT",
96
- Aruba.platform.simple_table(h))
101
+ simple_table(h))
97
102
  }
98
103
  output_format :modified_environment,
99
104
  proc { |n, v| format('$ export %s=%s', n, Shellwords.escape(v)) }
@@ -109,7 +114,7 @@ module Aruba
109
114
  output_format :command_filesystem_status,
110
115
  proc { |status|
111
116
  format("<<-COMMAND FILESYSTEM STATUS\n%s\nCOMMAND FILESYSTEM STATUS",
112
- Aruba.platform.simple_table(status.to_h, sort: false))
117
+ simple_table(status.to_h, sort: false))
113
118
  }
114
119
  end
115
120
 
@@ -6,21 +6,13 @@ module Aruba
6
6
  module Platforms
7
7
  # Generate simple table
8
8
  class SimpleTable
9
- private
10
-
11
- attr_reader :hash, :opts
12
-
13
- public
14
-
15
9
  # Create
16
10
  #
17
11
  # @param [Hash] hash
18
12
  # Input
19
- def initialize(hash, opts)
13
+ def initialize(hash, sort: true)
20
14
  @hash = hash
21
- @opts = {
22
- sort: true
23
- }.merge opts
15
+ @sort = sort
24
16
  end
25
17
 
26
18
  # Generate table
@@ -37,12 +29,16 @@ module Aruba
37
29
  format('# %-*s => %s', name_size, k, v)
38
30
  end
39
31
 
40
- if opts[:sort] == true
32
+ if sort
41
33
  rows.sort.join("\n")
42
34
  else
43
35
  rows.join("\n")
44
36
  end
45
37
  end
38
+
39
+ private
40
+
41
+ attr_reader :hash, :sort
46
42
  end
47
43
  end
48
44
  end
@@ -8,7 +8,6 @@ require 'aruba/aruba_logger'
8
8
  require 'aruba/aruba_path'
9
9
  require 'aruba/command_monitor'
10
10
 
11
- require 'aruba/platforms/simple_table'
12
11
  require 'aruba/platforms/unix_command_string'
13
12
  require 'aruba/platforms/unix_which'
14
13
  require 'aruba/platforms/determine_file_size'
@@ -221,11 +220,6 @@ module Aruba
221
220
  File.write(path, content)
222
221
  end
223
222
 
224
- # Transform hash to a string table which can be output on stderr/stdout
225
- def simple_table(hash, opts = {})
226
- SimpleTable.new(hash, opts).to_s
227
- end
228
-
229
223
  # Resolve path for command using the PATH-environment variable
230
224
  #
231
225
  # Mostly taken from here: https://github.com/djberg96/ptools
@@ -102,12 +102,11 @@ module Aruba
102
102
  @stderr.string
103
103
  end
104
104
 
105
- # Write strint to stdin
105
+ # Write strings to stdin
106
106
  #
107
- # @param [String] input
108
- # Write string to stdin in
109
- def write(input)
110
- @stdin.write input
107
+ # @param *input [Array<String>]
108
+ def write(*input)
109
+ @stdin.write(*input)
111
110
  end
112
111
 
113
112
  # Close io
@@ -232,10 +232,10 @@ module Aruba
232
232
  end
233
233
  end
234
234
 
235
- def write(input)
235
+ def write(*input)
236
236
  return if stopped?
237
237
 
238
- @process.stdin.write(input)
238
+ @process.stdin.write(*input)
239
239
  @process.stdin.flush
240
240
 
241
241
  self
data/lib/aruba/setup.rb CHANGED
@@ -16,7 +16,7 @@ module Aruba
16
16
  return if runtime.setup_already_done?
17
17
 
18
18
  working_directory(clobber)
19
- events
19
+ register_event_handlers
20
20
 
21
21
  runtime.setup_done
22
22
 
@@ -36,72 +36,57 @@ module Aruba
36
36
  Aruba.platform.chdir runtime.config.root_directory
37
37
  end
38
38
 
39
- def events
40
- runtime.event_bus.register(
41
- :command_started,
42
- proc do |event|
43
- runtime.announcer.announce(:command) { event.entity.commandline }
44
- runtime.announcer.announce(:timeout, 'exit') { event.entity.exit_timeout }
45
- runtime.announcer.announce(:timeout, 'io wait') { event.entity.io_wait_timeout }
46
- runtime.announcer
47
- .announce(:wait_time, 'startup wait time') { event.entity.startup_wait_time }
48
- runtime.announcer.announce(:full_environment) { event.entity.environment }
49
- end
50
- )
51
-
52
- runtime.event_bus.register(
53
- :command_started,
54
- proc do |event|
55
- runtime.command_monitor.register_command event.entity
56
- runtime.command_monitor.last_command_started = event.entity
57
- end
58
- )
59
-
60
- runtime.event_bus.register(
61
- :command_stopped,
62
- proc do |event|
63
- runtime.announcer.announce(:stdout) { event.entity.stdout }
64
- runtime.announcer.announce(:stderr) { event.entity.stderr }
65
- runtime.announcer.announce(:command_content) { event.entity.content }
66
- runtime.announcer
67
- .announce(:command_filesystem_status) { event.entity.filesystem_status }
68
- end
69
- )
70
-
71
- runtime.event_bus.register(
72
- :command_stopped,
73
- proc do |event|
74
- runtime.command_monitor.last_command_stopped = event.entity
75
- end
76
- )
77
-
78
- runtime.event_bus.register(
79
- %i[changed_environment_variable
80
- added_environment_variable
81
- deleted_environment_variable],
82
- proc do |event|
83
- runtime.announcer.announce :changed_environment,
84
- event.entity[:changed][:name],
85
- event.entity[:changed][:value]
86
- runtime.announcer.announce :environment,
87
- event.entity[:changed][:name],
88
- event.entity[:changed][:value]
89
- end
90
- )
91
-
92
- runtime.event_bus.register(
93
- :changed_working_directory,
94
- proc { |event| runtime.announcer.announce :directory, event.entity[:new] }
95
- )
96
-
97
- runtime.event_bus.register(
98
- :changed_configuration,
99
- proc { |event|
100
- runtime.announcer.announce :configuration,
101
- event.entity[:changed][:name],
102
- event.entity[:changed][:value]
103
- }
104
- )
39
+ def handle_command_started(event)
40
+ runtime.announcer.announce(:command) { event.entity.commandline }
41
+ runtime.announcer.announce(:timeout, 'exit') { event.entity.exit_timeout }
42
+ runtime.announcer.announce(:timeout, 'io wait') { event.entity.io_wait_timeout }
43
+ runtime.announcer
44
+ .announce(:wait_time, 'startup wait time') { event.entity.startup_wait_time }
45
+ runtime.announcer.announce(:full_environment) { event.entity.environment }
46
+
47
+ runtime.command_monitor.register_command event.entity
48
+ runtime.command_monitor.last_command_started = event.entity
49
+ end
50
+
51
+ def handle_command_stopped(event)
52
+ runtime.announcer.announce(:stdout) { event.entity.stdout }
53
+ runtime.announcer.announce(:stderr) { event.entity.stderr }
54
+ runtime.announcer.announce(:command_content) { event.entity.content }
55
+ runtime.announcer
56
+ .announce(:command_filesystem_status) { event.entity.filesystem_status }
57
+
58
+ runtime.command_monitor.last_command_stopped = event.entity
59
+ end
60
+
61
+ def handle_changed_environment_variable(event)
62
+ runtime.announcer.announce :changed_environment,
63
+ event.entity[:changed][:name],
64
+ event.entity[:changed][:value]
65
+ runtime.announcer.announce :environment,
66
+ event.entity[:changed][:name],
67
+ event.entity[:changed][:value]
68
+ end
69
+
70
+ def handle_changed_working_directory(event)
71
+ runtime.announcer.announce :directory, event.entity[:new]
72
+ end
73
+
74
+ def handle_changed_configuration(event)
75
+ runtime.announcer.announce :configuration,
76
+ event.entity[:changed][:name],
77
+ event.entity[:changed][:value]
78
+ end
79
+
80
+ def register_event_handlers
81
+ bus = runtime.event_bus
82
+ bus.register(:command_started) { handle_command_started _1 }
83
+ bus.register(:command_stopped) { handle_command_stopped _1 }
84
+ bus.register(%i[changed_environment_variable
85
+ added_environment_variable
86
+ deleted_environment_variable]) \
87
+ { handle_changed_environment_variable _1 }
88
+ bus.register(:changed_working_directory) { handle_changed_working_directory _1 }
89
+ bus.register(:changed_configuration) { handle_changed_configuration _1 }
105
90
  end
106
91
  end
107
92
  end
data/lib/aruba/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Aruba
4
- VERSION = '2.3.2'
4
+ VERSION = '2.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aruba
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aslak Hellesøy, Matt Wynne and other Aruba Contributors
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-09-13 00:00:00.000000000 Z
11
+ date: 2026-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.17'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '3.0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.17'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '3.0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: contracts
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -59,7 +53,7 @@ dependencies:
59
53
  version: '8.0'
60
54
  - - "<"
61
55
  - !ruby/object:Gem::Version
62
- version: '11.0'
56
+ version: '12.0'
63
57
  type: :runtime
64
58
  prerelease: false
65
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,7 +63,21 @@ dependencies:
69
63
  version: '8.0'
70
64
  - - "<"
71
65
  - !ruby/object:Gem::Version
72
- version: '11.0'
66
+ version: '12.0'
67
+ - !ruby/object:Gem::Dependency
68
+ name: irb
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '1.16'
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '1.16'
73
81
  - !ruby/object:Gem::Dependency
74
82
  name: rspec-expectations
75
83
  requirement: !ruby/object:Gem::Requirement
@@ -164,16 +172,22 @@ dependencies:
164
172
  name: minitest
165
173
  requirement: !ruby/object:Gem::Requirement
166
174
  requirements:
167
- - - "~>"
175
+ - - ">="
168
176
  - !ruby/object:Gem::Version
169
- version: '5.10'
177
+ version: '5.26'
178
+ - - "<"
179
+ - !ruby/object:Gem::Version
180
+ version: '7.0'
170
181
  type: :development
171
182
  prerelease: false
172
183
  version_requirements: !ruby/object:Gem::Requirement
173
184
  requirements:
174
- - - "~>"
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '5.26'
188
+ - - "<"
175
189
  - !ruby/object:Gem::Version
176
- version: '5.10'
190
+ version: '7.0'
177
191
  - !ruby/object:Gem::Dependency
178
192
  name: rake
179
193
  requirement: !ruby/object:Gem::Requirement
@@ -447,5 +461,5 @@ requirements: []
447
461
  rubygems_version: 3.4.20
448
462
  signing_key:
449
463
  specification_version: 4
450
- summary: aruba-2.3.2
464
+ summary: aruba-2.4.0
451
465
  test_files: []