aruba 2.4.1 → 3.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 +4 -4
- data/CHANGELOG.md +87 -7
- data/CONTRIBUTING.md +55 -33
- data/README.md +11 -9
- data/lib/aruba/api/bundler.rb +1 -5
- data/lib/aruba/api/commands.rb +29 -40
- data/lib/aruba/api/core.rb +2 -13
- data/lib/aruba/api/filesystem.rb +24 -44
- data/lib/aruba/api/text.rb +5 -2
- data/lib/aruba/aruba_logger.rb +3 -6
- data/lib/aruba/basic_configuration/option.rb +1 -7
- data/lib/aruba/basic_configuration.rb +7 -13
- data/lib/aruba/cli.rb +0 -6
- data/lib/aruba/command.rb +16 -16
- data/lib/aruba/command_monitor.rb +2 -4
- data/lib/aruba/configuration.rb +32 -20
- data/lib/aruba/cucumber/command.rb +32 -119
- data/lib/aruba/cucumber/environment.rb +0 -4
- data/lib/aruba/cucumber/file.rb +10 -10
- data/lib/aruba/cucumber/hooks.rb +12 -15
- data/lib/aruba/cucumber.rb +0 -1
- data/lib/aruba/events.rb +50 -14
- data/lib/aruba/generators/script_file.rb +5 -5
- data/lib/aruba/initializer.rb +7 -2
- data/lib/aruba/matchers/command/have_output.rb +1 -1
- data/lib/aruba/matchers/command/have_output_on_stderr.rb +1 -1
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +1 -1
- data/lib/aruba/matchers/command/have_output_size.rb +7 -20
- data/lib/aruba/matchers/string/match_output_string.rb +0 -2
- data/lib/aruba/platforms/unix_platform.rb +3 -3
- data/lib/aruba/platforms/unix_which.rb +2 -4
- data/lib/aruba/platforms/windows_which.rb +2 -4
- data/lib/aruba/processes/basic_process.rb +4 -4
- data/lib/aruba/processes/debug_process.rb +2 -1
- data/lib/aruba/processes/in_process.rb +3 -1
- data/lib/aruba/processes/spawn_process.rb +32 -21
- data/lib/aruba/rspec.rb +18 -25
- data/lib/aruba/runtime.rb +39 -21
- data/lib/aruba/setup.rb +20 -21
- data/lib/aruba/version.rb +1 -1
- metadata +76 -63
- data/lib/aruba/console/help.rb +0 -34
- data/lib/aruba/console.rb +0 -67
- data/lib/aruba/contracts/absolute_path.rb +0 -22
- data/lib/aruba/contracts/enum.rb +0 -29
- data/lib/aruba/contracts/is_power_of_two.rb +0 -24
- data/lib/aruba/contracts/relative_path.rb +0 -22
- data/lib/aruba/cucumber/testing_frameworks.rb +0 -219
- data/lib/aruba/matchers/string/include_output_string.rb +0 -36
- data/lib/aruba/matchers/string/output_string_eq.rb +0 -35
|
@@ -19,13 +19,10 @@ module Aruba
|
|
|
19
19
|
|
|
20
20
|
# Define an option reader
|
|
21
21
|
#
|
|
22
|
-
# @param [
|
|
23
|
-
# The name of the reader
|
|
24
|
-
#
|
|
25
|
-
# @option [Class, Module] type
|
|
22
|
+
# @param [Class, Module] type
|
|
26
23
|
# The type contract for the option
|
|
27
24
|
#
|
|
28
|
-
# @
|
|
25
|
+
# @param [Object] default
|
|
29
26
|
# The default value
|
|
30
27
|
def option_reader(name, type:, default: nil)
|
|
31
28
|
raise ArgumentError, 'Either use block or default value' if block_given? && default
|
|
@@ -38,13 +35,10 @@ module Aruba
|
|
|
38
35
|
|
|
39
36
|
# Define an option reader and writer
|
|
40
37
|
#
|
|
41
|
-
# @param [
|
|
42
|
-
# The name of the reader
|
|
43
|
-
#
|
|
44
|
-
# @option [Class, Module] type
|
|
38
|
+
# @param [Class, Module] type
|
|
45
39
|
# The type contract for the option
|
|
46
40
|
#
|
|
47
|
-
# @
|
|
41
|
+
# @param [Object] default
|
|
48
42
|
# The default value
|
|
49
43
|
#
|
|
50
44
|
def option_accessor(name, type:, default: nil)
|
|
@@ -56,14 +50,14 @@ module Aruba
|
|
|
56
50
|
Contract type => type
|
|
57
51
|
define_method(:"#{name}=") { |v| find_option(name).value = v }
|
|
58
52
|
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
Contract None => type
|
|
54
|
+
define_method(name) { find_option(name).value }
|
|
61
55
|
end
|
|
62
56
|
|
|
63
57
|
private
|
|
64
58
|
|
|
65
59
|
def add_option(name, value = nil)
|
|
66
|
-
|
|
60
|
+
raise "Option #{name} already exists" if known_options.key?(name)
|
|
67
61
|
|
|
68
62
|
known_options[name] = Option.new(name: name, value: value)
|
|
69
63
|
|
data/lib/aruba/cli.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'thor'
|
|
4
|
-
require 'aruba/console'
|
|
5
4
|
require 'aruba/initializer'
|
|
6
5
|
|
|
7
6
|
# Aruba
|
|
@@ -14,11 +13,6 @@ module Aruba
|
|
|
14
13
|
true
|
|
15
14
|
end
|
|
16
15
|
|
|
17
|
-
desc 'console', "Start aruba's console"
|
|
18
|
-
def console
|
|
19
|
-
Aruba::Console.new.start
|
|
20
|
-
end
|
|
21
|
-
|
|
22
16
|
desc 'init', 'Initialize aruba'
|
|
23
17
|
option :test_framework,
|
|
24
18
|
default: 'cucumber',
|
data/lib/aruba/command.rb
CHANGED
|
@@ -24,30 +24,30 @@ module Aruba
|
|
|
24
24
|
|
|
25
25
|
public
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
LAUNCHERS = [
|
|
28
|
+
Processes::DebugProcess,
|
|
29
|
+
Processes::InProcess,
|
|
30
|
+
Processes::SpawnProcess
|
|
31
|
+
].freeze
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
def initialize(command, exit_timeout:, io_wait_timeout:, working_directory:, environment:, # rubocop:disable Metrics/ParameterLists
|
|
34
|
+
main_class:, stop_signal:, startup_wait_time:, event_bus:, mode: nil)
|
|
35
|
+
klass = LAUNCHERS.find { |l| l.match? mode }
|
|
34
36
|
|
|
35
37
|
launcher = klass.new(
|
|
36
38
|
command,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
exit_timeout,
|
|
40
|
+
io_wait_timeout,
|
|
41
|
+
working_directory,
|
|
42
|
+
environment,
|
|
43
|
+
main_class,
|
|
44
|
+
stop_signal,
|
|
45
|
+
startup_wait_time
|
|
44
46
|
)
|
|
45
47
|
|
|
46
48
|
super(launcher)
|
|
47
49
|
|
|
48
|
-
@event_bus =
|
|
49
|
-
rescue KeyError => e
|
|
50
|
-
raise ArgumentError, e.message
|
|
50
|
+
@event_bus = event_bus
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
# Stop command
|
|
@@ -44,14 +44,12 @@ module Aruba
|
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
def initialize(
|
|
47
|
+
def initialize(announcer:)
|
|
48
48
|
@registered_commands = []
|
|
49
|
-
@announcer =
|
|
49
|
+
@announcer = announcer
|
|
50
50
|
|
|
51
51
|
@last_command_stopped = DefaultLastCommandStopped.new
|
|
52
52
|
@last_command_started = DefaultLastCommandStarted.new
|
|
53
|
-
rescue KeyError => e
|
|
54
|
-
raise ArgumentError, e.message
|
|
55
53
|
end
|
|
56
54
|
|
|
57
55
|
# Set last command started
|
data/lib/aruba/configuration.rb
CHANGED
|
@@ -7,23 +7,43 @@ require 'aruba/basic_configuration'
|
|
|
7
7
|
require 'aruba/in_config_wrapper'
|
|
8
8
|
require 'aruba/hooks'
|
|
9
9
|
|
|
10
|
-
require 'aruba/contracts/relative_path'
|
|
11
|
-
require 'aruba/contracts/absolute_path'
|
|
12
|
-
require 'aruba/contracts/enum'
|
|
13
|
-
|
|
14
|
-
require 'aruba/contracts/is_power_of_two'
|
|
15
|
-
|
|
16
10
|
# Aruba
|
|
17
11
|
module Aruba
|
|
18
12
|
# Aruba Configuration
|
|
19
13
|
#
|
|
20
14
|
# This defines the configuration options of aruba
|
|
21
15
|
class Configuration < BasicConfiguration
|
|
16
|
+
#
|
|
17
|
+
# Custom Contracts go here
|
|
18
|
+
#
|
|
19
|
+
|
|
20
|
+
# Value is a single safe relative path segment. Joining it to a path must
|
|
21
|
+
# yield a strict subdirectory of that path.
|
|
22
|
+
# @private
|
|
23
|
+
class PathSegment
|
|
24
|
+
def self.valid?(value)
|
|
25
|
+
test_path = Pathname.new('test').join(value).cleanpath
|
|
26
|
+
test_path.basename.to_s == value
|
|
27
|
+
rescue StandardError
|
|
28
|
+
false
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Value is a power of two
|
|
33
|
+
# @private
|
|
34
|
+
class IsPowerOfTwo
|
|
35
|
+
def self.valid?(value)
|
|
36
|
+
# explanation for algorithm can be found here:
|
|
37
|
+
# http://www.exploringbinary.com/ten-ways-to-check-if-an-integer-is-a-power-of-two-in-c/
|
|
38
|
+
value.positive? && value.nobits?(value - 1)
|
|
39
|
+
rescue StandardError
|
|
40
|
+
false
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
22
44
|
option_reader :root_directory, type: String, default: Dir.getwd
|
|
23
45
|
|
|
24
|
-
option_accessor :
|
|
25
|
-
type: Aruba::Contracts::RelativePath,
|
|
26
|
-
default: 'tmp/aruba'
|
|
46
|
+
option_accessor :working_directory_suffix, type: PathSegment, default: 'aruba'
|
|
27
47
|
|
|
28
48
|
option_reader :fixtures_path_prefix, type: String, default: '%'
|
|
29
49
|
|
|
@@ -43,27 +63,19 @@ module Aruba
|
|
|
43
63
|
end
|
|
44
64
|
option_accessor :remove_ansi_escape_sequences, type: Bool, default: true
|
|
45
65
|
option_accessor :command_launcher,
|
|
46
|
-
type:
|
|
66
|
+
type: Enum[:in_process, :spawn, :debug],
|
|
47
67
|
default: :spawn
|
|
48
68
|
option_accessor :main_class, type: Maybe[Class], default: nil
|
|
49
69
|
|
|
50
|
-
option_accessor :home_directory,
|
|
51
|
-
type: Or[Aruba::Contracts::AbsolutePath,
|
|
52
|
-
Aruba::Contracts::RelativePath] do |config|
|
|
53
|
-
File.join(config.root_directory.value, config.working_directory.value)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
70
|
option_accessor :log_level,
|
|
57
|
-
type:
|
|
58
|
-
Aruba::Contracts::Enum[:fatal, :warn, :debug, :info,
|
|
59
|
-
:error, :unknown, :silent],
|
|
71
|
+
type: Enum[:fatal, :warn, :debug, :info, :error, :unknown, :silent],
|
|
60
72
|
default: :info
|
|
61
73
|
|
|
62
74
|
# TODO: deprecate this value and replace with "filesystem allocation unit"
|
|
63
75
|
# equal to 4096 by default. "filesystem allocation unit" would represent
|
|
64
76
|
# the actual MINIMUM space taken in bytes by a 1-byte file
|
|
65
77
|
option_accessor :physical_block_size,
|
|
66
|
-
type:
|
|
78
|
+
type: IsPowerOfTwo,
|
|
67
79
|
default: 512
|
|
68
80
|
option_accessor :console_history_file, type: String,
|
|
69
81
|
default: '~/.aruba_history'
|
|
@@ -44,12 +44,6 @@ When 'I run {command} in the background' do |cmd|
|
|
|
44
44
|
run_command(sanitize_text(cmd))
|
|
45
45
|
end
|
|
46
46
|
|
|
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.'
|
|
50
|
-
run_command(sanitize_text(cmd))
|
|
51
|
-
end
|
|
52
|
-
|
|
53
47
|
When 'I type {string}' do |input|
|
|
54
48
|
type(unescape_text(input))
|
|
55
49
|
end
|
|
@@ -82,7 +76,6 @@ end
|
|
|
82
76
|
|
|
83
77
|
When(/^I stop the command(?: started last)? if (output|stdout|stderr) contains:$/) \
|
|
84
78
|
do |channel, expected|
|
|
85
|
-
|
|
86
79
|
start_time = Time.now
|
|
87
80
|
loop do
|
|
88
81
|
output = last_command_started.public_send channel.to_sym, wait_for_io: 0
|
|
@@ -105,7 +98,7 @@ When(/^I stop the command(?: started last)? if (output|stdout|stderr) contains:$
|
|
|
105
98
|
end
|
|
106
99
|
end
|
|
107
100
|
|
|
108
|
-
When 'I wait for output/stdout to contain:' do |expected|
|
|
101
|
+
When 'I wait for (the )output/stdout to contain:' do |expected|
|
|
109
102
|
start_time = Time.now
|
|
110
103
|
loop do
|
|
111
104
|
output = last_command_started.stdout wait_for_io: 0
|
|
@@ -124,7 +117,7 @@ When 'I wait for output/stdout to contain:' do |expected|
|
|
|
124
117
|
end
|
|
125
118
|
end
|
|
126
119
|
|
|
127
|
-
When 'I wait for output/stdout to contain {string}' do |expected|
|
|
120
|
+
When 'I wait for (the )output/stdout to contain {string}' do |expected|
|
|
128
121
|
start_time = Time.now
|
|
129
122
|
loop do
|
|
130
123
|
output = last_command_started.stdout wait_for_io: 0
|
|
@@ -151,28 +144,28 @@ end
|
|
|
151
144
|
Then '(the ){channel} should contain {string}' do |channel, expected|
|
|
152
145
|
combined_output = send(:"all_#{channel}")
|
|
153
146
|
|
|
154
|
-
expect(combined_output).to
|
|
147
|
+
expect(extract_text(combined_output)).to include expected
|
|
155
148
|
end
|
|
156
149
|
|
|
157
150
|
## the stderr should not contain "hello"
|
|
158
151
|
Then '(the ){channel} should not contain {string}' do |channel, expected|
|
|
159
152
|
combined_output = send(:"all_#{channel}")
|
|
160
153
|
|
|
161
|
-
expect(combined_output).not_to
|
|
154
|
+
expect(extract_text(combined_output)).not_to include expected
|
|
162
155
|
end
|
|
163
156
|
|
|
164
157
|
## the stderr should contain exactly "hello"
|
|
165
158
|
Then '(the ){channel} should contain exactly {string}' do |channel, expected|
|
|
166
159
|
combined_output = send(:"all_#{channel}")
|
|
167
160
|
|
|
168
|
-
expect(combined_output).to
|
|
161
|
+
expect(sanitize_text(combined_output)).to eq expected
|
|
169
162
|
end
|
|
170
163
|
|
|
171
164
|
## the stderr should not contain exactly "hello"
|
|
172
165
|
Then '(the ){channel} should not contain exactly {string}' do |channel, expected|
|
|
173
166
|
combined_output = send(:"all_#{channel}")
|
|
174
167
|
|
|
175
|
-
expect(combined_output).not_to
|
|
168
|
+
expect(sanitize_text(combined_output)).not_to eq expected
|
|
176
169
|
end
|
|
177
170
|
|
|
178
171
|
## the stderr from "echo -n 'Hello'" should contain "hello"
|
|
@@ -185,9 +178,7 @@ Then '(the ){channel} from {string} should contain {string}' do |channel, cmd, e
|
|
|
185
178
|
|
|
186
179
|
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
|
187
180
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
expect(command).to send(matcher, send(output_string_matcher, expected))
|
|
181
|
+
expect(command).to send(matcher, a_string_including(expected))
|
|
191
182
|
end
|
|
192
183
|
|
|
193
184
|
## the stderr from "echo -n 'Hello'" should contain exactly "hello"
|
|
@@ -201,9 +192,7 @@ Then '(the ){channel} from {string} should contain exactly {string}' \
|
|
|
201
192
|
|
|
202
193
|
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
|
203
194
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
expect(command).to send(matcher, send(output_string_matcher, expected))
|
|
195
|
+
expect(command).to send(matcher, expected)
|
|
207
196
|
end
|
|
208
197
|
|
|
209
198
|
## the stderr from "echo -n 'Hello'" should not contain "hello"
|
|
@@ -216,9 +205,7 @@ Then '(the ){channel} from {string} should not contain {string}' do |channel, cm
|
|
|
216
205
|
|
|
217
206
|
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
|
218
207
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
expect(command).not_to send(matcher, send(output_string_matcher, expected))
|
|
208
|
+
expect(command).not_to send(matcher, a_string_including(expected))
|
|
222
209
|
end
|
|
223
210
|
|
|
224
211
|
## the stderr from "echo -n 'Hello'" should not contain exactly "hello"
|
|
@@ -232,37 +219,37 @@ Then '(the ){channel} from {string} should not contain exactly {string}' \
|
|
|
232
219
|
|
|
233
220
|
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
|
234
221
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
expect(command).not_to send(matcher, send(output_string_matcher, expected))
|
|
222
|
+
expect(command).not_to send(matcher, expected)
|
|
238
223
|
end
|
|
239
224
|
|
|
240
225
|
## the stderr should contain:
|
|
241
226
|
Then '(the ){channel} should contain:' do |channel, expected|
|
|
242
227
|
combined_output = send(:"all_#{channel}")
|
|
243
228
|
|
|
244
|
-
expect(combined_output).to
|
|
229
|
+
expect(extract_text(combined_output)).to include(expected)
|
|
245
230
|
end
|
|
246
231
|
|
|
247
232
|
## the stderr should not contain:
|
|
248
233
|
Then '(the ){channel} should not contain:' do |channel, expected|
|
|
249
234
|
combined_output = send(:"all_#{channel}")
|
|
250
235
|
|
|
251
|
-
expect(combined_output).not_to
|
|
236
|
+
expect(extract_text(combined_output)).not_to include(expected)
|
|
252
237
|
end
|
|
253
238
|
|
|
254
239
|
## the stderr should contain exactly:
|
|
255
240
|
Then '(the ){channel} should contain exactly:' do |channel, expected|
|
|
241
|
+
expected = unescape_text(expected)
|
|
256
242
|
combined_output = send(:"all_#{channel}")
|
|
257
243
|
|
|
258
|
-
expect(combined_output).to
|
|
244
|
+
expect(sanitize_text(combined_output)).to eq expected
|
|
259
245
|
end
|
|
260
246
|
|
|
261
247
|
## the stderr should not contain exactly:
|
|
262
248
|
Then '(the ){channel} should not contain exactly:' do |channel, expected|
|
|
249
|
+
expected = unescape_text(expected)
|
|
263
250
|
combined_output = send(:"all_#{channel}")
|
|
264
251
|
|
|
265
|
-
expect(combined_output).not_to
|
|
252
|
+
expect(sanitize_text(combined_output)).not_to eq expected
|
|
266
253
|
end
|
|
267
254
|
|
|
268
255
|
## the stderr from "echo -n 'Hello'" should not contain:
|
|
@@ -275,9 +262,7 @@ Then '(the ){channel} from {string} should not contain:' do |channel, cmd, expec
|
|
|
275
262
|
|
|
276
263
|
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
|
277
264
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
expect(command).not_to send(matcher, send(output_string_matcher, expected))
|
|
265
|
+
expect(command).not_to send(matcher, a_string_including(expected))
|
|
281
266
|
end
|
|
282
267
|
|
|
283
268
|
## the stderr from "echo -n 'Hello'" should not contain exactly:
|
|
@@ -290,9 +275,7 @@ Then '(the ){channel} from {string} should not contain exactly:' do |channel, cm
|
|
|
290
275
|
|
|
291
276
|
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
|
292
277
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
expect(command).not_to send(matcher, send(output_string_matcher, expected))
|
|
278
|
+
expect(command).not_to send(matcher, expected)
|
|
296
279
|
end
|
|
297
280
|
|
|
298
281
|
## the stderr from "echo -n 'Hello'" should contain:
|
|
@@ -305,9 +288,7 @@ Then '(the ){channel} from {string} should contain:' do |channel, cmd, expected|
|
|
|
305
288
|
|
|
306
289
|
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
|
307
290
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
expect(command).to send(matcher, send(output_string_matcher, expected))
|
|
291
|
+
expect(command).to send(matcher, a_string_including(expected))
|
|
311
292
|
end
|
|
312
293
|
|
|
313
294
|
## the stderr from "echo -n 'Hello'" should contain exactly:
|
|
@@ -320,9 +301,7 @@ Then '(the ){channel} from {string} should contain exactly:' do |channel, cmd, e
|
|
|
320
301
|
|
|
321
302
|
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
|
322
303
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
expect(command).to send(matcher, send(output_string_matcher, expected))
|
|
304
|
+
expect(command).to send(matcher, expected)
|
|
326
305
|
end
|
|
327
306
|
|
|
328
307
|
# "the output should match" allows regex in the partial_output, if
|
|
@@ -331,31 +310,25 @@ end
|
|
|
331
310
|
# appear naturally in the output
|
|
332
311
|
Then(%r{^the output should( not)? match /([^/]*)/$}) do |negated, expected|
|
|
333
312
|
if negated
|
|
334
|
-
expect(
|
|
335
|
-
.not_to include have_output an_output_string_matching(expected)
|
|
313
|
+
expect(all_output).not_to match_output_string(expected)
|
|
336
314
|
else
|
|
337
|
-
expect(
|
|
338
|
-
.to include have_output an_output_string_matching(expected)
|
|
315
|
+
expect(all_output).to match_output_string(expected)
|
|
339
316
|
end
|
|
340
317
|
end
|
|
341
318
|
|
|
342
319
|
Then(/^the output should( not)? match %r<([^>]*)>$/) do |negated, expected|
|
|
343
320
|
if negated
|
|
344
|
-
expect(
|
|
345
|
-
.not_to include have_output an_output_string_matching(expected)
|
|
321
|
+
expect(all_output).not_to match_output_string(expected)
|
|
346
322
|
else
|
|
347
|
-
expect(
|
|
348
|
-
.to include have_output an_output_string_matching(expected)
|
|
323
|
+
expect(all_output).to match_output_string(expected)
|
|
349
324
|
end
|
|
350
325
|
end
|
|
351
326
|
|
|
352
327
|
Then(/^the output should( not)? match:$/) do |negated, expected|
|
|
353
328
|
if negated
|
|
354
|
-
expect(
|
|
355
|
-
.not_to include have_output an_output_string_matching(expected)
|
|
329
|
+
expect(all_output).not_to match_output_string(expected)
|
|
356
330
|
else
|
|
357
|
-
expect(
|
|
358
|
-
.to include have_output an_output_string_matching(expected)
|
|
331
|
+
expect(all_output).to match_output_string(expected)
|
|
359
332
|
end
|
|
360
333
|
end
|
|
361
334
|
|
|
@@ -393,21 +366,6 @@ Then(/^it should (pass|fail)$/) do |pass_fail|
|
|
|
393
366
|
end
|
|
394
367
|
end
|
|
395
368
|
|
|
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."
|
|
400
|
-
last_command_started.stop
|
|
401
|
-
|
|
402
|
-
if pass_fail == 'pass'
|
|
403
|
-
expect(last_command_stopped).to be_successfully_executed
|
|
404
|
-
else
|
|
405
|
-
expect(last_command_stopped).not_to be_successfully_executed
|
|
406
|
-
end
|
|
407
|
-
|
|
408
|
-
expect(last_command_stopped).not_to have_output an_output_string_including(expected)
|
|
409
|
-
end
|
|
410
|
-
|
|
411
369
|
Then(/^it should (pass|fail) with "(.*?)"$/) do |pass_fail, expected|
|
|
412
370
|
last_command_started.stop
|
|
413
371
|
|
|
@@ -417,22 +375,7 @@ Then(/^it should (pass|fail) with "(.*?)"$/) do |pass_fail, expected|
|
|
|
417
375
|
expect(last_command_stopped).not_to be_successfully_executed
|
|
418
376
|
end
|
|
419
377
|
|
|
420
|
-
expect(last_command_stopped).to have_output
|
|
421
|
-
end
|
|
422
|
-
|
|
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."
|
|
427
|
-
last_command_started.stop
|
|
428
|
-
|
|
429
|
-
if pass_fail == 'pass'
|
|
430
|
-
expect(last_command_stopped).to be_successfully_executed
|
|
431
|
-
else
|
|
432
|
-
expect(last_command_stopped).not_to be_successfully_executed
|
|
433
|
-
end
|
|
434
|
-
|
|
435
|
-
expect(last_command_stopped).not_to have_output an_output_string_including(expected)
|
|
378
|
+
expect(last_command_stopped).to have_output a_string_including(expected)
|
|
436
379
|
end
|
|
437
380
|
|
|
438
381
|
Then(/^it should (pass|fail) with:$/) do |pass_fail, expected|
|
|
@@ -444,22 +387,7 @@ Then(/^it should (pass|fail) with:$/) do |pass_fail, expected|
|
|
|
444
387
|
expect(last_command_stopped).not_to be_successfully_executed
|
|
445
388
|
end
|
|
446
389
|
|
|
447
|
-
expect(last_command_stopped).to have_output
|
|
448
|
-
end
|
|
449
|
-
|
|
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."
|
|
454
|
-
last_command_started.stop
|
|
455
|
-
|
|
456
|
-
if pass_fail == 'pass'
|
|
457
|
-
expect(last_command_stopped).to be_successfully_executed
|
|
458
|
-
else
|
|
459
|
-
expect(last_command_stopped).not_to be_successfully_executed
|
|
460
|
-
end
|
|
461
|
-
|
|
462
|
-
expect(last_command_stopped).not_to have_output an_output_string_eq(expected)
|
|
390
|
+
expect(last_command_stopped).to have_output a_string_including(expected)
|
|
463
391
|
end
|
|
464
392
|
|
|
465
393
|
Then(/^it should (pass|fail) with exactly:$/) do |pass_fail, expected|
|
|
@@ -471,22 +399,7 @@ Then(/^it should (pass|fail) with exactly:$/) do |pass_fail, expected|
|
|
|
471
399
|
expect(last_command_stopped).not_to be_successfully_executed
|
|
472
400
|
end
|
|
473
401
|
|
|
474
|
-
expect(last_command_stopped
|
|
475
|
-
end
|
|
476
|
-
|
|
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."
|
|
481
|
-
last_command_started.stop
|
|
482
|
-
|
|
483
|
-
if pass_fail == 'pass'
|
|
484
|
-
expect(last_command_stopped).to be_successfully_executed
|
|
485
|
-
else
|
|
486
|
-
expect(last_command_stopped).not_to be_successfully_executed
|
|
487
|
-
end
|
|
488
|
-
|
|
489
|
-
expect(last_command_stopped).not_to have_output an_output_string_matching(expected)
|
|
402
|
+
expect(last_command_stopped).to have_output expected
|
|
490
403
|
end
|
|
491
404
|
|
|
492
405
|
Then(/^it should (pass|fail) (?:with regexp?|matching):$/) do |pass_fail, expected|
|
|
@@ -504,7 +417,7 @@ end
|
|
|
504
417
|
Then '(the ){channel} should not contain anything' do |channel|
|
|
505
418
|
combined_output = send(:"all_#{channel}")
|
|
506
419
|
|
|
507
|
-
expect(combined_output).to
|
|
420
|
+
expect(extract_text(combined_output)).to eq ''
|
|
508
421
|
end
|
|
509
422
|
|
|
510
423
|
Then(/^(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:$/) \
|
|
@@ -518,10 +431,10 @@ Then(/^(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:
|
|
|
518
431
|
|
|
519
432
|
if negated
|
|
520
433
|
expect(all_commands)
|
|
521
|
-
.not_to include send(matcher,
|
|
434
|
+
.not_to include send(matcher, a_string_including(expected))
|
|
522
435
|
else
|
|
523
436
|
expect(all_commands)
|
|
524
|
-
.to include send(matcher,
|
|
437
|
+
.to include send(matcher, a_string_including(expected))
|
|
525
438
|
end
|
|
526
439
|
end
|
|
527
440
|
end
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
Given(/^a mocked home directory$/) do
|
|
4
|
-
set_environment_variable 'HOME', expand_path('.')
|
|
5
|
-
end
|
|
6
|
-
|
|
7
3
|
Given(/^I set the environment variable "(.*)" to "(.*)"/) do |variable, value|
|
|
8
4
|
set_environment_variable(variable.to_s, value.to_s)
|
|
9
5
|
end
|
data/lib/aruba/cucumber/file.rb
CHANGED
|
@@ -121,9 +121,9 @@ end
|
|
|
121
121
|
|
|
122
122
|
Then(/^(?:a|the) file matching %r<(.*?)> should (not )?exist$/) do |pattern, expect_match|
|
|
123
123
|
if expect_match
|
|
124
|
-
expect(all_paths).not_to include
|
|
124
|
+
expect(all_paths).not_to include a_string_matching(pattern)
|
|
125
125
|
else
|
|
126
|
-
expect(all_paths).to include
|
|
126
|
+
expect(all_paths).to include a_string_matching(pattern)
|
|
127
127
|
end
|
|
128
128
|
end
|
|
129
129
|
|
|
@@ -149,18 +149,18 @@ end
|
|
|
149
149
|
Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?contain "([^"]*)"$/) \
|
|
150
150
|
do |file, negated, content|
|
|
151
151
|
if negated
|
|
152
|
-
expect(file).not_to have_file_content
|
|
152
|
+
expect(file).not_to have_file_content a_string_including(content.chomp)
|
|
153
153
|
else
|
|
154
|
-
expect(file).to have_file_content
|
|
154
|
+
expect(file).to have_file_content a_string_including(content.chomp)
|
|
155
155
|
end
|
|
156
156
|
end
|
|
157
157
|
|
|
158
158
|
Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?contain:$/) \
|
|
159
159
|
do |file, negated, content|
|
|
160
160
|
if negated
|
|
161
|
-
expect(file).not_to have_file_content
|
|
161
|
+
expect(file).not_to have_file_content a_string_including(content.chomp)
|
|
162
162
|
else
|
|
163
|
-
expect(file).to have_file_content
|
|
163
|
+
expect(file).to have_file_content a_string_including(content.chomp)
|
|
164
164
|
end
|
|
165
165
|
end
|
|
166
166
|
|
|
@@ -176,18 +176,18 @@ end
|
|
|
176
176
|
Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?match %r<([^>]*)>$/) \
|
|
177
177
|
do |file, negated, content|
|
|
178
178
|
if negated
|
|
179
|
-
expect(file).not_to have_file_content
|
|
179
|
+
expect(file).not_to have_file_content Regexp.new(content)
|
|
180
180
|
else
|
|
181
|
-
expect(file).to have_file_content
|
|
181
|
+
expect(file).to have_file_content Regexp.new(content)
|
|
182
182
|
end
|
|
183
183
|
end
|
|
184
184
|
|
|
185
185
|
Then(%r{^(?:a|the) file(?: named)? "([^"]*)" should (not )?match /([^/]*)/$}) \
|
|
186
186
|
do |file, negated, content|
|
|
187
187
|
if negated
|
|
188
|
-
expect(file).not_to have_file_content
|
|
188
|
+
expect(file).not_to have_file_content Regexp.new(content)
|
|
189
189
|
else
|
|
190
|
-
expect(file).to have_file_content
|
|
190
|
+
expect(file).to have_file_content Regexp.new(content)
|
|
191
191
|
end
|
|
192
192
|
end
|
|
193
193
|
|
data/lib/aruba/cucumber/hooks.rb
CHANGED
|
@@ -10,25 +10,26 @@ Around do |_, block|
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
Before do
|
|
13
|
-
|
|
13
|
+
aruba.setup
|
|
14
|
+
|
|
15
|
+
# Modify PATH to include project/bin
|
|
14
16
|
prepend_environment_variable(
|
|
15
17
|
'PATH',
|
|
16
18
|
aruba.config.command_search_paths.join(File::PATH_SEPARATOR) + File::PATH_SEPARATOR
|
|
17
19
|
)
|
|
18
|
-
|
|
20
|
+
|
|
21
|
+
# Use configured home directory as HOME
|
|
22
|
+
set_environment_variable 'HOME', aruba.home_directory
|
|
19
23
|
end
|
|
20
24
|
|
|
21
|
-
After do
|
|
25
|
+
After do |scenario|
|
|
22
26
|
terminate_all_commands
|
|
23
27
|
aruba.command_monitor.clear
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
Before('not @no-clobber') do
|
|
31
|
-
setup_aruba
|
|
28
|
+
if scenario.passed?
|
|
29
|
+
aruba.teardown
|
|
30
|
+
else
|
|
31
|
+
warn "Find the Aruba working directory for inspection at #{aruba.home_directory}"
|
|
32
|
+
end
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
Before('@puts') do
|
|
@@ -104,10 +105,6 @@ Before('@keep-ansi-escape-sequences') do
|
|
|
104
105
|
aruba.config.remove_ansi_escape_sequences = false
|
|
105
106
|
end
|
|
106
107
|
|
|
107
|
-
Before('@mocked-home-directory') do
|
|
108
|
-
set_environment_variable 'HOME', expand_path('.')
|
|
109
|
-
end
|
|
110
|
-
|
|
111
108
|
Before('@disable-bundler') do
|
|
112
109
|
unset_bundler_env_vars
|
|
113
110
|
end
|