aruba 1.1.1 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +61 -3
  3. data/CONTRIBUTING.md +9 -2
  4. data/README.md +21 -18
  5. data/lib/aruba/api/bundler.rb +1 -0
  6. data/lib/aruba/api/commands.rb +0 -2
  7. data/lib/aruba/api/core.rb +15 -11
  8. data/lib/aruba/api/filesystem.rb +1 -7
  9. data/lib/aruba/api/text.rb +0 -12
  10. data/lib/aruba/console.rb +1 -1
  11. data/lib/aruba/contracts/enum.rb +1 -0
  12. data/lib/aruba/cucumber/command.rb +175 -119
  13. data/lib/aruba/cucumber/file.rb +2 -2
  14. data/lib/aruba/cucumber/parameter_types.rb +1 -0
  15. data/lib/aruba/cucumber.rb +1 -0
  16. data/lib/aruba/event_bus/name_resolver.rb +1 -1
  17. data/lib/aruba/matchers/command/be_successfully_executed.rb +0 -2
  18. data/lib/aruba/matchers/command/have_exit_status.rb +7 -13
  19. data/lib/aruba/matchers/command/have_finished_in_time.rb +0 -2
  20. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +0 -2
  21. data/lib/aruba/matchers/directory/have_sub_directory.rb +0 -2
  22. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +0 -2
  23. data/lib/aruba/matchers/file/be_an_existing_executable.rb +0 -1
  24. data/lib/aruba/matchers/file/be_an_existing_file.rb +0 -2
  25. data/lib/aruba/matchers/file/have_file_content.rb +0 -2
  26. data/lib/aruba/matchers/file/have_file_size.rb +0 -2
  27. data/lib/aruba/matchers/file/have_same_file_content.rb +0 -1
  28. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +0 -2
  29. data/lib/aruba/matchers/path/be_an_absolute_path.rb +0 -2
  30. data/lib/aruba/matchers/path/be_an_existing_path.rb +0 -2
  31. data/lib/aruba/matchers/path/have_permissions.rb +0 -2
  32. data/lib/aruba/platform.rb +2 -2
  33. data/lib/aruba/platforms/announcer.rb +0 -2
  34. data/lib/aruba/platforms/command_monitor.rb +2 -2
  35. data/lib/aruba/platforms/unix_environment_variables.rb +0 -2
  36. data/lib/aruba/platforms/unix_platform.rb +2 -1
  37. data/lib/aruba/platforms/windows_environment_variables.rb +1 -1
  38. data/lib/aruba/platforms/windows_platform.rb +1 -3
  39. data/lib/aruba/platforms/windows_which.rb +1 -1
  40. data/lib/aruba/processes/basic_process.rb +4 -0
  41. data/lib/aruba/version.rb +1 -1
  42. metadata +82 -26
  43. data/lib/aruba/matchers/base/base_matcher.rb +0 -87
  44. data/lib/aruba/matchers/base/object_formatter.rb +0 -104
  45. data/lib/aruba/matchers/collection/all.rb +0 -11
  46. data/lib/aruba/matchers/collection/include_an_object.rb +0 -120
  47. data/lib/aruba/matchers/collection.rb +0 -1
@@ -32,108 +32,139 @@ 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
90
+ loop do
91
+ output = last_command_started.public_send :stdout, wait_for_io: 0
92
+
93
+ output = sanitize_text(output)
94
+ expected = sanitize_text(expected)
95
+
96
+ break if output.include? expected
97
+
94
98
  sleep 0.1
95
- retry
96
99
  end
97
100
  end
98
101
  end
99
102
 
100
- When(/^I wait for (?:output|stdout) to contain "([^"]*)"$/) do |expected|
103
+ When "I wait for output/stdout to contain {string}" do |expected|
101
104
  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
+ loop do
106
+ output = last_command_started.public_send :stdout, wait_for_io: 0
107
+
108
+ output = sanitize_text(output)
109
+ expected = sanitize_text(expected)
110
+
111
+ break if output.include? expected
112
+
105
113
  sleep 0.1
106
- retry
107
114
  end
108
115
  end
109
116
  end
110
117
 
111
- Then(/^the output should be (\d+) bytes long$/) do |size|
118
+ Then "the output should be {int} bytes long" do |size|
112
119
  expect(last_command_started.output).to have_output_size size.to_i
113
120
  end
114
121
 
115
122
  ## the stderr should contain "hello"
116
- Then(/^(?:the )?(output|stderr|stdout) should( not)? contain( exactly)? "([^"]*)"$/) \
117
- do |channel, negated, exactly, expected|
123
+ Then "(the ){channel} should contain {string}" do |channel, expected|
118
124
  combined_output = send("all_#{channel}")
119
125
 
120
- output_string_matcher = if exactly
121
- :an_output_string_being_eq
122
- else
123
- :an_output_string_including
124
- end
126
+ expect(combined_output).to include_output_string expected
127
+ end
125
128
 
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
129
+ ## the stderr should not contain "hello"
130
+ Then "(the ){channel} should not contain {string}" do |channel, expected|
131
+ combined_output = send("all_#{channel}")
132
+
133
+ expect(combined_output).not_to include_output_string expected
134
+ end
135
+
136
+ ## the stderr should contain exactly "hello"
137
+ Then "(the ){channel} should contain exactly {string}" do |channel, expected|
138
+ combined_output = send("all_#{channel}")
139
+
140
+ expect(combined_output).to output_string_eq expected
141
+ end
142
+
143
+ ## the stderr should not contain exactly "hello"
144
+ Then "(the ){channel} should not contain exactly {string}" do |channel, expected|
145
+ combined_output = send("all_#{channel}")
146
+
147
+ expect(combined_output).not_to output_string_eq expected
131
148
  end
132
149
 
133
150
  ## 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|
151
+ Then "(the ){channel} from {string} should contain {string}" do |channel, cmd, expected|
152
+ matcher = case channel
153
+ when "output"; then :have_output
154
+ when "stderr"; then :have_output_on_stderr
155
+ when "stdout"; then :have_output_on_stdout
156
+ end
157
+
158
+ command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
159
+
160
+ output_string_matcher = :an_output_string_including
161
+
162
+ expect(command).to send(matcher, send(output_string_matcher, expected))
163
+ end
164
+
165
+ ## the stderr from "echo -n 'Hello'" should contain exactly "hello"
166
+ Then "(the ){channel} from {string} should contain exactly {string}" \
167
+ do |channel, cmd, expected|
137
168
  matcher = case channel
138
169
  when "output"; then :have_output
139
170
  when "stderr"; then :have_output_on_stderr
@@ -142,19 +173,13 @@ Then(
142
173
 
143
174
  command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
144
175
 
145
- output_string_matcher = if exactly
146
- :an_output_string_being_eq
147
- else
148
- :an_output_string_including
149
- end
176
+ output_string_matcher = :an_output_string_being_eq
150
177
 
151
178
  expect(command).to send(matcher, send(output_string_matcher, expected))
152
179
  end
153
180
 
154
181
  ## 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|
182
+ Then "(the ){channel} from {string} should not contain {string}" do |channel, cmd, expected|
158
183
  matcher = case channel
159
184
  when "output"; then :have_output
160
185
  when "stderr"; then :have_output_on_stderr
@@ -163,46 +188,72 @@ Then(
163
188
 
164
189
  command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
165
190
 
166
- output_string_matcher = if exactly
167
- :an_output_string_being_eq
168
- else
169
- :an_output_string_including
170
- end
191
+ output_string_matcher = :an_output_string_including
171
192
 
172
193
  expect(command).not_to send(matcher, send(output_string_matcher, expected))
173
194
  end
174
195
 
175
- ## the stderr should not contain exactly:
176
- Then(/^(?:the )?(output|stderr|stdout) should not contain( exactly)?:$/) \
177
- do |channel, exactly, expected|
196
+ ## the stderr from "echo -n 'Hello'" should not contain exactly "hello"
197
+ Then "(the ){channel} from {string} should not contain exactly {string}" \
198
+ do |channel, cmd, expected|
199
+ matcher = case channel
200
+ when "output"; then :have_output
201
+ when "stderr"; then :have_output_on_stderr
202
+ when "stdout"; then :have_output_on_stdout
203
+ end
204
+
205
+ command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
206
+
207
+ output_string_matcher = :an_output_string_being_eq
208
+
209
+ expect(command).not_to send(matcher, send(output_string_matcher, expected))
210
+ end
211
+
212
+ ## the stderr should contain:
213
+ Then "(the ){channel} should contain:" do |channel, expected|
178
214
  combined_output = send("all_#{channel}")
179
215
 
180
- output_string_matcher = if exactly
181
- :an_output_string_being_eq
182
- else
183
- :an_output_string_including
184
- end
216
+ expect(combined_output).to include_output_string(expected)
217
+ end
185
218
 
186
- expect(combined_output).not_to send(output_string_matcher, expected)
219
+ ## the stderr should not contain:
220
+ Then "(the ){channel} should not contain:" do |channel, expected|
221
+ combined_output = send("all_#{channel}")
222
+
223
+ expect(combined_output).not_to include_output_string(expected)
187
224
  end
188
225
 
189
226
  ## the stderr should contain exactly:
190
- Then(/^(?:the )?(output|stderr|stdout) should contain( exactly)?:$/) \
191
- do |channel, exactly, expected|
227
+ Then "(the ){channel} should contain exactly:" do |channel, expected|
192
228
  combined_output = send("all_#{channel}")
193
229
 
194
- output_string_matcher = if exactly
195
- :an_output_string_being_eq
196
- else
197
- :an_output_string_including
198
- end
230
+ expect(combined_output).to output_string_eq(expected)
231
+ end
232
+
233
+ ## the stderr should not contain exactly:
234
+ Then "(the ){channel} should not contain exactly:" do |channel, expected|
235
+ combined_output = send("all_#{channel}")
199
236
 
200
- expect(combined_output).to send(output_string_matcher, expected)
237
+ expect(combined_output).not_to output_string_eq(expected)
238
+ end
239
+
240
+ ## the stderr from "echo -n 'Hello'" should not contain:
241
+ Then "(the ){channel} from {string} should not contain:" do |channel, cmd, expected|
242
+ matcher = case channel
243
+ when "output"; then :have_output
244
+ when "stderr"; then :have_output_on_stderr
245
+ when "stdout"; then :have_output_on_stdout
246
+ end
247
+
248
+ command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
249
+
250
+ output_string_matcher = :an_output_string_including
251
+
252
+ expect(command).not_to send(matcher, send(output_string_matcher, expected))
201
253
  end
202
254
 
203
255
  ## 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|
256
+ Then "(the ){channel} from {string} should not contain exactly:" do |channel, cmd, expected|
206
257
  matcher = case channel
207
258
  when "output"; then :have_output
208
259
  when "stderr"; then :have_output_on_stderr
@@ -211,18 +262,28 @@ Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should not contain( exactl
211
262
 
212
263
  command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
213
264
 
214
- output_string_matcher = if exactly
215
- :an_output_string_being_eq
216
- else
217
- :an_output_string_including
218
- end
265
+ output_string_matcher = :an_output_string_being_eq
219
266
 
220
267
  expect(command).not_to send(matcher, send(output_string_matcher, expected))
221
268
  end
222
269
 
270
+ ## the stderr from "echo -n 'Hello'" should contain:
271
+ Then "(the ){channel} from {string} should contain:" do |channel, cmd, expected|
272
+ matcher = case channel
273
+ when "output"; then :have_output
274
+ when "stderr"; then :have_output_on_stderr
275
+ when "stdout"; then :have_output_on_stdout
276
+ end
277
+
278
+ command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
279
+
280
+ output_string_matcher = :an_output_string_including
281
+
282
+ expect(command).to send(matcher, send(output_string_matcher, expected))
283
+ end
284
+
223
285
  ## 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|
286
+ Then "(the ){channel} from {string} should contain exactly:" do |channel, cmd, expected|
226
287
  matcher = case channel
227
288
  when "output"; then :have_output
228
289
  when "stderr"; then :have_output_on_stderr
@@ -231,11 +292,7 @@ Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should contain( exactly)?:
231
292
 
232
293
  command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
233
294
 
234
- output_string_matcher = if exactly
235
- :an_output_string_being_eq
236
- else
237
- :an_output_string_including
238
- end
295
+ output_string_matcher = :an_output_string_being_eq
239
296
 
240
297
  expect(command).to send(matcher, send(output_string_matcher, expected))
241
298
  end
@@ -247,35 +304,35 @@ end
247
304
  Then(%r{^the output should( not)? match /([^/]*)/$}) do |negated, expected|
248
305
  if negated
249
306
  expect(all_commands)
250
- .not_to include_an_object have_output an_output_string_matching(expected)
307
+ .not_to include have_output an_output_string_matching(expected)
251
308
  else
252
309
  expect(all_commands)
253
- .to include_an_object have_output an_output_string_matching(expected)
310
+ .to include have_output an_output_string_matching(expected)
254
311
  end
255
312
  end
256
313
 
257
314
  Then(/^the output should( not)? match %r<([^>]*)>$/) do |negated, expected|
258
315
  if negated
259
316
  expect(all_commands)
260
- .not_to include_an_object have_output an_output_string_matching(expected)
317
+ .not_to include have_output an_output_string_matching(expected)
261
318
  else
262
319
  expect(all_commands)
263
- .to include_an_object have_output an_output_string_matching(expected)
320
+ .to include have_output an_output_string_matching(expected)
264
321
  end
265
322
  end
266
323
 
267
324
  Then(/^the output should( not)? match:$/) do |negated, expected|
268
325
  if negated
269
326
  expect(all_commands)
270
- .not_to include_an_object have_output an_output_string_matching(expected)
327
+ .not_to include have_output an_output_string_matching(expected)
271
328
  else
272
329
  expect(all_commands)
273
- .to include_an_object have_output an_output_string_matching(expected)
330
+ .to include have_output an_output_string_matching(expected)
274
331
  end
275
332
  end
276
333
 
277
334
  Then(/^the exit status should( not)? be (\d+)$/) do |negated, exit_status|
278
- last_command_started.stop if last_command_stopped.nil?
335
+ last_command_started.stop if last_command_stopped.empty?
279
336
 
280
337
  if negated
281
338
  expect(last_command_stopped).not_to have_exit_status exit_status.to_i
@@ -387,7 +444,7 @@ Then(/^(?:the )?(output|stderr|stdout) should not contain anything$/) do |channe
387
444
  when "stdout"; then :have_output_on_stdout
388
445
  end
389
446
 
390
- expect(all_commands).to include_an_object send(matcher, be_nil.or(be_empty))
447
+ expect(all_commands).to include send(matcher, be_nil.or(be_empty))
391
448
  end
392
449
 
393
450
  Then(/^(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:$/) \
@@ -403,10 +460,10 @@ Then(/^(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:
403
460
 
404
461
  if negated
405
462
  expect(all_commands)
406
- .not_to include_an_object have_output an_output_string_including(expected)
463
+ .not_to include have_output an_output_string_including(expected)
407
464
  else
408
465
  expect(all_commands)
409
- .to include_an_object have_output an_output_string_including(expected)
466
+ .to include have_output an_output_string_including(expected)
410
467
  end
411
468
  end
412
469
  end
@@ -419,7 +476,7 @@ Given(/^the (?:default )?aruba exit timeout is ([\d.]+) seconds?$/) do |seconds|
419
476
  aruba.config.exit_timeout = seconds.to_f
420
477
  end
421
478
 
422
- Given(/^the (?:default )?aruba stop signal is "([^"]*)"$/) do |signal|
479
+ Given "the( default) aruba stop signal is {string}" do |signal|
423
480
  aruba.config.stop_signal = signal
424
481
  end
425
482
 
@@ -427,18 +484,17 @@ Given(/^I wait ([\d.]+) seconds? for (?:a|the) command to start up$/) do |second
427
484
  aruba.config.startup_wait_time = seconds.to_f
428
485
  end
429
486
 
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?
487
+ When "I send the signal {string} to the command {string}" do |signal, command|
488
+ cmd = all_commands.find { |c| c.commandline == command }
489
+ raise ArgumentError, %(No command "#{command}" found) if cmd.nil?
435
490
 
436
- cmd.send_signal signal
437
- else
438
- last_command_started.send_signal signal
439
- end
491
+ cmd.send_signal signal
492
+ end
493
+
494
+ When "I send the signal {string} to the command started last" do |signal|
495
+ last_command_started.send_signal signal
440
496
  end
441
497
 
442
- Given(/^I look for executables in "(.*)" within the current directory$/) do |directory|
498
+ Given "I look for executables in {string} within the current directory" do |directory|
443
499
  prepend_environment_variable "PATH", expand_path(directory) + File::PATH_SEPARATOR
444
500
  end
@@ -95,7 +95,7 @@ Then(/^the following files should (not )?exist:$/) do |negated, files|
95
95
  if negated
96
96
  expect(files).not_to include an_existing_file
97
97
  else
98
- expect(files).to Aruba::Matchers.all be_an_existing_file
98
+ expect(files).to all be_an_existing_file
99
99
  end
100
100
  end
101
101
 
@@ -140,7 +140,7 @@ Then(/^the following directories should (not )?exist:$/) do |negated, directorie
140
140
  if negated
141
141
  expect(directories).not_to include an_existing_directory
142
142
  else
143
- expect(directories).to Aruba::Matchers.all be_an_existing_directory
143
+ expect(directories).to all be_an_existing_directory
144
144
  end
145
145
  end
146
146
 
@@ -0,0 +1 @@
1
+ ParameterType(name: "channel", regexp: "output|stderr|stdout", transformer: ->(name) { name })
@@ -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"
@@ -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
@@ -1,5 +1,3 @@
1
- require "rspec/expectations/version"
2
-
3
1
  require "aruba/matchers/command/have_exit_status"
4
2
  require "aruba/matchers/command/have_finished_in_time"
5
3
 
@@ -18,33 +18,27 @@
18
18
  # end
19
19
  RSpec::Matchers.define :have_exit_status do |expected|
20
20
  match do |actual|
21
- @old_actual = actual
21
+ actual.stop
22
+ @actual_exit_status = actual.exit_status
22
23
 
23
- @old_actual.stop
24
- @actual = actual.exit_status
25
-
26
- unless @old_actual.respond_to? :exit_status
27
- raise "Expected #{@old_actual} to respond to #exit_status"
28
- end
29
-
30
- values_match? expected, @actual
24
+ values_match? expected, @actual_exit_status
31
25
  end
32
26
 
33
27
  failure_message do |actual|
34
28
  format(
35
29
  %(expected that command "%s" has exit status of "%s", but has "%s".),
36
- @old_actual.commandline,
30
+ actual.commandline,
37
31
  expected.to_s,
38
- actual.to_s
32
+ @actual_exit_status.to_s
39
33
  )
40
34
  end
41
35
 
42
36
  failure_message_when_negated do |actual|
43
37
  format(
44
38
  %(expected that command "%s" does not have exit status of "%s", but has "%s".),
45
- @old_actual.commandline,
39
+ actual.commandline,
46
40
  expected.to_s,
47
- actual.to_s
41
+ @actual_exit_status.to_s
48
42
  )
49
43
  end
50
44
  end
@@ -1,5 +1,3 @@
1
- require "rspec/expectations/version"
2
-
3
1
  # @!method run_too_long
4
2
  # This matchers checks if <command> run too long. Say the timeout is 10
5
3
  # seconds and it takes <command> to finish in 15. This matchers will succeed.
@@ -1,5 +1,3 @@
1
- require "rspec/expectations/version"
2
-
3
1
  # @!method be_an_existing_directory
4
2
  # This matchers checks if <directory> exists in filesystem
5
3
  #
@@ -1,5 +1,3 @@
1
- require "rspec/expectations/version"
2
-
3
1
  # @!method have_sub_directory(sub_directory)
4
2
  # This matchers checks if <directory> has given sub-directory
5
3
  #
@@ -1,5 +1,3 @@
1
- require "rspec/expectations/version"
2
-
3
1
  # @!method be_a_command_found_in_path
4
2
  # This matchers checks if <command> can be found in path
5
3
  #
@@ -1,4 +1,3 @@
1
- require "rspec/expectations/version"
2
1
  require "shellwords"
3
2
 
4
3
  # @!method be_an_existing_executable
@@ -1,5 +1,3 @@
1
- require "rspec/expectations/version"
2
-
3
1
  # @!method be_an_existing_file
4
2
  # This matchers checks if <file> exists in filesystem
5
3
  #
@@ -1,5 +1,3 @@
1
- require "rspec/expectations/version"
2
-
3
1
  # @!method have_file_content(content)
4
2
  # This matchers checks if <file> has content. `content` can be a string,
5
3
  # regexp or an RSpec matcher.
@@ -1,5 +1,3 @@
1
- require "rspec/expectations/version"
2
-
3
1
  # @!method have_file_size(size)
4
2
  # This matchers checks if path has file size
5
3
  #
@@ -1,4 +1,3 @@
1
- require "rspec/expectations/version"
2
1
  require "fileutils"
3
2
 
4
3
  # @!method have_same_file_content_as(file_name)
@@ -1,5 +1,3 @@
1
- require "rspec/expectations/version"
2
-
3
1
  # @!method a_path_matching_pattern(/pattern/)
4
2
  # This matchers checks if <path> matches pattern. `pattern` can be a string,
5
3
  # regexp or an RSpec matcher.
@@ -1,5 +1,3 @@
1
- require "rspec/expectations/version"
2
-
3
1
  # @!method be_an_absolute_path
4
2
  # This matchers checks if <path> exists in filesystem
5
3
  #
@@ -1,5 +1,3 @@
1
- require "rspec/expectations/version"
2
-
3
1
  # @!method be_an_existing_path
4
2
  # This matchers checks if <path> exists in filesystem
5
3
  #
@@ -1,5 +1,3 @@
1
- require "rspec/expectations/version"
2
-
3
1
  # @!method have_permissions(permissions)
4
2
  # This matchers checks if <file> or <directory> has <perm> permissions
5
3
  #
@@ -5,10 +5,10 @@ require "aruba/platforms/windows_platform"
5
5
  module Aruba
6
6
  PLATFORM_MUTEX = Mutex.new
7
7
 
8
- Platform = [Platforms::WindowsPlatform, Platforms::UnixPlatform].find(&:match?)
8
+ PLATFORM = [Platforms::WindowsPlatform, Platforms::UnixPlatform].find(&:match?)
9
9
 
10
10
  PLATFORM_MUTEX.synchronize do
11
- @platform = Platform.new
11
+ @platform = PLATFORM.new
12
12
  end
13
13
 
14
14
  class << self
@@ -134,8 +134,6 @@ module Aruba
134
134
  # The mode to set
135
135
  def mode=(m)
136
136
  @announcer = @announcers.find { |a| a.mode? m.to_sym }
137
-
138
- self
139
137
  end
140
138
 
141
139
  # Fecth mode of announcer