aruba 1.0.4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +60 -2
  3. data/CONTRIBUTING.md +18 -22
  4. data/README.md +13 -18
  5. data/exe/aruba +2 -2
  6. data/lib/aruba.rb +1 -1
  7. data/lib/aruba/api.rb +11 -11
  8. data/lib/aruba/api/bundler.rb +2 -1
  9. data/lib/aruba/api/commands.rb +7 -7
  10. data/lib/aruba/api/core.rb +33 -29
  11. data/lib/aruba/api/environment.rb +2 -2
  12. data/lib/aruba/api/filesystem.rb +35 -14
  13. data/lib/aruba/api/text.rb +4 -4
  14. data/lib/aruba/aruba_path.rb +2 -2
  15. data/lib/aruba/basic_configuration.rb +11 -11
  16. data/lib/aruba/cli.rb +7 -7
  17. data/lib/aruba/command.rb +4 -4
  18. data/lib/aruba/config/jruby.rb +9 -9
  19. data/lib/aruba/config_wrapper.rb +2 -2
  20. data/lib/aruba/configuration.rb +14 -14
  21. data/lib/aruba/console.rb +11 -11
  22. data/lib/aruba/console/help.rb +5 -5
  23. data/lib/aruba/contracts/absolute_path.rb +1 -1
  24. data/lib/aruba/contracts/enum.rb +1 -1
  25. data/lib/aruba/contracts/is_power_of_two.rb +1 -1
  26. data/lib/aruba/contracts/relative_path.rb +1 -1
  27. data/lib/aruba/cucumber.rb +8 -7
  28. data/lib/aruba/cucumber/command.rb +187 -143
  29. data/lib/aruba/cucumber/environment.rb +7 -7
  30. data/lib/aruba/cucumber/file.rb +7 -3
  31. data/lib/aruba/cucumber/hooks.rb +29 -29
  32. data/lib/aruba/cucumber/parameter_types.rb +1 -0
  33. data/lib/aruba/cucumber/testing_frameworks.rb +18 -18
  34. data/lib/aruba/event_bus.rb +4 -4
  35. data/lib/aruba/event_bus/name_resolver.rb +5 -5
  36. data/lib/aruba/file_size.rb +1 -1
  37. data/lib/aruba/generators/script_file.rb +2 -2
  38. data/lib/aruba/in_config_wrapper.rb +1 -1
  39. data/lib/aruba/initializer.rb +10 -10
  40. data/lib/aruba/matchers/base/base_matcher.rb +1 -1
  41. data/lib/aruba/matchers/base/message_indenter.rb +1 -1
  42. data/lib/aruba/matchers/base/object_formatter.rb +2 -2
  43. data/lib/aruba/matchers/collection.rb +1 -1
  44. data/lib/aruba/matchers/collection/all.rb +1 -1
  45. data/lib/aruba/matchers/collection/include_an_object.rb +2 -2
  46. data/lib/aruba/matchers/command.rb +1 -1
  47. data/lib/aruba/matchers/command/be_successfully_executed.rb +4 -4
  48. data/lib/aruba/matchers/command/have_finished_in_time.rb +1 -1
  49. data/lib/aruba/matchers/command/have_output.rb +1 -1
  50. data/lib/aruba/matchers/directory.rb +1 -1
  51. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +2 -2
  52. data/lib/aruba/matchers/directory/have_sub_directory.rb +3 -3
  53. data/lib/aruba/matchers/environment.rb +1 -1
  54. data/lib/aruba/matchers/file.rb +1 -1
  55. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +1 -1
  56. data/lib/aruba/matchers/file/be_an_existing_executable.rb +2 -2
  57. data/lib/aruba/matchers/file/be_an_existing_file.rb +2 -2
  58. data/lib/aruba/matchers/file/have_file_content.rb +1 -1
  59. data/lib/aruba/matchers/file/have_file_size.rb +1 -1
  60. data/lib/aruba/matchers/file/have_same_file_content.rb +2 -2
  61. data/lib/aruba/matchers/path.rb +1 -1
  62. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +1 -1
  63. data/lib/aruba/matchers/path/be_an_absolute_path.rb +1 -1
  64. data/lib/aruba/matchers/path/be_an_existing_path.rb +1 -1
  65. data/lib/aruba/matchers/path/have_permissions.rb +2 -2
  66. data/lib/aruba/matchers/string.rb +1 -1
  67. data/lib/aruba/matchers/string/include_output_string.rb +1 -1
  68. data/lib/aruba/matchers/string/match_output_string.rb +1 -1
  69. data/lib/aruba/matchers/string/output_string_eq.rb +1 -1
  70. data/lib/aruba/platform.rb +2 -2
  71. data/lib/aruba/platforms/announcer.rb +14 -14
  72. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +1 -1
  73. data/lib/aruba/platforms/aruba_logger.rb +1 -1
  74. data/lib/aruba/platforms/command_monitor.rb +5 -5
  75. data/lib/aruba/platforms/determine_disk_usage.rb +1 -1
  76. data/lib/aruba/platforms/filesystem_status.rb +1 -1
  77. data/lib/aruba/platforms/simple_table.rb +1 -1
  78. data/lib/aruba/platforms/unix_command_string.rb +2 -2
  79. data/lib/aruba/platforms/unix_platform.rb +23 -23
  80. data/lib/aruba/platforms/unix_which.rb +1 -1
  81. data/lib/aruba/platforms/windows_command_string.rb +2 -2
  82. data/lib/aruba/platforms/windows_environment_variables.rb +2 -2
  83. data/lib/aruba/platforms/windows_platform.rb +6 -8
  84. data/lib/aruba/platforms/windows_which.rb +5 -5
  85. data/lib/aruba/processes/basic_process.rb +2 -2
  86. data/lib/aruba/processes/debug_process.rb +5 -5
  87. data/lib/aruba/processes/in_process.rb +7 -7
  88. data/lib/aruba/processes/spawn_process.rb +17 -22
  89. data/lib/aruba/rspec.rb +6 -6
  90. data/lib/aruba/runtime.rb +6 -6
  91. data/lib/aruba/setup.rb +3 -3
  92. data/lib/aruba/version.rb +1 -1
  93. metadata +75 -29
  94. data/lib/aruba/tasks/docker_helpers.rb +0 -156
@@ -1,4 +1,4 @@
1
- require 'aruba/platform'
1
+ require "aruba/platform"
2
2
 
3
3
  # Aruba
4
4
  module Aruba
@@ -1,4 +1,4 @@
1
- require 'contracts'
1
+ require "contracts"
2
2
 
3
3
  # Aruba
4
4
  module Aruba
@@ -1,4 +1,4 @@
1
- require 'aruba/aruba_path'
1
+ require "aruba/aruba_path"
2
2
 
3
3
  # Aruba
4
4
  module Aruba
@@ -1,4 +1,4 @@
1
- require 'aruba/platform'
1
+ require "aruba/platform"
2
2
 
3
3
  # Aruba
4
4
  module Aruba
@@ -1,8 +1,9 @@
1
- require 'aruba/version'
1
+ require "aruba/version"
2
2
 
3
- require 'aruba/api'
4
- require 'aruba/cucumber/hooks'
5
- require 'aruba/cucumber/command'
6
- require 'aruba/cucumber/environment'
7
- require 'aruba/cucumber/file'
8
- require 'aruba/cucumber/testing_frameworks'
3
+ require "aruba/api"
4
+ require "aruba/cucumber/hooks"
5
+ require "aruba/cucumber/parameter_types"
6
+ require "aruba/cucumber/command"
7
+ require "aruba/cucumber/environment"
8
+ require "aruba/cucumber/file"
9
+ require "aruba/cucumber/testing_frameworks"
@@ -1,4 +1,4 @@
1
- require 'aruba/generators/script_file'
1
+ require "aruba/generators/script_file"
2
2
 
3
3
  When(/^I run `([^`]*)`$/) do |cmd|
4
4
  cmd = sanitize_text(cmd)
@@ -14,9 +14,9 @@ end
14
14
 
15
15
  When(/^I run the following (?:commands|script)(?: (?:with|in) `([^`]+)`)?:$/) \
16
16
  do |shell, commands|
17
- full_path = expand_path('bin/myscript')
17
+ full_path = expand_path("bin/myscript")
18
18
 
19
- Aruba.platform.mkdir(expand_path('bin'))
19
+ Aruba.platform.mkdir(expand_path("bin"))
20
20
  shell ||= Aruba.platform.default_shell
21
21
 
22
22
  Aruba::ScriptFile.new(interpreter: shell, content: commands, path: full_path).call
@@ -32,210 +32,255 @@ 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|
137
140
  matcher = case channel
138
- when 'output'; then :have_output
139
- when 'stderr'; then :have_output_on_stderr
140
- when 'stdout'; then :have_output_on_stdout
141
+ when "output"; then :have_output
142
+ when "stderr"; then :have_output_on_stderr
143
+ when "stdout"; then :have_output_on_stdout
141
144
  end
142
145
 
143
146
  command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
144
147
 
145
- output_string_matcher = if exactly
146
- :an_output_string_being_eq
147
- else
148
- :an_output_string_including
149
- end
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|
156
+ matcher = case channel
157
+ when "output"; then :have_output
158
+ when "stderr"; then :have_output_on_stderr
159
+ when "stdout"; then :have_output_on_stdout
160
+ end
161
+
162
+ command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
163
+
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
- when 'output'; then :have_output
160
- when 'stderr'; then :have_output_on_stderr
161
- when 'stdout'; then :have_output_on_stdout
172
+ when "output"; then :have_output
173
+ when "stderr"; then :have_output_on_stderr
174
+ when "stdout"; then :have_output_on_stdout
162
175
  end
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
185
206
 
186
- expect(combined_output).not_to send(output_string_matcher, expected)
207
+ ## the stderr should not contain:
208
+ Then "(the ){channel} should not contain:" do |channel, expected|
209
+ combined_output = send("all_#{channel}")
210
+
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|
192
216
  combined_output = send("all_#{channel}")
193
217
 
194
- output_string_matcher = if exactly
195
- :an_output_string_being_eq
196
- else
197
- :an_output_string_including
198
- end
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|
223
+ combined_output = send("all_#{channel}")
224
+
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
- when 'output'; then :have_output
208
- when 'stderr'; then :have_output_on_stderr
209
- when 'stdout'; then :have_output_on_stdout
246
+ when "output"; then :have_output
247
+ when "stderr"; then :have_output_on_stderr
248
+ when "stdout"; then :have_output_on_stdout
210
249
  end
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
- when 'output'; then :have_output
228
- when 'stderr'; then :have_output_on_stderr
229
- when 'stdout'; then :have_output_on_stdout
276
+ when "output"; then :have_output
277
+ when "stderr"; then :have_output_on_stderr
278
+ when "stdout"; then :have_output_on_stdout
230
279
  end
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
@@ -287,7 +332,7 @@ end
287
332
  Then(/^it should not (pass|fail) with "(.*?)"$/) do |pass_fail, expected|
288
333
  last_command_started.stop
289
334
 
290
- if pass_fail == 'pass'
335
+ if pass_fail == "pass"
291
336
  expect(last_command_stopped).to be_successfully_executed
292
337
  else
293
338
  expect(last_command_stopped).not_to be_successfully_executed
@@ -299,7 +344,7 @@ end
299
344
  Then(/^it should (pass|fail) with "(.*?)"$/) do |pass_fail, expected|
300
345
  last_command_started.stop
301
346
 
302
- if pass_fail == 'pass'
347
+ if pass_fail == "pass"
303
348
  expect(last_command_stopped).to be_successfully_executed
304
349
  else
305
350
  expect(last_command_stopped).not_to be_successfully_executed
@@ -311,7 +356,7 @@ end
311
356
  Then(/^it should not (pass|fail) with:$/) do |pass_fail, expected|
312
357
  last_command_started.stop
313
358
 
314
- if pass_fail == 'pass'
359
+ if pass_fail == "pass"
315
360
  expect(last_command_stopped).to be_successfully_executed
316
361
  else
317
362
  expect(last_command_stopped).not_to be_successfully_executed
@@ -323,7 +368,7 @@ end
323
368
  Then(/^it should (pass|fail) with:$/) do |pass_fail, expected|
324
369
  last_command_started.stop
325
370
 
326
- if pass_fail == 'pass'
371
+ if pass_fail == "pass"
327
372
  expect(last_command_stopped).to be_successfully_executed
328
373
  else
329
374
  expect(last_command_stopped).not_to be_successfully_executed
@@ -335,7 +380,7 @@ end
335
380
  Then(/^it should not (pass|fail) with exactly:$/) do |pass_fail, expected|
336
381
  last_command_started.stop
337
382
 
338
- if pass_fail == 'pass'
383
+ if pass_fail == "pass"
339
384
  expect(last_command_stopped).to be_successfully_executed
340
385
  else
341
386
  expect(last_command_stopped).not_to be_successfully_executed
@@ -347,7 +392,7 @@ end
347
392
  Then(/^it should (pass|fail) with exactly:$/) do |pass_fail, expected|
348
393
  last_command_started.stop
349
394
 
350
- if pass_fail == 'pass'
395
+ if pass_fail == "pass"
351
396
  expect(last_command_stopped).to be_successfully_executed
352
397
  else
353
398
  expect(last_command_stopped).not_to be_successfully_executed
@@ -359,7 +404,7 @@ end
359
404
  Then(/^it should not (pass|fail) (?:with regexp?|matching):$/) do |pass_fail, expected|
360
405
  last_command_started.stop
361
406
 
362
- if pass_fail == 'pass'
407
+ if pass_fail == "pass"
363
408
  expect(last_command_stopped).to be_successfully_executed
364
409
  else
365
410
  expect(last_command_stopped).not_to be_successfully_executed
@@ -371,7 +416,7 @@ end
371
416
  Then(/^it should (pass|fail) (?:with regexp?|matching):$/) do |pass_fail, expected|
372
417
  last_command_started.stop
373
418
 
374
- if pass_fail == 'pass'
419
+ if pass_fail == "pass"
375
420
  expect(last_command_stopped).to be_successfully_executed
376
421
  else
377
422
  expect(last_command_stopped).not_to be_successfully_executed
@@ -382,9 +427,9 @@ end
382
427
 
383
428
  Then(/^(?:the )?(output|stderr|stdout) should not contain anything$/) do |channel|
384
429
  matcher = case channel
385
- when 'output'; then :have_output
386
- when 'stderr'; then :have_output_on_stderr
387
- when 'stdout'; then :have_output_on_stdout
430
+ when "output"; then :have_output
431
+ when "stderr"; then :have_output_on_stderr
432
+ when "stdout"; then :have_output_on_stdout
388
433
  end
389
434
 
390
435
  expect(all_commands).to include_an_object send(matcher, be_nil.or(be_empty))
@@ -394,9 +439,9 @@ Then(/^(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:
394
439
  do |channel, negated, table|
395
440
  table.raw.flatten.each do |expected|
396
441
  _matcher = case channel
397
- when 'output'; then :have_output
398
- when 'stderr'; then :have_output_on_stderr
399
- when 'stdout'; then :have_output_on_stdout
442
+ when "output"; then :have_output
443
+ when "stderr"; then :have_output_on_stderr
444
+ when "stdout"; then :have_output_on_stdout
400
445
  end
401
446
 
402
447
  # TODO: This isn't actually using the above. It's hardcoded to use have_output only
@@ -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|
443
- prepend_environment_variable 'PATH', expand_path(directory) + File::PATH_SEPARATOR
486
+ Given "I look for executables in {string} within the current directory" do |directory|
487
+ prepend_environment_variable "PATH", expand_path(directory) + File::PATH_SEPARATOR
444
488
  end