aruba 1.0.0.pre.alpha.5 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +153 -28
- data/CONTRIBUTING.md +0 -9
- data/LICENSE +1 -1
- data/README.md +37 -30
- data/lib/aruba/api.rb +0 -1
- data/lib/aruba/api/bundler.rb +17 -2
- data/lib/aruba/api/commands.rb +15 -16
- data/lib/aruba/api/core.rb +64 -50
- data/lib/aruba/api/environment.rb +12 -4
- data/lib/aruba/api/filesystem.rb +32 -46
- data/lib/aruba/api/text.rb +15 -3
- data/lib/aruba/aruba_path.rb +23 -95
- data/lib/aruba/basic_configuration.rb +46 -65
- data/lib/aruba/basic_configuration/option.rb +2 -2
- data/lib/aruba/cli.rb +4 -1
- data/lib/aruba/config/jruby.rb +1 -1
- data/lib/aruba/config_wrapper.rb +17 -4
- data/lib/aruba/configuration.rb +29 -22
- data/lib/aruba/console.rb +0 -2
- data/lib/aruba/console/help.rb +8 -5
- data/lib/aruba/contracts/absolute_path.rb +3 -3
- data/lib/aruba/contracts/is_power_of_two.rb +2 -2
- data/lib/aruba/contracts/relative_path.rb +3 -3
- data/lib/aruba/cucumber/command.rb +93 -82
- data/lib/aruba/cucumber/file.rb +43 -23
- 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 +9 -3
- data/lib/aruba/matchers/base/base_matcher.rb +2 -11
- data/lib/aruba/matchers/base/message_indenter.rb +1 -1
- data/lib/aruba/matchers/base/object_formatter.rb +0 -5
- 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 +7 -4
- data/lib/aruba/platforms/announcer.rb +25 -11
- 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/aruba_logger.rb +10 -9
- data/lib/aruba/platforms/command_monitor.rb +4 -6
- data/lib/aruba/platforms/determine_disk_usage.rb +55 -20
- data/lib/aruba/platforms/filesystem_status.rb +19 -13
- data/lib/aruba/platforms/simple_table.rb +2 -2
- data/lib/aruba/platforms/unix_environment_variables.rb +9 -4
- data/lib/aruba/platforms/unix_platform.rb +10 -10
- data/lib/aruba/platforms/unix_which.rb +1 -1
- data/lib/aruba/platforms/windows_command_string.rb +1 -1
- data/lib/aruba/platforms/windows_environment_variables.rb +2 -1
- data/lib/aruba/platforms/windows_platform.rb +3 -3
- data/lib/aruba/platforms/windows_which.rb +6 -2
- data/lib/aruba/processes/basic_process.rb +4 -6
- data/lib/aruba/processes/debug_process.rb +4 -2
- data/lib/aruba/processes/in_process.rb +5 -3
- data/lib/aruba/processes/spawn_process.rb +27 -16
- 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 +96 -109
- data/.cucumberproignore +0 -3
- data/.document +0 -5
- data/.github/ISSUE_TEMPLATE.md +0 -48
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -41
- data/.gitignore +0 -38
- data/.rspec +0 -3
- data/.rubocop.yml +0 -31
- data/.rubocop_todo.yml +0 -258
- data/.simplecov +0 -34
- data/.travis.yml +0 -73
- data/.yardopts +0 -11
- data/Dockerfile +0 -67
- data/Gemfile +0 -15
- data/Rakefile +0 -92
- data/TODO.md +0 -13
- data/appveyor.yml +0 -30
- data/aruba.gemspec +0 -46
- data/bin/console +0 -7
- data/bin/test +0 -9
- data/config/.gitignore +0 -1
- data/cucumber.yml +0 -6
- data/docker-compose.yml +0 -26
- data/fixtures/cli-app/.gitignore +0 -9
- data/fixtures/cli-app/.rspec +0 -2
- data/fixtures/cli-app/README.md +0 -39
- data/fixtures/cli-app/Rakefile +0 -1
- data/fixtures/cli-app/bin/aruba-test-cli +0 -6
- data/fixtures/cli-app/cli-app.gemspec +0 -25
- data/fixtures/cli-app/features/support/aruba.rb +0 -1
- data/fixtures/cli-app/features/support/env.rb +0 -1
- data/fixtures/cli-app/lib/cli/app.rb +0 -9
- data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +0 -15
- data/fixtures/cli-app/lib/cli/app/version.rb +0 -5
- data/fixtures/cli-app/script/console +0 -14
- data/fixtures/cli-app/spec/spec_helper.rb +0 -7
- data/fixtures/cli-app/spec/support/aruba.rb +0 -1
- data/fixtures/copy/file.txt +0 -1
- data/fixtures/empty-app/.gitignore +0 -9
- data/fixtures/empty-app/.rspec +0 -2
- data/fixtures/empty-app/README.md +0 -24
- data/fixtures/empty-app/Rakefile +0 -1
- data/fixtures/empty-app/cli-app.gemspec +0 -25
- data/fixtures/empty-app/lib/cli/app.rb +0 -7
- data/fixtures/empty-app/lib/cli/app/version.rb +0 -5
- data/fixtures/getting-started-app/.gitignore +0 -4
- data/fixtures/getting-started-app/Gemfile +0 -4
- data/fixtures/getting-started-app/README.md +0 -3
- data/fixtures/getting-started-app/features/support/env.rb +0 -1
- data/lib/aruba/extensions/string/strip.rb +0 -25
- data/lib/aruba/platforms/disk_usage_calculator.rb +0 -20
data/lib/aruba/configuration.rb
CHANGED
@@ -17,52 +17,59 @@ module Aruba
|
|
17
17
|
#
|
18
18
|
# This defines the configuration options of aruba
|
19
19
|
class Configuration < BasicConfiguration
|
20
|
-
option_reader :root_directory,
|
20
|
+
option_reader :root_directory, type: String, default: Dir.getwd
|
21
21
|
|
22
22
|
option_accessor :working_directory,
|
23
|
-
|
23
|
+
type: Aruba::Contracts::RelativePath,
|
24
24
|
default: 'tmp/aruba'
|
25
25
|
|
26
|
-
option_reader :fixtures_path_prefix,
|
26
|
+
option_reader :fixtures_path_prefix, type: String, default: '%'
|
27
27
|
|
28
|
-
option_accessor :exit_timeout,
|
29
|
-
option_accessor :stop_signal,
|
30
|
-
option_accessor :io_wait_timeout,
|
31
|
-
option_accessor :startup_wait_time,
|
28
|
+
option_accessor :exit_timeout, type: Num, default: 15
|
29
|
+
option_accessor :stop_signal, type: Maybe[String], default: nil
|
30
|
+
option_accessor :io_wait_timeout, type: Num, default: 0.1
|
31
|
+
option_accessor :startup_wait_time, type: Num, default: 0
|
32
32
|
option_accessor :fixtures_directories,
|
33
|
-
|
33
|
+
type: ArrayOf[String],
|
34
34
|
default: %w(features/fixtures spec/fixtures test/fixtures fixtures)
|
35
35
|
|
36
|
-
option_accessor :command_runtime_environment,
|
36
|
+
option_accessor :command_runtime_environment, type: Hash, default: {}
|
37
37
|
option_accessor :command_search_paths,
|
38
|
-
|
39
|
-
[File.join(config.root_directory.value, 'bin'),
|
38
|
+
type: ArrayOf[String] do |config|
|
39
|
+
[File.join(config.root_directory.value, 'bin'),
|
40
|
+
File.join(config.root_directory.value, 'exe')]
|
40
41
|
end
|
41
|
-
option_accessor :remove_ansi_escape_sequences,
|
42
|
+
option_accessor :remove_ansi_escape_sequences, type: Bool, default: true
|
42
43
|
option_accessor :command_launcher,
|
43
|
-
|
44
|
+
type: Aruba::Contracts::Enum[:in_process, :spawn, :debug],
|
44
45
|
default: :spawn
|
45
|
-
option_accessor :main_class,
|
46
|
+
option_accessor :main_class, type: Maybe[Class], default: nil
|
46
47
|
|
47
48
|
option_accessor :home_directory,
|
48
|
-
|
49
|
-
|
50
|
-
|
49
|
+
type: Or[Aruba::Contracts::AbsolutePath,
|
50
|
+
Aruba::Contracts::RelativePath] do |config|
|
51
|
+
File.join(config.root_directory.value, config.working_directory.value)
|
52
|
+
end
|
51
53
|
|
52
54
|
option_accessor :log_level,
|
53
|
-
|
55
|
+
type:
|
56
|
+
Aruba::Contracts::Enum[:fatal, :warn, :debug, :info,
|
57
|
+
:error, :unknown, :silent],
|
54
58
|
default: :info
|
55
59
|
|
56
60
|
# TODO: deprecate this value and replace with "filesystem allocation unit"
|
57
61
|
# equal to 4096 by default. "filesystem allocation unit" would represent
|
58
62
|
# the actual MINIMUM space taken in bytes by a 1-byte file
|
59
63
|
option_accessor :physical_block_size,
|
60
|
-
|
64
|
+
type: Aruba::Contracts::IsPowerOfTwo,
|
61
65
|
default: 512
|
62
|
-
option_accessor :console_history_file,
|
66
|
+
option_accessor :console_history_file, type: String,
|
67
|
+
default: '~/.aruba_history'
|
63
68
|
|
64
|
-
option_accessor :activate_announcer_on_command_failure,
|
65
|
-
|
69
|
+
option_accessor :activate_announcer_on_command_failure,
|
70
|
+
type: ArrayOf[Symbol],
|
71
|
+
default: []
|
72
|
+
option_accessor :allow_absolute_paths, type: Bool, default: false
|
66
73
|
end
|
67
74
|
end
|
68
75
|
|
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
@@ -8,9 +8,10 @@ module Aruba
|
|
8
8
|
module Help
|
9
9
|
# Output help information
|
10
10
|
def aruba_help
|
11
|
-
puts
|
12
|
-
puts 'Issue Tracker:
|
13
|
-
puts
|
11
|
+
puts "Aruba Version: #{Aruba::VERSION}"
|
12
|
+
puts 'Issue Tracker: https://github.com/cucumber/aruba/issues'
|
13
|
+
puts 'Documentation:'
|
14
|
+
puts '* http://www.rubydoc.info/gems/aruba'
|
14
15
|
puts
|
15
16
|
|
16
17
|
nil
|
@@ -18,9 +19,11 @@ 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
|
-
puts "Available Methods:\n
|
26
|
+
puts "Available Methods:\n#{ms.join("\n")}"
|
24
27
|
|
25
28
|
nil
|
26
29
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'aruba/
|
1
|
+
require 'aruba/platform'
|
2
2
|
|
3
3
|
# Aruba
|
4
4
|
module Aruba
|
@@ -11,8 +11,8 @@ module Aruba
|
|
11
11
|
# @param [Object] value
|
12
12
|
# The value to be checked
|
13
13
|
def self.valid?(value)
|
14
|
-
|
15
|
-
rescue
|
14
|
+
Aruba.platform.absolute_path? value
|
15
|
+
rescue StandardError
|
16
16
|
false
|
17
17
|
end
|
18
18
|
end
|
@@ -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
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'aruba/
|
1
|
+
require 'aruba/platform'
|
2
2
|
|
3
3
|
# Aruba
|
4
4
|
module Aruba
|
@@ -11,8 +11,8 @@ module Aruba
|
|
11
11
|
# @param [String] value
|
12
12
|
# The path to be checked
|
13
13
|
def self.valid?(value)
|
14
|
-
|
15
|
-
rescue
|
14
|
+
Aruba.platform.relative_path? value
|
15
|
+
rescue StandardError
|
16
16
|
false
|
17
17
|
end
|
18
18
|
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
|
@@ -86,30 +88,22 @@ end
|
|
86
88
|
|
87
89
|
When(/^I wait for (?:output|stdout) to contain:$/) do |expected|
|
88
90
|
Timeout.timeout(aruba.config.exit_timeout) do
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
retry
|
95
|
-
end
|
96
|
-
|
97
|
-
break
|
91
|
+
begin
|
92
|
+
expect(last_command_started).to have_output an_output_string_including(expected)
|
93
|
+
rescue ExpectationError
|
94
|
+
sleep 0.1
|
95
|
+
retry
|
98
96
|
end
|
99
97
|
end
|
100
98
|
end
|
101
99
|
|
102
100
|
When(/^I wait for (?:output|stdout) to contain "([^"]*)"$/) do |expected|
|
103
101
|
Timeout.timeout(aruba.config.exit_timeout) do
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
retry
|
110
|
-
end
|
111
|
-
|
112
|
-
break
|
102
|
+
begin
|
103
|
+
expect(last_command_started).to have_output an_output_string_including(expected)
|
104
|
+
rescue ExpectationError
|
105
|
+
sleep 0.1
|
106
|
+
retry
|
113
107
|
end
|
114
108
|
end
|
115
109
|
end
|
@@ -119,7 +113,8 @@ Then(/^the output should be (\d+) bytes long$/) do |size|
|
|
119
113
|
end
|
120
114
|
|
121
115
|
## the stderr should contain "hello"
|
122
|
-
Then(/^(?:the )?(output|stderr|stdout) should( not)? contain( exactly)? "([^"]*)"$/)
|
116
|
+
Then(/^(?:the )?(output|stderr|stdout) should( not)? contain( exactly)? "([^"]*)"$/) \
|
117
|
+
do |channel, negated, exactly, expected|
|
123
118
|
combined_output = send("all_#{channel}")
|
124
119
|
|
125
120
|
output_string_matcher = if exactly
|
@@ -136,14 +131,13 @@ Then(/^(?:the )?(output|stderr|stdout) should( not)? contain( exactly)? "([^"]*)
|
|
136
131
|
end
|
137
132
|
|
138
133
|
## the stderr from "echo -n 'Hello'" should contain "hello"
|
139
|
-
Then(
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
when :
|
144
|
-
|
145
|
-
when :
|
146
|
-
:have_output_on_stdout
|
134
|
+
Then(
|
135
|
+
/^(?:the )?(output|stderr|stdout) from "([^"]*)" should contain( exactly)? "([^"]*)"$/
|
136
|
+
) do |channel, cmd, exactly, expected|
|
137
|
+
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
|
147
141
|
end
|
148
142
|
|
149
143
|
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
@@ -154,15 +148,33 @@ Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should( not)? contain( exa
|
|
154
148
|
:an_output_string_including
|
155
149
|
end
|
156
150
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
151
|
+
expect(command).to send(matcher, send(output_string_matcher, expected))
|
152
|
+
end
|
153
|
+
|
154
|
+
## 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|
|
158
|
+
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
|
162
|
+
end
|
163
|
+
|
164
|
+
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
165
|
+
|
166
|
+
output_string_matcher = if exactly
|
167
|
+
:an_output_string_being_eq
|
168
|
+
else
|
169
|
+
:an_output_string_including
|
170
|
+
end
|
171
|
+
|
172
|
+
expect(command).not_to send(matcher, send(output_string_matcher, expected))
|
162
173
|
end
|
163
174
|
|
164
175
|
## the stderr should not contain exactly:
|
165
|
-
Then(/^(?:the )?(output|stderr|stdout) should not contain( exactly)?:$/)
|
176
|
+
Then(/^(?:the )?(output|stderr|stdout) should not contain( exactly)?:$/) \
|
177
|
+
do |channel, exactly, expected|
|
166
178
|
combined_output = send("all_#{channel}")
|
167
179
|
|
168
180
|
output_string_matcher = if exactly
|
@@ -175,7 +187,8 @@ Then(/^(?:the )?(output|stderr|stdout) should not contain( exactly)?:$/) do |cha
|
|
175
187
|
end
|
176
188
|
|
177
189
|
## the stderr should contain exactly:
|
178
|
-
Then(/^(?:the )?(output|stderr|stdout) should contain( exactly)?:$/)
|
190
|
+
Then(/^(?:the )?(output|stderr|stdout) should contain( exactly)?:$/) \
|
191
|
+
do |channel, exactly, expected|
|
179
192
|
combined_output = send("all_#{channel}")
|
180
193
|
|
181
194
|
output_string_matcher = if exactly
|
@@ -188,14 +201,12 @@ Then(/^(?:the )?(output|stderr|stdout) should contain( exactly)?:$/) do |channel
|
|
188
201
|
end
|
189
202
|
|
190
203
|
## 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
|
204
|
+
Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should not contain( exactly)?:$/) \
|
205
|
+
do |channel, cmd, exactly, expected|
|
206
|
+
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
|
199
210
|
end
|
200
211
|
|
201
212
|
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
@@ -210,14 +221,12 @@ Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should not contain( exactl
|
|
210
221
|
end
|
211
222
|
|
212
223
|
## 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
|
224
|
+
Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should contain( exactly)?:$/) \
|
225
|
+
do |channel, cmd, exactly, expected|
|
226
|
+
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
|
221
230
|
end
|
222
231
|
|
223
232
|
command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
|
@@ -235,34 +244,38 @@ end
|
|
235
244
|
# you don't need regex, use "the output should contain" instead since
|
236
245
|
# that way, you don't have to escape regex characters that
|
237
246
|
# appear naturally in the output
|
238
|
-
Then(
|
247
|
+
Then(%r{^the output should( not)? match /([^/]*)/$}) do |negated, expected|
|
239
248
|
if negated
|
240
|
-
expect(all_commands)
|
249
|
+
expect(all_commands)
|
250
|
+
.not_to include_an_object have_output an_output_string_matching(expected)
|
241
251
|
else
|
242
|
-
expect(all_commands)
|
252
|
+
expect(all_commands)
|
253
|
+
.to include_an_object have_output an_output_string_matching(expected)
|
243
254
|
end
|
244
255
|
end
|
245
256
|
|
246
257
|
Then(/^the output should( not)? match %r<([^>]*)>$/) do |negated, expected|
|
247
258
|
if negated
|
248
|
-
expect(all_commands)
|
259
|
+
expect(all_commands)
|
260
|
+
.not_to include_an_object have_output an_output_string_matching(expected)
|
249
261
|
else
|
250
|
-
expect(all_commands)
|
262
|
+
expect(all_commands)
|
263
|
+
.to include_an_object have_output an_output_string_matching(expected)
|
251
264
|
end
|
252
265
|
end
|
253
266
|
|
254
267
|
Then(/^the output should( not)? match:$/) do |negated, expected|
|
255
268
|
if negated
|
256
|
-
expect(all_commands)
|
269
|
+
expect(all_commands)
|
270
|
+
.not_to include_an_object have_output an_output_string_matching(expected)
|
257
271
|
else
|
258
|
-
expect(all_commands)
|
272
|
+
expect(all_commands)
|
273
|
+
.to include_an_object have_output an_output_string_matching(expected)
|
259
274
|
end
|
260
275
|
end
|
261
276
|
|
262
277
|
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
|
278
|
+
last_command_started.stop if last_command_stopped.nil?
|
266
279
|
|
267
280
|
if negated
|
268
281
|
expect(last_command_stopped).not_to have_exit_status exit_status.to_i
|
@@ -368,35 +381,32 @@ Then(/^it should (pass|fail) (?:with regexp?|matching):$/) do |pass_fail, expect
|
|
368
381
|
end
|
369
382
|
|
370
383
|
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
|
384
|
+
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
|
378
388
|
end
|
379
389
|
|
380
390
|
expect(all_commands).to include_an_object send(matcher, be_nil.or(be_empty))
|
381
391
|
end
|
382
392
|
|
383
|
-
Then(/^(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:$/)
|
393
|
+
Then(/^(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:$/) \
|
394
|
+
do |channel, negated, table|
|
384
395
|
table.raw.flatten.each do |expected|
|
385
|
-
case channel
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
when :stdout
|
391
|
-
:have_output_on_stdout
|
392
|
-
end
|
396
|
+
_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
|
400
|
+
end
|
393
401
|
|
394
402
|
# TODO: This isn't actually using the above. It's hardcoded to use have_output only
|
395
403
|
|
396
404
|
if negated
|
397
|
-
expect(all_commands)
|
405
|
+
expect(all_commands)
|
406
|
+
.not_to include_an_object have_output an_output_string_including(expected)
|
398
407
|
else
|
399
|
-
expect(all_commands)
|
408
|
+
expect(all_commands)
|
409
|
+
.to include_an_object have_output an_output_string_including(expected)
|
400
410
|
end
|
401
411
|
end
|
402
412
|
end
|
@@ -417,10 +427,11 @@ Given(/^I wait ([\d.]+) seconds? for (?:a|the) command to start up$/) do |second
|
|
417
427
|
aruba.config.startup_wait_time = seconds.to_f
|
418
428
|
end
|
419
429
|
|
420
|
-
When(/^I send the signal "([^"]*)" to the command (?:"([^"]*)"|(?:started last))$/)
|
430
|
+
When(/^I send the signal "([^"]*)" to the command (?:"([^"]*)"|(?:started last))$/) \
|
431
|
+
do |signal, command|
|
421
432
|
if command
|
422
433
|
cmd = all_commands.find { |c| c.commandline == command }
|
423
|
-
|
434
|
+
raise ArgumentError, %(No command "#{command}" found) if cmd.nil?
|
424
435
|
|
425
436
|
cmd.send_signal signal
|
426
437
|
else
|