aruba 1.0.0 → 1.0.1
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/.rubocop.yml +29 -8
- data/.rubocop_todo.yml +100 -146
- data/CHANGELOG.md +23 -1
- data/CONTRIBUTING.md +0 -8
- data/Gemfile +3 -1
- data/Rakefile +6 -4
- data/appveyor.yml +0 -1
- data/aruba.gemspec +7 -4
- data/fixtures/cli-app/cli-app.gemspec +3 -2
- data/fixtures/cli-app/spec/spec_helper.rb +2 -1
- data/fixtures/empty-app/cli-app.gemspec +3 -2
- data/lib/aruba/api/bundler.rb +1 -1
- data/lib/aruba/api/commands.rb +8 -11
- data/lib/aruba/api/core.rb +48 -33
- data/lib/aruba/api/environment.rb +12 -4
- data/lib/aruba/api/filesystem.rb +27 -23
- data/lib/aruba/api/text.rb +15 -3
- data/lib/aruba/basic_configuration.rb +5 -6
- data/lib/aruba/basic_configuration/option.rb +2 -2
- data/lib/aruba/cli.rb +4 -1
- data/lib/aruba/config_wrapper.rb +17 -2
- data/lib/aruba/configuration.rb +27 -12
- data/lib/aruba/console.rb +0 -2
- data/lib/aruba/console/help.rb +5 -2
- data/lib/aruba/contracts/absolute_path.rb +1 -1
- data/lib/aruba/contracts/is_power_of_two.rb +2 -2
- data/lib/aruba/contracts/relative_path.rb +1 -1
- data/lib/aruba/cucumber/command.rb +83 -64
- data/lib/aruba/cucumber/file.rb +42 -22
- data/lib/aruba/cucumber/hooks.rb +4 -1
- data/lib/aruba/cucumber/testing_frameworks.rb +14 -12
- data/lib/aruba/event_bus.rb +4 -2
- data/lib/aruba/event_bus/name_resolver.rb +9 -8
- data/lib/aruba/events.rb +2 -1
- data/lib/aruba/hooks.rb +2 -4
- data/lib/aruba/in_config_wrapper.rb +8 -5
- data/lib/aruba/initializer.rb +5 -3
- data/lib/aruba/matchers/base/base_matcher.rb +2 -11
- data/lib/aruba/matchers/base/object_formatter.rb +0 -3
- data/lib/aruba/matchers/collection/include_an_object.rb +4 -4
- data/lib/aruba/matchers/command/be_successfully_executed.rb +3 -1
- data/lib/aruba/matchers/command/have_exit_status.rb +3 -1
- data/lib/aruba/matchers/command/have_finished_in_time.rb +3 -1
- data/lib/aruba/matchers/command/have_output.rb +3 -1
- data/lib/aruba/matchers/command/have_output_on_stderr.rb +3 -1
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +3 -1
- data/lib/aruba/matchers/directory/have_sub_directory.rb +8 -3
- data/lib/aruba/matchers/file/have_file_size.rb +4 -2
- data/lib/aruba/matchers/path/have_permissions.rb +4 -2
- data/lib/aruba/platforms/announcer.rb +18 -6
- data/lib/aruba/platforms/aruba_file_creator.rb +3 -1
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +7 -2
- data/lib/aruba/platforms/command_monitor.rb +3 -3
- data/lib/aruba/platforms/unix_environment_variables.rb +2 -4
- data/lib/aruba/platforms/unix_which.rb +1 -1
- data/lib/aruba/platforms/windows_environment_variables.rb +2 -1
- data/lib/aruba/platforms/windows_which.rb +6 -2
- data/lib/aruba/processes/debug_process.rb +4 -2
- data/lib/aruba/processes/in_process.rb +4 -2
- data/lib/aruba/processes/spawn_process.rb +18 -10
- data/lib/aruba/rspec.rb +25 -15
- data/lib/aruba/runtime.rb +11 -4
- data/lib/aruba/setup.rb +23 -10
- data/lib/aruba/tasks/docker_helpers.rb +3 -1
- data/lib/aruba/version.rb +1 -1
- metadata +22 -8
data/lib/aruba/api/text.rb
CHANGED
@@ -14,7 +14,14 @@ module Aruba
|
|
14
14
|
# @param [#to_s] text
|
15
15
|
# Input
|
16
16
|
def unescape_text(text)
|
17
|
-
text
|
17
|
+
text
|
18
|
+
.gsub('\n', "\n")
|
19
|
+
.gsub('\"', '"')
|
20
|
+
.gsub('\e', "\e")
|
21
|
+
.gsub('\033', "\e")
|
22
|
+
.gsub('\016', "\016")
|
23
|
+
.gsub('\017', "\017")
|
24
|
+
.gsub('\t', "\t")
|
18
25
|
end
|
19
26
|
|
20
27
|
# Remove ansi characters from text
|
@@ -22,7 +29,10 @@ module Aruba
|
|
22
29
|
# @param [#to_s] text
|
23
30
|
# Input
|
24
31
|
def extract_text(text)
|
25
|
-
text
|
32
|
+
text
|
33
|
+
.gsub(/(?:\e|\033)\[\d+(?>(;\d+)*)m/, '')
|
34
|
+
.gsub(/\\\[|\\\]/, '')
|
35
|
+
.gsub(/\007|\016|\017/, '')
|
26
36
|
end
|
27
37
|
|
28
38
|
# Unescape special characters and remove ANSI characters
|
@@ -41,7 +51,9 @@ module Aruba
|
|
41
51
|
# @param [#to_s] text
|
42
52
|
# The text to parse
|
43
53
|
def replace_variables(text)
|
44
|
-
|
54
|
+
if text.include? '<pid-last-command-started>'
|
55
|
+
text = text.gsub(/<pid-last-command-started>/, last_command_started.pid.to_s)
|
56
|
+
end
|
45
57
|
|
46
58
|
text
|
47
59
|
end
|
@@ -32,8 +32,8 @@ module Aruba
|
|
32
32
|
contract = opts[:contract]
|
33
33
|
default = opts[:default]
|
34
34
|
|
35
|
-
|
36
|
-
|
35
|
+
raise ArgumentError, 'Either use block or default value' if block_given? && default
|
36
|
+
raise ArgumentError, 'contract-options is required' if contract.nil?
|
37
37
|
|
38
38
|
Contract contract
|
39
39
|
add_option(name, block_given? ? yield(InConfigWrapper.new(known_options)) : default)
|
@@ -61,9 +61,8 @@ module Aruba
|
|
61
61
|
contract = opts[:contract]
|
62
62
|
default = opts[:default]
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
fail ArgumentError, 'contract-options is required' if contract.nil?
|
64
|
+
raise ArgumentError, 'Either use block or default value' if block_given? && default
|
65
|
+
raise ArgumentError, 'contract-options is required' if contract.nil?
|
67
66
|
|
68
67
|
# Add writer
|
69
68
|
add_option(name, block_given? ? yield(InConfigWrapper.new(known_options)) : default)
|
@@ -210,7 +209,7 @@ module Aruba
|
|
210
209
|
end
|
211
210
|
|
212
211
|
def find_option(name)
|
213
|
-
|
212
|
+
raise NotImplementedError, %(Unknown option "#{name}") unless option? name
|
214
213
|
|
215
214
|
local_options[name]
|
216
215
|
end
|
@@ -15,8 +15,8 @@ module Aruba
|
|
15
15
|
name = opts[:name]
|
16
16
|
value = opts[:value]
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
raise ArgumentError, '"name" is required' unless opts.key? :name
|
19
|
+
raise ArgumentError, '"value" is required' unless opts.key? :value
|
20
20
|
|
21
21
|
@name = name
|
22
22
|
@value = value
|
data/lib/aruba/cli.rb
CHANGED
@@ -18,7 +18,10 @@ module Aruba
|
|
18
18
|
end
|
19
19
|
|
20
20
|
desc 'init', 'Initialize aruba'
|
21
|
-
option :test_framework,
|
21
|
+
option :test_framework,
|
22
|
+
default: 'cucumber',
|
23
|
+
enum: %w(cucumber rspec minitest),
|
24
|
+
desc: 'Choose which test framework to use'
|
22
25
|
def init
|
23
26
|
Aruba::Initializer.new.call(options[:test_framework])
|
24
27
|
end
|
data/lib/aruba/config_wrapper.rb
CHANGED
@@ -30,9 +30,11 @@ module Aruba
|
|
30
30
|
# If one method ends with "=", e.g. ":option1=", then notify the event
|
31
31
|
# queue, that the user changes the value of "option1"
|
32
32
|
def method_missing(name, *args, &block)
|
33
|
-
|
33
|
+
notify(name, args) if name.to_s.end_with?('=')
|
34
34
|
|
35
|
-
config.send(name, *args, &block)
|
35
|
+
return config.send(name, *args, &block) if config.respond_to? name
|
36
|
+
|
37
|
+
super
|
36
38
|
end
|
37
39
|
|
38
40
|
# Pass on respond_to?-calls
|
@@ -54,5 +56,18 @@ module Aruba
|
|
54
56
|
def respond_to?(m)
|
55
57
|
config.respond_to? m
|
56
58
|
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def notify(name, args)
|
63
|
+
event_bus.notify(
|
64
|
+
Events::ChangedConfiguration.new(
|
65
|
+
changed: {
|
66
|
+
name: name.to_s.gsub(/=$/, ''),
|
67
|
+
value: args.first
|
68
|
+
}
|
69
|
+
)
|
70
|
+
)
|
71
|
+
end
|
57
72
|
end
|
58
73
|
end
|
data/lib/aruba/configuration.rb
CHANGED
@@ -20,7 +20,8 @@ module Aruba
|
|
20
20
|
option_reader :root_directory, contract: { None => String }, default: Dir.getwd
|
21
21
|
|
22
22
|
option_accessor :working_directory,
|
23
|
-
contract: { Aruba::Contracts::RelativePath =>
|
23
|
+
contract: { Aruba::Contracts::RelativePath =>
|
24
|
+
Aruba::Contracts::RelativePath },
|
24
25
|
default: 'tmp/aruba'
|
25
26
|
|
26
27
|
option_reader :fixtures_path_prefix, contract: { None => String }, default: '%'
|
@@ -36,34 +37,48 @@ module Aruba
|
|
36
37
|
option_accessor :command_runtime_environment, contract: { Hash => Hash }, default: {}
|
37
38
|
option_accessor :command_search_paths,
|
38
39
|
contract: { ArrayOf[String] => ArrayOf[String] } do |config|
|
39
|
-
[File.join(config.root_directory.value, 'bin'),
|
40
|
+
[File.join(config.root_directory.value, 'bin'),
|
41
|
+
File.join(config.root_directory.value, 'exe')]
|
40
42
|
end
|
41
43
|
option_accessor :remove_ansi_escape_sequences, contract: { Bool => Bool }, default: true
|
42
44
|
option_accessor :command_launcher,
|
43
|
-
contract: {
|
45
|
+
contract: {
|
46
|
+
Aruba::Contracts::Enum[:in_process, :spawn, :debug] =>
|
47
|
+
Aruba::Contracts::Enum[:in_process, :spawn, :debug]
|
48
|
+
},
|
44
49
|
default: :spawn
|
45
50
|
option_accessor :main_class, contract: { Class => Maybe[Class] }, default: nil
|
46
51
|
|
47
52
|
option_accessor :home_directory,
|
48
|
-
contract: {
|
49
|
-
|
50
|
-
|
51
|
-
|
53
|
+
contract: {
|
54
|
+
Or[Aruba::Contracts::AbsolutePath, Aruba::Contracts::RelativePath] =>
|
55
|
+
Or[Aruba::Contracts::AbsolutePath, Aruba::Contracts::RelativePath]
|
56
|
+
} do |config|
|
57
|
+
File.join(config.root_directory.value, config.working_directory.value)
|
58
|
+
end
|
52
59
|
|
53
60
|
option_accessor :log_level,
|
54
|
-
contract: {
|
55
|
-
|
61
|
+
contract: {
|
62
|
+
Aruba::Contracts::Enum[:fatal, :warn, :debug, :info,
|
63
|
+
:error, :unknown, :silent] =>
|
64
|
+
Aruba::Contracts::Enum[:fatal, :warn, :debug, :info,
|
65
|
+
:error, :unknown, :silent]
|
66
|
+
},
|
56
67
|
default: :info
|
57
68
|
|
58
69
|
# TODO: deprecate this value and replace with "filesystem allocation unit"
|
59
70
|
# equal to 4096 by default. "filesystem allocation unit" would represent
|
60
71
|
# the actual MINIMUM space taken in bytes by a 1-byte file
|
61
72
|
option_accessor :physical_block_size,
|
62
|
-
contract: { Aruba::Contracts::IsPowerOfTwo =>
|
73
|
+
contract: { Aruba::Contracts::IsPowerOfTwo =>
|
74
|
+
Aruba::Contracts::IsPowerOfTwo },
|
63
75
|
default: 512
|
64
|
-
option_accessor :console_history_file, contract: { String => String },
|
76
|
+
option_accessor :console_history_file, contract: { String => String },
|
77
|
+
default: '~/.aruba_history'
|
65
78
|
|
66
|
-
option_accessor :activate_announcer_on_command_failure,
|
79
|
+
option_accessor :activate_announcer_on_command_failure,
|
80
|
+
contract: { ArrayOf[Symbol] => ArrayOf[Symbol] },
|
81
|
+
default: []
|
67
82
|
option_accessor :allow_absolute_paths, contract: { Bool => Bool }, default: false
|
68
83
|
end
|
69
84
|
end
|
data/lib/aruba/console.rb
CHANGED
@@ -9,7 +9,6 @@ module Aruba
|
|
9
9
|
class Console
|
10
10
|
# Start the aruba console
|
11
11
|
#
|
12
|
-
# rubocop:disable Metrics/MethodLength
|
13
12
|
def start
|
14
13
|
# Start IRB with current context:
|
15
14
|
# http://stackoverflow.com/questions/4189818/how-to-run-irb-start-in-context-of-current-class
|
@@ -63,6 +62,5 @@ module Aruba
|
|
63
62
|
IRB.irb_at_exit
|
64
63
|
end
|
65
64
|
end
|
66
|
-
# rubocop:enable Metrics/MethodLength
|
67
65
|
end
|
68
66
|
end
|
data/lib/aruba/console/help.rb
CHANGED
@@ -10,7 +10,8 @@ module Aruba
|
|
10
10
|
def aruba_help
|
11
11
|
puts 'Aruba Version: ' + Aruba::VERSION
|
12
12
|
puts 'Issue Tracker: ' + 'https://github.com/cucumber/aruba/issues'
|
13
|
-
puts
|
13
|
+
puts 'Documentation:'
|
14
|
+
puts '* http://www.rubydoc.info/gems/aruba'
|
14
15
|
puts
|
15
16
|
|
16
17
|
nil
|
@@ -18,7 +19,9 @@ module Aruba
|
|
18
19
|
|
19
20
|
# List available methods in aruba
|
20
21
|
def aruba_methods
|
21
|
-
ms = (Aruba::Api.instance_methods - Module.instance_methods)
|
22
|
+
ms = (Aruba::Api.instance_methods - Module.instance_methods)
|
23
|
+
.each_with_object([]) { |e, a| a << format('* %s', e) }
|
24
|
+
.sort
|
22
25
|
|
23
26
|
puts "Available Methods:\n" + ms.join("\n")
|
24
27
|
|
@@ -13,8 +13,8 @@ module Aruba
|
|
13
13
|
def self.valid?(value)
|
14
14
|
# explanation for algorithm can be found here:
|
15
15
|
# http://www.exploringbinary.com/ten-ways-to-check-if-an-integer-is-a-power-of-two-in-c/
|
16
|
-
value
|
17
|
-
rescue
|
16
|
+
value.positive? && (value & (value - 1)).zero?
|
17
|
+
rescue StandardError
|
18
18
|
false
|
19
19
|
end
|
20
20
|
end
|
@@ -12,7 +12,8 @@ When(/^I successfully run `(.*?)`(?: for up to ([\d.]+) seconds)?$/) do |cmd, se
|
|
12
12
|
run_command_and_stop(cmd, fail_on_error: true, exit_timeout: secs && secs.to_f)
|
13
13
|
end
|
14
14
|
|
15
|
-
When(/^I run the following (?:commands|script)(?: (?:with|in) `([^`]+)`)?:$/)
|
15
|
+
When(/^I run the following (?:commands|script)(?: (?:with|in) `([^`]+)`)?:$/) \
|
16
|
+
do |shell, commands|
|
16
17
|
full_path = expand_path('bin/myscript')
|
17
18
|
|
18
19
|
Aruba.platform.mkdir(expand_path('bin'))
|
@@ -61,7 +62,8 @@ When(/^I (terminate|stop) the command (?:"([^"]*)"|(?:started last))$/) do |sign
|
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
64
|
-
When(/^I stop the command(?: started last)? if (output|stdout|stderr) contains:$/)
|
65
|
+
When(/^I stop the command(?: started last)? if (output|stdout|stderr) contains:$/) \
|
66
|
+
do |channel, expected|
|
65
67
|
begin
|
66
68
|
Timeout.timeout(aruba.config.exit_timeout) do
|
67
69
|
loop do
|
@@ -119,7 +121,8 @@ Then(/^the output should be (\d+) bytes long$/) do |size|
|
|
119
121
|
end
|
120
122
|
|
121
123
|
## the stderr should contain "hello"
|
122
|
-
Then(/^(?:the )?(output|stderr|stdout) should( not)? contain( exactly)? "([^"]*)"$/)
|
124
|
+
Then(/^(?:the )?(output|stderr|stdout) should( not)? contain( exactly)? "([^"]*)"$/) \
|
125
|
+
do |channel, negated, exactly, expected|
|
123
126
|
combined_output = send("all_#{channel}")
|
124
127
|
|
125
128
|
output_string_matcher = if exactly
|
@@ -136,14 +139,13 @@ Then(/^(?:the )?(output|stderr|stdout) should( not)? contain( exactly)? "([^"]*)
|
|
136
139
|
end
|
137
140
|
|
138
141
|
## the stderr from "echo -n 'Hello'" should contain "hello"
|
139
|
-
Then(
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
when :
|
144
|
-
|
145
|
-
when :
|
146
|
-
:have_output_on_stdout
|
142
|
+
Then(
|
143
|
+
/^(?:the )?(output|stderr|stdout) from "([^"]*)" should contain( exactly)? "([^"]*)"$/
|
144
|
+
) do |channel, cmd, exactly, expected|
|
145
|
+
matcher = case channel
|
146
|
+
when 'output'; then :have_output
|
147
|
+
when 'stderr'; then :have_output_on_stderr
|
148
|
+
when 'stdout'; then :have_output_on_stdout
|
147
149
|
end
|
148
150
|
|
149
151
|
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
@@ -154,15 +156,33 @@ Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should( not)? contain( exa
|
|
154
156
|
:an_output_string_including
|
155
157
|
end
|
156
158
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
159
|
+
expect(command).to send(matcher, send(output_string_matcher, expected))
|
160
|
+
end
|
161
|
+
|
162
|
+
## the stderr from "echo -n 'Hello'" should not contain "hello"
|
163
|
+
Then(
|
164
|
+
/^(?:the )?(output|stderr|stdout) from "([^"]*)" should not contain( exactly)? "([^"]*)"$/
|
165
|
+
) do |channel, cmd, exactly, expected|
|
166
|
+
matcher = case channel
|
167
|
+
when 'output'; then :have_output
|
168
|
+
when 'stderr'; then :have_output_on_stderr
|
169
|
+
when 'stdout'; then :have_output_on_stdout
|
170
|
+
end
|
171
|
+
|
172
|
+
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
173
|
+
|
174
|
+
output_string_matcher = if exactly
|
175
|
+
:an_output_string_being_eq
|
176
|
+
else
|
177
|
+
:an_output_string_including
|
178
|
+
end
|
179
|
+
|
180
|
+
expect(command).not_to send(matcher, send(output_string_matcher, expected))
|
162
181
|
end
|
163
182
|
|
164
183
|
## the stderr should not contain exactly:
|
165
|
-
Then(/^(?:the )?(output|stderr|stdout) should not contain( exactly)?:$/)
|
184
|
+
Then(/^(?:the )?(output|stderr|stdout) should not contain( exactly)?:$/) \
|
185
|
+
do |channel, exactly, expected|
|
166
186
|
combined_output = send("all_#{channel}")
|
167
187
|
|
168
188
|
output_string_matcher = if exactly
|
@@ -175,7 +195,8 @@ Then(/^(?:the )?(output|stderr|stdout) should not contain( exactly)?:$/) do |cha
|
|
175
195
|
end
|
176
196
|
|
177
197
|
## the stderr should contain exactly:
|
178
|
-
Then(/^(?:the )?(output|stderr|stdout) should contain( exactly)?:$/)
|
198
|
+
Then(/^(?:the )?(output|stderr|stdout) should contain( exactly)?:$/) \
|
199
|
+
do |channel, exactly, expected|
|
179
200
|
combined_output = send("all_#{channel}")
|
180
201
|
|
181
202
|
output_string_matcher = if exactly
|
@@ -188,14 +209,12 @@ Then(/^(?:the )?(output|stderr|stdout) should contain( exactly)?:$/) do |channel
|
|
188
209
|
end
|
189
210
|
|
190
211
|
## the stderr from "echo -n 'Hello'" should not contain exactly:
|
191
|
-
Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should not contain( exactly)?:$/)
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
when :
|
196
|
-
|
197
|
-
when :stdout
|
198
|
-
:have_output_on_stdout
|
212
|
+
Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should not contain( exactly)?:$/) \
|
213
|
+
do |channel, cmd, exactly, expected|
|
214
|
+
matcher = case channel
|
215
|
+
when 'output'; then :have_output
|
216
|
+
when 'stderr'; then :have_output_on_stderr
|
217
|
+
when 'stdout'; then :have_output_on_stdout
|
199
218
|
end
|
200
219
|
|
201
220
|
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
@@ -210,14 +229,12 @@ Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should not contain( exactl
|
|
210
229
|
end
|
211
230
|
|
212
231
|
## the stderr from "echo -n 'Hello'" should contain exactly:
|
213
|
-
Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should contain( exactly)?:$/)
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
when :
|
218
|
-
|
219
|
-
when :stdout
|
220
|
-
:have_output_on_stdout
|
232
|
+
Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should contain( exactly)?:$/) \
|
233
|
+
do |channel, cmd, exactly, expected|
|
234
|
+
matcher = case channel
|
235
|
+
when 'output'; then :have_output
|
236
|
+
when 'stderr'; then :have_output_on_stderr
|
237
|
+
when 'stdout'; then :have_output_on_stdout
|
221
238
|
end
|
222
239
|
|
223
240
|
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
@@ -235,34 +252,38 @@ end
|
|
235
252
|
# you don't need regex, use "the output should contain" instead since
|
236
253
|
# that way, you don't have to escape regex characters that
|
237
254
|
# appear naturally in the output
|
238
|
-
Then(
|
255
|
+
Then(%r{^the output should( not)? match /([^/]*)/$}) do |negated, expected|
|
239
256
|
if negated
|
240
|
-
expect(all_commands)
|
257
|
+
expect(all_commands)
|
258
|
+
.not_to include_an_object have_output an_output_string_matching(expected)
|
241
259
|
else
|
242
|
-
expect(all_commands)
|
260
|
+
expect(all_commands)
|
261
|
+
.to include_an_object have_output an_output_string_matching(expected)
|
243
262
|
end
|
244
263
|
end
|
245
264
|
|
246
265
|
Then(/^the output should( not)? match %r<([^>]*)>$/) do |negated, expected|
|
247
266
|
if negated
|
248
|
-
expect(all_commands)
|
267
|
+
expect(all_commands)
|
268
|
+
.not_to include_an_object have_output an_output_string_matching(expected)
|
249
269
|
else
|
250
|
-
expect(all_commands)
|
270
|
+
expect(all_commands)
|
271
|
+
.to include_an_object have_output an_output_string_matching(expected)
|
251
272
|
end
|
252
273
|
end
|
253
274
|
|
254
275
|
Then(/^the output should( not)? match:$/) do |negated, expected|
|
255
276
|
if negated
|
256
|
-
expect(all_commands)
|
277
|
+
expect(all_commands)
|
278
|
+
.not_to include_an_object have_output an_output_string_matching(expected)
|
257
279
|
else
|
258
|
-
expect(all_commands)
|
280
|
+
expect(all_commands)
|
281
|
+
.to include_an_object have_output an_output_string_matching(expected)
|
259
282
|
end
|
260
283
|
end
|
261
284
|
|
262
285
|
Then(/^the exit status should( not)? be (\d+)$/) do |negated, exit_status|
|
263
|
-
if last_command_stopped.nil?
|
264
|
-
last_command_started.stop
|
265
|
-
end
|
286
|
+
last_command_started.stop if last_command_stopped.nil?
|
266
287
|
|
267
288
|
if negated
|
268
289
|
expect(last_command_stopped).not_to have_exit_status exit_status.to_i
|
@@ -368,35 +389,32 @@ Then(/^it should (pass|fail) (?:with regexp?|matching):$/) do |pass_fail, expect
|
|
368
389
|
end
|
369
390
|
|
370
391
|
Then(/^(?:the )?(output|stderr|stdout) should not contain anything$/) do |channel|
|
371
|
-
matcher = case channel
|
372
|
-
when :
|
373
|
-
|
374
|
-
when :
|
375
|
-
:have_output_on_stderr
|
376
|
-
when :stdout
|
377
|
-
:have_output_on_stdout
|
392
|
+
matcher = case channel
|
393
|
+
when 'output'; then :have_output
|
394
|
+
when 'stderr'; then :have_output_on_stderr
|
395
|
+
when 'stdout'; then :have_output_on_stdout
|
378
396
|
end
|
379
397
|
|
380
398
|
expect(all_commands).to include_an_object send(matcher, be_nil.or(be_empty))
|
381
399
|
end
|
382
400
|
|
383
|
-
Then(/^(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:$/)
|
401
|
+
Then(/^(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:$/) \
|
402
|
+
do |channel, negated, table|
|
384
403
|
table.raw.flatten.each do |expected|
|
385
|
-
case channel
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
when :stdout
|
391
|
-
:have_output_on_stdout
|
392
|
-
end
|
404
|
+
_matcher = case channel
|
405
|
+
when 'output'; then :have_output
|
406
|
+
when 'stderr'; then :have_output_on_stderr
|
407
|
+
when 'stdout'; then :have_output_on_stdout
|
408
|
+
end
|
393
409
|
|
394
410
|
# TODO: This isn't actually using the above. It's hardcoded to use have_output only
|
395
411
|
|
396
412
|
if negated
|
397
|
-
expect(all_commands)
|
413
|
+
expect(all_commands)
|
414
|
+
.not_to include_an_object have_output an_output_string_including(expected)
|
398
415
|
else
|
399
|
-
expect(all_commands)
|
416
|
+
expect(all_commands)
|
417
|
+
.to include_an_object have_output an_output_string_including(expected)
|
400
418
|
end
|
401
419
|
end
|
402
420
|
end
|
@@ -417,10 +435,11 @@ Given(/^I wait ([\d.]+) seconds? for (?:a|the) command to start up$/) do |second
|
|
417
435
|
aruba.config.startup_wait_time = seconds.to_f
|
418
436
|
end
|
419
437
|
|
420
|
-
When(/^I send the signal "([^"]*)" to the command (?:"([^"]*)"|(?:started last))$/)
|
438
|
+
When(/^I send the signal "([^"]*)" to the command (?:"([^"]*)"|(?:started last))$/) \
|
439
|
+
do |signal, command|
|
421
440
|
if command
|
422
441
|
cmd = all_commands.find { |c| c.commandline == command }
|
423
|
-
|
442
|
+
raise ArgumentError, %(No command "#{command}" found) if cmd.nil?
|
424
443
|
|
425
444
|
cmd.send_signal signal
|
426
445
|
else
|