aruba 1.1.2 → 2.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: 310ecfb205a45e39a9822c3d40272f5b1121eaa132ee597589c816b53b478ae2
4
- data.tar.gz: 664722acb2e5e82421f25b1a9be77720af6b191935bdc3e177ee4c962697f0fe
3
+ metadata.gz: 274e6609a41e03eb74e7fa94a41c6165f5db84e5cff6787c8793afdde8c56cef
4
+ data.tar.gz: 1252caf02a2a758f334ce58e8da97c21015e7477cfb8266695ae7b54b2db6e57
5
5
  SHA512:
6
- metadata.gz: ddc31e116d5d122e70e4cc95ad0596318ffcfb4955b02b54f64a3800ea6917c461ca0332108e586811931f31253e34cae5ca011f4a7094aa2686f724ff9141a4
7
- data.tar.gz: f63cd42a52b764686866d0a9070429830979136927270cd704d47ab7cd5533e656a7fc2b055cbee9d14e3dd8ed27a3ab7c8727a446bee89da9f88ec8e130735a
6
+ metadata.gz: afa76ddef7027ba2e46f5db09114a9430b520f970ef03a8fb4989ffd383abece8629f20e3ea0ca657037b9a68b1a7cb8fff383342fced0ea4841a204c6b4389d
7
+ data.tar.gz: c3c7ef6f78b7a67e8a8cb44edd7ca7c72ee5fda00601ceee4eceba5663fb782a575933949b89389242454cef176e6ca89579380943c98a363e76db54fde5ba2c
data/CHANGELOG.md CHANGED
@@ -6,7 +6,20 @@ 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
- ## [Unreleased]
9
+ ## [2.0.0] / 2021-07-26
10
+
11
+ Potentially breaking changes:
12
+
13
+ * Bump miminum cucumber version to 4 ([#814] by [mvz])
14
+ * Drop support for Ruby 2.4 ([#820] by [mvz])
15
+ * Remove deprecated ability to append to non-existent file ([#829] by [mvz])
16
+ * Make absolute file name warning an error ([#783] by [mvz])
17
+
18
+ Other changes
19
+
20
+ * Use Ruby's built-in windows platform detection ([#813] by [mvz])
21
+ * Update some step definitions to use Cucumber Expression syntax ([#822] by [mvz])
22
+ * Update cucumber dependency to allow use of cucumber 7 ([#828] by [dependabot])
10
23
 
11
24
  ## [1.1.2] / 2021-06-20
12
25
 
@@ -981,9 +994,29 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
981
994
 
982
995
  <!-- issues & pull requests -->
983
996
 
997
+ [#829]: https://github.com/cucumber/aruba/pull/829
998
+ [#828]: https://github.com/cucumber/aruba/pull/828
999
+ [#822]: https://github.com/cucumber/aruba/pull/822
1000
+ [#820]: https://github.com/cucumber/aruba/pull/820
1001
+ [#814]: https://github.com/cucumber/aruba/pull/814
1002
+ [#813]: https://github.com/cucumber/aruba/pull/813
984
1003
  [#810]: https://github.com/cucumber/aruba/pull/810
985
1004
  [#804]: https://github.com/cucumber/aruba/pull/804
986
1005
  [#801]: https://github.com/cucumber/aruba/pull/801
1006
+ [#783]: https://github.com/cucumber/aruba/pull/783
1007
+ [#781]: https://github.com/cucumber/aruba/pull/781
1008
+ [#780]: https://github.com/cucumber/aruba/pull/780
1009
+ [#772]: https://github.com/cucumber/aruba/pull/772
1010
+ [#771]: https://github.com/cucumber/aruba/pull/771
1011
+ [#769]: https://github.com/cucumber/aruba/pull/769
1012
+ [#767]: https://github.com/cucumber/aruba/pull/767
1013
+ [#766]: https://github.com/cucumber/aruba/pull/766
1014
+ [#763]: https://github.com/cucumber/aruba/pull/763
1015
+ [#751]: https://github.com/cucumber/aruba/pull/751
1016
+ [#750]: https://github.com/cucumber/aruba/pull/750
1017
+ [#748]: https://github.com/cucumber/aruba/pull/748
1018
+ [#738]: https://github.com/cucumber/aruba/pull/738
1019
+ [#737]: https://github.com/cucumber/aruba/pull/737
987
1020
  [#727]: https://github.com/cucumber/aruba/pull/727
988
1021
  [#725]: https://github.com/cucumber/aruba/pull/725
989
1022
  [#724]: https://github.com/cucumber/aruba/pull/724
@@ -1262,7 +1295,8 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
1262
1295
 
1263
1296
  <!-- Releases -->
1264
1297
 
1265
- [Unreleased]: https://github.com/cucumber/aruba/compare/v1.1.2...main
1298
+ [Unreleased]: https://github.com/cucumber/aruba/compare/v2.0.0...main
1299
+ [2.0.0]: https://github.com/cucumber/aruba/compare/v1.1.2...v2.0.0
1266
1300
  [1.1.2]: https://github.com/cucumber/aruba/compare/v1.1.1...v1.1.2
1267
1301
  [1.1.1]: https://github.com/cucumber/aruba/compare/v1.1.0...v1.1.1
1268
1302
  [1.1.0]: https://github.com/cucumber/aruba/compare/v1.0.4...v1.1.0
data/README.md CHANGED
@@ -1,11 +1,7 @@
1
1
  [![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/cucumber/aruba/main/LICENSE)
2
- [![Docs](https://img.shields.io/badge/cucumber.pro-aruba-3d10af.svg)](https://app.cucumber.pro/projects/aruba)
3
2
  [![Gem Version](https://badge.fury.io/rb/aruba.svg)](http://badge.fury.io/rb/aruba)
4
- [![Code Climate](https://codeclimate.com/github/cucumber/aruba.svg)](https://codeclimate.com/github/cucumber/aruba)
5
3
  [![Support](https://img.shields.io/badge/cucumber-support-orange.svg)](https://cucumber.io/support)
6
-
7
- [![Travis CI build status](https://travis-ci.org/cucumber/aruba.svg)](https://travis-ci.org/cucumber/aruba)
8
- [![Appveyor build status](https://ci.appveyor.com/api/projects/status/jfo2tkqhnrqqcivl?svg=true)](https://ci.appveyor.com/project/cucumberbdd/aruba)
4
+ [![Build Status](https://github.com/cucumber/aruba/actions/workflows/ruby.yml/badge.svg)](https://github.com/cucumber/aruba/actions/workflows/ruby.yml)
9
5
 
10
6
  ## Install
11
7
 
@@ -77,8 +73,8 @@ We try to comply with [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.
77
73
 
78
74
  ## Supported Ruby versions
79
75
 
80
- Aruba is supported on Ruby 2.4 and up, and tested against CRuby 2.4, 2.5, 2.6
81
- and 2.7, and JRuby 9.2.
76
+ Aruba is supported on Ruby 2.5 and up, and tested against CRuby 2.5, 2.6 and
77
+ 2.7, and JRuby 9.2.
82
78
 
83
79
  ## Supported operating systems
84
80
 
@@ -91,10 +87,10 @@ Please see the [CONTRIBUTING](CONTRIBUTING.md) file.
91
87
 
92
88
  ## Code branches
93
89
 
94
- Development takes place in the `main` branch and currently targets the 1.x
95
- releases. If necessary, maintenance of the old 0.14.x releases takes place in
96
- the `0-14-stable` branch. Stable branches will not be created until absolutely
97
- necessary.
90
+ Development takes place in the `main` branch and currently targets the 2.x
91
+ releases. If necessary, maintenance of the old 1.1.x releases will take place
92
+ in a `1-1-stable` branch, and of 0.14.x releases in the `0-14-stable` branch.
93
+ Stable branches will not be created until absolutely necessary.
98
94
 
99
95
  ## License
100
96
 
@@ -117,34 +117,36 @@ module Aruba
117
117
  #
118
118
  # @example Single file name
119
119
  #
120
- # # => <path>/tmp/aruba/file
121
120
  # expand_path('file')
121
+ # # => <path>/tmp/aruba/file
122
122
  #
123
123
  # @example Single Dot
124
124
  #
125
- # # => <path>/tmp/aruba
126
125
  # expand_path('.')
126
+ # # => <path>/tmp/aruba
127
127
  #
128
128
  # @example using home directory
129
129
  #
130
- # # => <path>/home/<name>/file
131
130
  # expand_path('~/file')
131
+ # # => <path>/home/<name>/file
132
132
  #
133
133
  # @example using fixtures directory
134
134
  #
135
- # # => <path>/test/fixtures/file
136
135
  # expand_path('%/file')
136
+ # # => <path>/test/fixtures/file
137
137
  #
138
- # @example Absolute directory
138
+ # @example Absolute directory (requires aruba.config.allow_absolute_paths
139
+ # to be set)
139
140
  #
140
- # # => /foo/bar
141
141
  # expand_path('/foo/bar')
142
+ # # => /foo/bar
142
143
  #
143
144
  def expand_path(file_name, dir_string = nil)
144
145
  unless file_name.is_a?(String) && !file_name.empty?
145
146
  message = "Filename #{file_name} needs to be a string." \
146
- " It cannot be nil or empty either. "\
147
- "Please use `expand_path('.')` if you want the current directory to be expanded."
147
+ " It cannot be nil or empty either."\
148
+ " Please use `expand_path('.')` if you want" \
149
+ " the current directory to be expanded."
148
150
 
149
151
  raise ArgumentError, message
150
152
  end
@@ -152,12 +154,12 @@ module Aruba
152
154
  unless Aruba.platform.directory? File.join(aruba.config.root_directory,
153
155
  aruba.config.working_directory)
154
156
  raise "Aruba's working directory does not exist." \
155
- " Maybe you forgot to run `setup_aruba` before using its API."
157
+ " Maybe you forgot to run `setup_aruba` before using its API."
156
158
  end
157
159
 
158
160
  prefix = file_name[0]
159
161
 
160
- if aruba.config.fixtures_path_prefix == prefix
162
+ if prefix == aruba.config.fixtures_path_prefix
161
163
  rest = file_name[2..-1]
162
164
  path = File.join(*[aruba.fixtures_directory, rest].compact)
163
165
  unless Aruba.platform.exist? path
@@ -189,11 +191,13 @@ module Aruba
189
191
  unless aruba.config.allow_absolute_paths
190
192
  caller_location = caller_locations(1, 1).first
191
193
  caller_file_line = "#{caller_location.path}:#{caller_location.lineno}"
192
- aruba.logger.warn \
194
+ message =
193
195
  "Aruba's `expand_path` method was called with an absolute path" \
194
196
  " at #{caller_file_line}, which is not recommended." \
197
+ " The path passed was '#{file_name}'." \
195
198
  " Change the call to pass a relative path or set "\
196
199
  "`config.allow_absolute_paths = true` to silence this warning"
200
+ raise UserError, message
197
201
  end
198
202
  file_name
199
203
  else
@@ -326,12 +326,6 @@ module Aruba
326
326
  def append_to_file(file_name, file_content)
327
327
  file_name = expand_path(file_name)
328
328
 
329
- unless File.exist? file_name
330
- Aruba.platform.deprecated("The ability to call #append_to_file with a file that" \
331
- " does not exist is deprecated and will be removed in" \
332
- " Aruba 2.0.")
333
- Aruba.platform.mkdir(File.dirname(file_name))
334
- end
335
329
  File.open(file_name, "a") { |f| f << file_content }
336
330
  end
337
331
 
@@ -2,6 +2,7 @@ require "aruba/version"
2
2
 
3
3
  require "aruba/api"
4
4
  require "aruba/cucumber/hooks"
5
+ require "aruba/cucumber/parameter_types"
5
6
  require "aruba/cucumber/command"
6
7
  require "aruba/cucumber/environment"
7
8
  require "aruba/cucumber/file"
@@ -32,108 +32,127 @@ When(/^I run `([^`]*)` in background$/) do |cmd|
32
32
  run_command(sanitize_text(cmd))
33
33
  end
34
34
 
35
- When(/^I type "([^"]*)"$/) do |input|
35
+ When "I type {string}" do |input|
36
36
  type(unescape_text(input))
37
37
  end
38
38
 
39
- When(/^I close the stdin stream$/) do
39
+ When "I close the stdin stream" do
40
40
  close_input
41
41
  end
42
42
 
43
- When(/^I pipe in (?:a|the) file(?: named)? "([^"]*)"$/) do |file|
43
+ When "I pipe in a/the file( named) {string}" do |file|
44
44
  pipe_in_file(file)
45
45
 
46
46
  close_input
47
47
  end
48
48
 
49
- When(/^I (terminate|stop) the command (?:"([^"]*)"|(?:started last))$/) do |signal, command|
50
- monitor = aruba.command_monitor
49
+ When "I stop the command started last" do
50
+ last_command_started.stop
51
+ end
51
52
 
52
- cmd = if command
53
- monitor.find(command)
54
- else
55
- last_command_started
56
- end
53
+ When "I stop the command {string}" do |command|
54
+ aruba.command_monitor.find(command).stop
55
+ end
57
56
 
58
- if signal == "terminate"
59
- cmd.terminate
60
- else
61
- cmd.stop
62
- end
57
+ When "I terminate the command started last" do
58
+ last_command_started.terminate
59
+ end
60
+
61
+ When "I terminate the command {string}" do |command|
62
+ aruba.command_monitor.find(command).terminate
63
63
  end
64
64
 
65
65
  When(/^I stop the command(?: started last)? if (output|stdout|stderr) contains:$/) \
66
66
  do |channel, expected|
67
- begin
68
- Timeout.timeout(aruba.config.exit_timeout) do
69
- loop do
70
- output = last_command_started.public_send channel.to_sym, wait_for_io: 0
71
67
 
72
- output = sanitize_text(output)
73
- expected = sanitize_text(expected)
68
+ Timeout.timeout(aruba.config.exit_timeout) do
69
+ loop do
70
+ output = last_command_started.public_send channel.to_sym, wait_for_io: 0
74
71
 
75
- if output.include? expected
76
- last_command_started.terminate
72
+ output = sanitize_text(output)
73
+ expected = sanitize_text(expected)
77
74
 
78
- break
79
- end
75
+ if output.include? expected
76
+ last_command_started.terminate
80
77
 
81
- sleep 0.1
78
+ break
82
79
  end
80
+
81
+ sleep 0.1
83
82
  end
84
- rescue ChildProcess::TimeoutError, Timeout::Error
85
- last_command_started.terminate
86
83
  end
84
+ rescue ChildProcess::TimeoutError, Timeout::Error
85
+ last_command_started.terminate
87
86
  end
88
87
 
89
- When(/^I wait for (?:output|stdout) to contain:$/) do |expected|
88
+ When "I wait for output/stdout to contain" do |expected|
90
89
  Timeout.timeout(aruba.config.exit_timeout) do
91
- begin
92
- expect(last_command_started).to have_output an_output_string_including(expected)
93
- rescue ExpectationError
94
- sleep 0.1
95
- retry
96
- end
90
+ expect(last_command_started).to have_output an_output_string_including(expected)
91
+ rescue ExpectationError
92
+ sleep 0.1
93
+ retry
97
94
  end
98
95
  end
99
96
 
100
- When(/^I wait for (?:output|stdout) to contain "([^"]*)"$/) do |expected|
97
+ When "I wait for output/stdout to contain {string}" do |expected|
101
98
  Timeout.timeout(aruba.config.exit_timeout) do
102
- begin
103
- expect(last_command_started).to have_output an_output_string_including(expected)
104
- rescue ExpectationError
105
- sleep 0.1
106
- retry
107
- end
99
+ expect(last_command_started).to have_output an_output_string_including(expected)
100
+ rescue ExpectationError
101
+ sleep 0.1
102
+ retry
108
103
  end
109
104
  end
110
105
 
111
- Then(/^the output should be (\d+) bytes long$/) do |size|
106
+ Then "the output should be {int} bytes long" do |size|
112
107
  expect(last_command_started.output).to have_output_size size.to_i
113
108
  end
114
109
 
115
110
  ## the stderr should contain "hello"
116
- Then(/^(?:the )?(output|stderr|stdout) should( not)? contain( exactly)? "([^"]*)"$/) \
117
- do |channel, negated, exactly, expected|
111
+ Then "(the ){channel} should contain {string}" do |channel, expected|
118
112
  combined_output = send("all_#{channel}")
119
113
 
120
- output_string_matcher = if exactly
121
- :an_output_string_being_eq
122
- else
123
- :an_output_string_including
124
- end
114
+ expect(combined_output).to include_output_string expected
115
+ end
125
116
 
126
- if negated
127
- expect(combined_output).not_to send(output_string_matcher, expected)
128
- else
129
- expect(combined_output).to send(output_string_matcher, expected)
130
- end
117
+ ## the stderr should not contain "hello"
118
+ Then "(the ){channel} should not contain {string}" do |channel, expected|
119
+ combined_output = send("all_#{channel}")
120
+
121
+ expect(combined_output).not_to include_output_string expected
122
+ end
123
+
124
+ ## the stderr should contain exactly "hello"
125
+ Then "(the ){channel} should contain exactly {string}" do |channel, expected|
126
+ combined_output = send("all_#{channel}")
127
+
128
+ expect(combined_output).to output_string_eq expected
129
+ end
130
+
131
+ ## the stderr should not contain exactly "hello"
132
+ Then "(the ){channel} should not contain exactly {string}" do |channel, expected|
133
+ combined_output = send("all_#{channel}")
134
+
135
+ expect(combined_output).not_to output_string_eq expected
131
136
  end
132
137
 
133
138
  ## the stderr from "echo -n 'Hello'" should contain "hello"
134
- Then(
135
- /^(?:the )?(output|stderr|stdout) from "([^"]*)" should contain( exactly)? "([^"]*)"$/
136
- ) do |channel, cmd, exactly, expected|
139
+ Then "(the ){channel} from {string} should contain {string}" do |channel, cmd, expected|
140
+ matcher = case channel
141
+ when "output"; then :have_output
142
+ when "stderr"; then :have_output_on_stderr
143
+ when "stdout"; then :have_output_on_stdout
144
+ end
145
+
146
+ command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
147
+
148
+ output_string_matcher = :an_output_string_including
149
+
150
+ expect(command).to send(matcher, send(output_string_matcher, expected))
151
+ end
152
+
153
+ ## the stderr from "echo -n 'Hello'" should contain exactly "hello"
154
+ Then "(the ){channel} from {string} should contain exactly {string}" \
155
+ do |channel, cmd, expected|
137
156
  matcher = case channel
138
157
  when "output"; then :have_output
139
158
  when "stderr"; then :have_output_on_stderr
@@ -142,19 +161,13 @@ Then(
142
161
 
143
162
  command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
144
163
 
145
- output_string_matcher = if exactly
146
- :an_output_string_being_eq
147
- else
148
- :an_output_string_including
149
- end
164
+ output_string_matcher = :an_output_string_being_eq
150
165
 
151
166
  expect(command).to send(matcher, send(output_string_matcher, expected))
152
167
  end
153
168
 
154
169
  ## the stderr from "echo -n 'Hello'" should not contain "hello"
155
- Then(
156
- /^(?:the )?(output|stderr|stdout) from "([^"]*)" should not contain( exactly)? "([^"]*)"$/
157
- ) do |channel, cmd, exactly, expected|
170
+ Then "(the ){channel} from {string} should not contain {string}" do |channel, cmd, expected|
158
171
  matcher = case channel
159
172
  when "output"; then :have_output
160
173
  when "stderr"; then :have_output_on_stderr
@@ -163,46 +176,72 @@ Then(
163
176
 
164
177
  command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
165
178
 
166
- output_string_matcher = if exactly
167
- :an_output_string_being_eq
168
- else
169
- :an_output_string_including
170
- end
179
+ output_string_matcher = :an_output_string_including
171
180
 
172
181
  expect(command).not_to send(matcher, send(output_string_matcher, expected))
173
182
  end
174
183
 
175
- ## the stderr should not contain exactly:
176
- Then(/^(?:the )?(output|stderr|stdout) should not contain( exactly)?:$/) \
177
- do |channel, exactly, expected|
184
+ ## the stderr from "echo -n 'Hello'" should not contain exactly "hello"
185
+ Then "(the ){channel} from {string} should not contain exactly {string}" \
186
+ do |channel, cmd, expected|
187
+ matcher = case channel
188
+ when "output"; then :have_output
189
+ when "stderr"; then :have_output_on_stderr
190
+ when "stdout"; then :have_output_on_stdout
191
+ end
192
+
193
+ command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
194
+
195
+ output_string_matcher = :an_output_string_being_eq
196
+
197
+ expect(command).not_to send(matcher, send(output_string_matcher, expected))
198
+ end
199
+
200
+ ## the stderr should contain:
201
+ Then "(the ){channel} should contain:" do |channel, expected|
178
202
  combined_output = send("all_#{channel}")
179
203
 
180
- output_string_matcher = if exactly
181
- :an_output_string_being_eq
182
- else
183
- :an_output_string_including
184
- end
204
+ expect(combined_output).to include_output_string(expected)
205
+ end
206
+
207
+ ## the stderr should not contain:
208
+ Then "(the ){channel} should not contain:" do |channel, expected|
209
+ combined_output = send("all_#{channel}")
185
210
 
186
- expect(combined_output).not_to send(output_string_matcher, expected)
211
+ expect(combined_output).not_to include_output_string(expected)
187
212
  end
188
213
 
189
214
  ## the stderr should contain exactly:
190
- Then(/^(?:the )?(output|stderr|stdout) should contain( exactly)?:$/) \
191
- do |channel, exactly, expected|
215
+ Then "(the ){channel} should contain exactly:" do |channel, expected|
216
+ combined_output = send("all_#{channel}")
217
+
218
+ expect(combined_output).to output_string_eq(expected)
219
+ end
220
+
221
+ ## the stderr should not contain exactly:
222
+ Then "(the ){channel} should not contain exactly:" do |channel, expected|
192
223
  combined_output = send("all_#{channel}")
193
224
 
194
- output_string_matcher = if exactly
195
- :an_output_string_being_eq
196
- else
197
- :an_output_string_including
198
- end
225
+ expect(combined_output).not_to output_string_eq(expected)
226
+ end
227
+
228
+ ## the stderr from "echo -n 'Hello'" should not contain:
229
+ Then "(the ){channel} from {string} should not contain:" do |channel, cmd, expected|
230
+ matcher = case channel
231
+ when "output"; then :have_output
232
+ when "stderr"; then :have_output_on_stderr
233
+ when "stdout"; then :have_output_on_stdout
234
+ end
235
+
236
+ command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
237
+
238
+ output_string_matcher = :an_output_string_including
199
239
 
200
- expect(combined_output).to send(output_string_matcher, expected)
240
+ expect(command).not_to send(matcher, send(output_string_matcher, expected))
201
241
  end
202
242
 
203
243
  ## the stderr from "echo -n 'Hello'" should not contain exactly:
204
- Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should not contain( exactly)?:$/) \
205
- do |channel, cmd, exactly, expected|
244
+ Then "(the ){channel} from {string} should not contain exactly:" do |channel, cmd, expected|
206
245
  matcher = case channel
207
246
  when "output"; then :have_output
208
247
  when "stderr"; then :have_output_on_stderr
@@ -211,18 +250,28 @@ Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should not contain( exactl
211
250
 
212
251
  command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
213
252
 
214
- output_string_matcher = if exactly
215
- :an_output_string_being_eq
216
- else
217
- :an_output_string_including
218
- end
253
+ output_string_matcher = :an_output_string_being_eq
219
254
 
220
255
  expect(command).not_to send(matcher, send(output_string_matcher, expected))
221
256
  end
222
257
 
258
+ ## the stderr from "echo -n 'Hello'" should contain:
259
+ Then "(the ){channel} from {string} should contain:" do |channel, cmd, expected|
260
+ matcher = case channel
261
+ when "output"; then :have_output
262
+ when "stderr"; then :have_output_on_stderr
263
+ when "stdout"; then :have_output_on_stdout
264
+ end
265
+
266
+ command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
267
+
268
+ output_string_matcher = :an_output_string_including
269
+
270
+ expect(command).to send(matcher, send(output_string_matcher, expected))
271
+ end
272
+
223
273
  ## the stderr from "echo -n 'Hello'" should contain exactly:
224
- Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should contain( exactly)?:$/) \
225
- do |channel, cmd, exactly, expected|
274
+ Then "(the ){channel} from {string} should contain exactly:" do |channel, cmd, expected|
226
275
  matcher = case channel
227
276
  when "output"; then :have_output
228
277
  when "stderr"; then :have_output_on_stderr
@@ -231,11 +280,7 @@ Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should contain( exactly)?:
231
280
 
232
281
  command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
233
282
 
234
- output_string_matcher = if exactly
235
- :an_output_string_being_eq
236
- else
237
- :an_output_string_including
238
- end
283
+ output_string_matcher = :an_output_string_being_eq
239
284
 
240
285
  expect(command).to send(matcher, send(output_string_matcher, expected))
241
286
  end
@@ -419,7 +464,7 @@ Given(/^the (?:default )?aruba exit timeout is ([\d.]+) seconds?$/) do |seconds|
419
464
  aruba.config.exit_timeout = seconds.to_f
420
465
  end
421
466
 
422
- Given(/^the (?:default )?aruba stop signal is "([^"]*)"$/) do |signal|
467
+ Given "the( default) aruba stop signal is {string}" do |signal|
423
468
  aruba.config.stop_signal = signal
424
469
  end
425
470
 
@@ -427,18 +472,17 @@ Given(/^I wait ([\d.]+) seconds? for (?:a|the) command to start up$/) do |second
427
472
  aruba.config.startup_wait_time = seconds.to_f
428
473
  end
429
474
 
430
- When(/^I send the signal "([^"]*)" to the command (?:"([^"]*)"|(?:started last))$/) \
431
- do |signal, command|
432
- if command
433
- cmd = all_commands.find { |c| c.commandline == command }
434
- raise ArgumentError, %(No command "#{command}" found) if cmd.nil?
475
+ When "I send the signal {string} to the command {string}" do |signal, command|
476
+ cmd = all_commands.find { |c| c.commandline == command }
477
+ raise ArgumentError, %(No command "#{command}" found) if cmd.nil?
435
478
 
436
- cmd.send_signal signal
437
- else
438
- last_command_started.send_signal signal
439
- end
479
+ cmd.send_signal signal
480
+ end
481
+
482
+ When "I send the signal {string} to the command started last" do |signal|
483
+ last_command_started.send_signal signal
440
484
  end
441
485
 
442
- Given(/^I look for executables in "(.*)" within the current directory$/) do |directory|
486
+ Given "I look for executables in {string} within the current directory" do |directory|
443
487
  prepend_environment_variable "PATH", expand_path(directory) + File::PATH_SEPARATOR
444
488
  end
@@ -0,0 +1 @@
1
+ ParameterType(name: "channel", regexp: "output|stderr|stdout", transformer: ->(name) { name })
@@ -150,7 +150,7 @@ module Aruba
150
150
  rescue StandardError => e
151
151
  types = @resolvers.map(&:supports).flatten.join(", ")
152
152
  message = "Transforming \"#{event_id}\" into an event class failed." \
153
- " Supported types are: #{types}. #{e.message}."
153
+ " Supported types are: #{types}. #{e.message}."
154
154
  raise EventNameResolveError, message, cause: e
155
155
  end
156
156
  end
@@ -31,7 +31,7 @@ module Aruba
31
31
  # @private
32
32
  class UnixPlatform
33
33
  def self.match?
34
- !Cucumber::WINDOWS
34
+ !Gem.win_platform?
35
35
  end
36
36
 
37
37
  def environment_variables
@@ -76,7 +76,7 @@ module Aruba
76
76
  end
77
77
 
78
78
  def self.upcase_env(env)
79
- env.each_with_object({}) { |(k, v), a| a[k.to_s.upcase] = v }
79
+ env.to_h.transform_keys { |k| k.to_s.upcase }
80
80
  end
81
81
 
82
82
  private
@@ -1,5 +1,3 @@
1
- require "cucumber/platform"
2
-
3
1
  require "aruba/platforms/unix_platform"
4
2
  require "aruba/platforms/windows_command_string"
5
3
  require "aruba/platforms/windows_environment_variables"
@@ -20,7 +18,7 @@ module Aruba
20
18
  # @private
21
19
  class WindowsPlatform < UnixPlatform
22
20
  def self.match?
23
- Cucumber::WINDOWS
21
+ Gem.win_platform?
24
22
  end
25
23
 
26
24
  # @see UnixPlatform#command_string
@@ -49,7 +49,7 @@ module Aruba
49
49
  file = File.join(dir, program)
50
50
  # Dir[] doesn't handle backslashes properly, so convert them. Also, if
51
51
  # the program name doesn't have an extension, try them all.
52
- file = file.tr('\\', "/")
52
+ file = file.tr("\\", "/")
53
53
 
54
54
  found = Dir[file].first
55
55
 
data/lib/aruba/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Aruba
2
- VERSION = "1.1.2".freeze
2
+ VERSION = "2.0.0".freeze
3
3
  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: 1.1.2
4
+ version: 2.0.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: 2021-06-20 00:00:00.000000000 Z
11
+ date: 2021-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,20 +76,20 @@ dependencies:
76
76
  requirements:
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: '2.4'
79
+ version: '4.0'
80
80
  - - "<"
81
81
  - !ruby/object:Gem::Version
82
- version: '7.0'
82
+ version: '8.0'
83
83
  type: :runtime
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '2.4'
89
+ version: '4.0'
90
90
  - - "<"
91
91
  - !ruby/object:Gem::Version
92
- version: '7.0'
92
+ version: '8.0'
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: rspec-expectations
95
95
  requirement: !ruby/object:Gem::Requirement
@@ -242,14 +242,14 @@ dependencies:
242
242
  requirements:
243
243
  - - "~>"
244
244
  - !ruby/object:Gem::Version
245
- version: 1.12.0
245
+ version: 1.18.0
246
246
  type: :development
247
247
  prerelease: false
248
248
  version_requirements: !ruby/object:Gem::Requirement
249
249
  requirements:
250
250
  - - "~>"
251
251
  - !ruby/object:Gem::Version
252
- version: 1.12.0
252
+ version: 1.18.0
253
253
  - !ruby/object:Gem::Dependency
254
254
  name: rubocop-packaging
255
255
  requirement: !ruby/object:Gem::Requirement
@@ -270,28 +270,28 @@ dependencies:
270
270
  requirements:
271
271
  - - "~>"
272
272
  - !ruby/object:Gem::Version
273
- version: 1.10.1
273
+ version: 1.11.3
274
274
  type: :development
275
275
  prerelease: false
276
276
  version_requirements: !ruby/object:Gem::Requirement
277
277
  requirements:
278
278
  - - "~>"
279
279
  - !ruby/object:Gem::Version
280
- version: 1.10.1
280
+ version: 1.11.3
281
281
  - !ruby/object:Gem::Dependency
282
282
  name: rubocop-rspec
283
283
  requirement: !ruby/object:Gem::Requirement
284
284
  requirements:
285
285
  - - "~>"
286
286
  - !ruby/object:Gem::Version
287
- version: 2.2.0
287
+ version: 2.4.0
288
288
  type: :development
289
289
  prerelease: false
290
290
  version_requirements: !ruby/object:Gem::Requirement
291
291
  requirements:
292
292
  - - "~>"
293
293
  - !ruby/object:Gem::Version
294
- version: 2.2.0
294
+ version: 2.4.0
295
295
  - !ruby/object:Gem::Dependency
296
296
  name: simplecov
297
297
  requirement: !ruby/object:Gem::Requirement
@@ -372,6 +372,7 @@ files:
372
372
  - lib/aruba/cucumber/environment.rb
373
373
  - lib/aruba/cucumber/file.rb
374
374
  - lib/aruba/cucumber/hooks.rb
375
+ - lib/aruba/cucumber/parameter_types.rb
375
376
  - lib/aruba/cucumber/testing_frameworks.rb
376
377
  - lib/aruba/errors.rb
377
378
  - lib/aruba/event_bus.rb
@@ -464,15 +465,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
464
465
  requirements:
465
466
  - - ">="
466
467
  - !ruby/object:Gem::Version
467
- version: '2.4'
468
+ version: '2.5'
468
469
  required_rubygems_version: !ruby/object:Gem::Requirement
469
470
  requirements:
470
471
  - - ">="
471
472
  - !ruby/object:Gem::Version
472
473
  version: '0'
473
474
  requirements: []
474
- rubygems_version: 3.2.15
475
+ rubygems_version: 3.2.22
475
476
  signing_key:
476
477
  specification_version: 4
477
- summary: aruba-1.1.2
478
+ summary: aruba-2.0.0
478
479
  test_files: []