aruba 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +72 -1
- data/CONTRIBUTING.md +11 -31
- data/README.md +1 -2
- data/exe/aruba +2 -2
- data/lib/aruba.rb +1 -1
- data/lib/aruba/api.rb +11 -12
- data/lib/aruba/api/bundler.rb +18 -3
- data/lib/aruba/api/commands.rb +19 -22
- data/lib/aruba/api/core.rb +65 -48
- data/lib/aruba/api/environment.rb +13 -5
- data/lib/aruba/api/filesystem.rb +69 -39
- data/lib/aruba/api/text.rb +15 -3
- data/lib/aruba/aruba_path.rb +3 -4
- data/lib/aruba/basic_configuration.rb +52 -71
- data/lib/aruba/basic_configuration/option.rb +2 -2
- data/lib/aruba/cli.rb +9 -6
- data/lib/aruba/command.rb +4 -4
- data/lib/aruba/config/jruby.rb +9 -9
- data/lib/aruba/config_wrapper.rb +17 -2
- data/lib/aruba/configuration.rb +37 -32
- data/lib/aruba/console.rb +11 -13
- data/lib/aruba/console/help.rb +9 -6
- data/lib/aruba/contracts/absolute_path.rb +2 -2
- data/lib/aruba/contracts/enum.rb +1 -1
- data/lib/aruba/contracts/is_power_of_two.rb +3 -3
- data/lib/aruba/contracts/relative_path.rb +2 -2
- data/lib/aruba/cucumber.rb +7 -7
- data/lib/aruba/cucumber/command.rb +106 -95
- data/lib/aruba/cucumber/environment.rb +7 -7
- data/lib/aruba/cucumber/file.rb +50 -26
- data/lib/aruba/cucumber/hooks.rb +32 -29
- data/lib/aruba/cucumber/testing_frameworks.rb +32 -30
- data/lib/aruba/event_bus.rb +6 -4
- data/lib/aruba/event_bus/name_resolver.rb +12 -11
- data/lib/aruba/events.rb +2 -1
- data/lib/aruba/file_size.rb +1 -1
- data/lib/aruba/generators/script_file.rb +2 -2
- data/lib/aruba/hooks.rb +2 -4
- data/lib/aruba/in_config_wrapper.rb +8 -5
- data/lib/aruba/initializer.rb +14 -12
- data/lib/aruba/matchers/base/base_matcher.rb +3 -12
- data/lib/aruba/matchers/base/message_indenter.rb +2 -2
- data/lib/aruba/matchers/base/object_formatter.rb +2 -5
- data/lib/aruba/matchers/collection.rb +1 -1
- data/lib/aruba/matchers/collection/all.rb +1 -1
- data/lib/aruba/matchers/collection/include_an_object.rb +6 -6
- data/lib/aruba/matchers/command.rb +1 -1
- data/lib/aruba/matchers/command/be_successfully_executed.rb +6 -4
- data/lib/aruba/matchers/command/have_exit_status.rb +3 -1
- data/lib/aruba/matchers/command/have_finished_in_time.rb +4 -2
- data/lib/aruba/matchers/command/have_output.rb +4 -2
- 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.rb +1 -1
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +2 -2
- data/lib/aruba/matchers/directory/have_sub_directory.rb +9 -4
- data/lib/aruba/matchers/environment.rb +1 -1
- data/lib/aruba/matchers/file.rb +1 -1
- data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +1 -1
- data/lib/aruba/matchers/file/be_an_existing_executable.rb +2 -2
- data/lib/aruba/matchers/file/be_an_existing_file.rb +2 -2
- data/lib/aruba/matchers/file/have_file_content.rb +1 -1
- data/lib/aruba/matchers/file/have_file_size.rb +5 -3
- data/lib/aruba/matchers/file/have_same_file_content.rb +2 -2
- data/lib/aruba/matchers/path.rb +1 -1
- data/lib/aruba/matchers/path/a_path_matching_pattern.rb +1 -1
- data/lib/aruba/matchers/path/be_an_absolute_path.rb +1 -1
- data/lib/aruba/matchers/path/be_an_existing_path.rb +1 -1
- data/lib/aruba/matchers/path/have_permissions.rb +9 -6
- data/lib/aruba/matchers/string.rb +1 -1
- data/lib/aruba/matchers/string/include_output_string.rb +1 -1
- data/lib/aruba/matchers/string/match_output_string.rb +1 -1
- data/lib/aruba/matchers/string/output_string_eq.rb +1 -1
- data/lib/aruba/platform.rb +2 -2
- data/lib/aruba/platforms/announcer.rb +29 -17
- 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 +11 -10
- data/lib/aruba/platforms/command_monitor.rb +7 -9
- data/lib/aruba/platforms/determine_disk_usage.rb +2 -4
- data/lib/aruba/platforms/filesystem_status.rb +20 -14
- data/lib/aruba/platforms/simple_table.rb +3 -3
- data/lib/aruba/platforms/unix_command_string.rb +2 -2
- data/lib/aruba/platforms/unix_environment_variables.rb +2 -4
- data/lib/aruba/platforms/unix_platform.rb +23 -23
- data/lib/aruba/platforms/unix_which.rb +2 -2
- data/lib/aruba/platforms/windows_command_string.rb +2 -2
- data/lib/aruba/platforms/windows_environment_variables.rb +3 -2
- data/lib/aruba/platforms/windows_platform.rb +7 -7
- data/lib/aruba/platforms/windows_which.rb +8 -4
- data/lib/aruba/processes/basic_process.rb +4 -4
- data/lib/aruba/processes/debug_process.rb +5 -3
- data/lib/aruba/processes/in_process.rb +10 -8
- data/lib/aruba/processes/spawn_process.rb +28 -25
- data/lib/aruba/rspec.rb +30 -20
- data/lib/aruba/runtime.rb +16 -9
- data/lib/aruba/setup.rb +25 -12
- data/lib/aruba/version.rb +1 -1
- metadata +77 -88
- 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 -262
- data/.simplecov +0 -36
- data/.travis.yml +0 -62
- data/.yardopts +0 -11
- data/Dockerfile +0 -67
- data/Gemfile +0 -12
- data/Rakefile +0 -80
- data/TODO.md +0 -13
- data/appveyor.yml +0 -29
- data/aruba.gemspec +0 -54
- 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/tasks/docker_helpers.rb +0 -154
data/lib/aruba/event_bus.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "aruba/event_bus/name_resolver"
|
2
|
+
require "aruba/errors"
|
3
3
|
|
4
4
|
module Aruba
|
5
5
|
# Event bus
|
@@ -33,7 +33,9 @@ module Aruba
|
|
33
33
|
def register(event_ids, handler_object = nil, &handler_proc)
|
34
34
|
handler = handler_proc || handler_object
|
35
35
|
|
36
|
-
|
36
|
+
if handler.nil? || !handler.respond_to?(:call)
|
37
|
+
raise ArgumentError, "Please pass either an object#call or a handler block"
|
38
|
+
end
|
37
39
|
|
38
40
|
Array(event_ids).flatten.each do |id|
|
39
41
|
@handlers[
|
@@ -51,7 +53,7 @@ module Aruba
|
|
51
53
|
# handler.
|
52
54
|
#
|
53
55
|
def notify(event)
|
54
|
-
|
56
|
+
raise NoEventError, "Please pass an event object, not a class" if event.is_a?(Class)
|
55
57
|
|
56
58
|
@handlers[event.class.to_s].each { |handler| handler.call(event) }
|
57
59
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "aruba/errors"
|
2
2
|
|
3
3
|
# Event notification library
|
4
4
|
module Aruba
|
@@ -10,16 +10,16 @@ module Aruba
|
|
10
10
|
# Helpers for Resolvers
|
11
11
|
module ResolveHelpers
|
12
12
|
def camel_case(underscored_name)
|
13
|
-
underscored_name.to_s.split(
|
13
|
+
underscored_name.to_s.split("_").map { |word| word.upcase[0] + word[1..-1] }.join
|
14
14
|
end
|
15
15
|
|
16
16
|
# Thanks ActiveSupport
|
17
17
|
# (Only needed to support Ruby 1.9.3 and JRuby)
|
18
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
19
18
|
def constantize(camel_cased_word)
|
20
|
-
names = camel_cased_word.split(
|
19
|
+
names = camel_cased_word.split("::")
|
21
20
|
|
22
|
-
# Trigger a built-in NameError exception including the ill-formed
|
21
|
+
# Trigger a built-in NameError exception including the ill-formed
|
22
|
+
# constant in the message.
|
23
23
|
Object.const_get(camel_cased_word) if names.empty?
|
24
24
|
|
25
25
|
# Remove the first blank element in case of '::ClassName' notation.
|
@@ -49,7 +49,6 @@ module Aruba
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
52
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
53
52
|
end
|
54
53
|
|
55
54
|
# @private
|
@@ -120,7 +119,8 @@ module Aruba
|
|
120
119
|
class FailingResolver
|
121
120
|
class << self
|
122
121
|
def match?(event_id)
|
123
|
-
|
122
|
+
raise ArgumentError,
|
123
|
+
%(Input type "#{event_id.class}" of event_id "#{event_id}" is invalid)
|
124
124
|
end
|
125
125
|
|
126
126
|
def supports
|
@@ -147,10 +147,11 @@ module Aruba
|
|
147
147
|
|
148
148
|
def transform(event_id)
|
149
149
|
resolvers.find { |r| r.match? event_id }.new.transform(default_namespace, event_id)
|
150
|
-
rescue => e
|
151
|
-
|
152
|
-
|
153
|
-
|
150
|
+
rescue StandardError => e
|
151
|
+
types = @resolvers.map(&:supports).flatten.join(", ")
|
152
|
+
message = "Transforming \"#{event_id}\" into an event class failed." \
|
153
|
+
" Supported types are: #{types}. #{e.message}."
|
154
|
+
raise EventNameResolveError, message, cause: e
|
154
155
|
end
|
155
156
|
end
|
156
157
|
end
|
data/lib/aruba/events.rb
CHANGED
@@ -4,7 +4,8 @@ module Aruba
|
|
4
4
|
module Events
|
5
5
|
# Basic event
|
6
6
|
#
|
7
|
-
# This is not meant for direct use - BasicEvent.new - by users. It is
|
7
|
+
# This is not meant for direct use - BasicEvent.new - by users. It is
|
8
|
+
# inherited by normal events
|
8
9
|
#
|
9
10
|
# @private
|
10
11
|
class BasicEvent
|
data/lib/aruba/file_size.rb
CHANGED
@@ -23,7 +23,7 @@ module Aruba
|
|
23
23
|
|
24
24
|
def header
|
25
25
|
if script_starts_with_shebang?
|
26
|
-
|
26
|
+
""
|
27
27
|
elsif interpreter_is_absolute_path?
|
28
28
|
format("#!%s\n", interpreter)
|
29
29
|
elsif interpreter_is_just_the_name_of_shell?
|
@@ -40,7 +40,7 @@ module Aruba
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def script_starts_with_shebang?
|
43
|
-
content.start_with?
|
43
|
+
content.start_with? "#!"
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
data/lib/aruba/hooks.rb
CHANGED
@@ -21,12 +21,10 @@ module Aruba
|
|
21
21
|
# @param [Proc] block
|
22
22
|
# The block which should be run for the hook
|
23
23
|
def append(label, block)
|
24
|
-
|
25
|
-
store[label.to_sym] << block
|
26
|
-
else
|
24
|
+
unless store.key?(label.to_sym) && store[label.to_sym].respond_to?(:<<)
|
27
25
|
store[label.to_sym] = []
|
28
|
-
store[label.to_sym] << block
|
29
26
|
end
|
27
|
+
store[label.to_sym] << block
|
30
28
|
end
|
31
29
|
|
32
30
|
# Run hook
|
@@ -15,14 +15,17 @@ module Aruba
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def method_missing(name, *args)
|
18
|
-
|
19
|
-
|
18
|
+
if config.key? name
|
19
|
+
raise ArgumentError, "Options take no argument" if args.any?
|
20
20
|
|
21
|
-
|
21
|
+
config[name]
|
22
|
+
else
|
23
|
+
super
|
24
|
+
end
|
22
25
|
end
|
23
26
|
|
24
|
-
def respond_to_missing?(
|
25
|
-
|
27
|
+
def respond_to_missing?(name, _include_private)
|
28
|
+
config.key? name
|
26
29
|
end
|
27
30
|
end
|
28
31
|
end
|
data/lib/aruba/initializer.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "thor/group"
|
2
|
+
require "thor/actions"
|
3
3
|
|
4
4
|
# Aruba
|
5
5
|
module Aruba
|
@@ -15,7 +15,7 @@ module Aruba
|
|
15
15
|
|
16
16
|
# Add gem to gemfile
|
17
17
|
def add_gem
|
18
|
-
file =
|
18
|
+
file = "Gemfile"
|
19
19
|
creator = if File.exist? file
|
20
20
|
:append_to_file
|
21
21
|
else
|
@@ -23,9 +23,10 @@ module Aruba
|
|
23
23
|
end
|
24
24
|
|
25
25
|
content = if File.exist? file
|
26
|
-
file_ends_with_carriage_return =
|
26
|
+
file_ends_with_carriage_return =
|
27
|
+
File.open(file, "r").readlines.last.match(/.*\n$/)
|
27
28
|
|
28
|
-
prefix = file_ends_with_carriage_return ?
|
29
|
+
prefix = file_ends_with_carriage_return ? "" : "\n"
|
29
30
|
|
30
31
|
%(#{prefix}gem 'aruba', '~> #{Aruba::VERSION}')
|
31
32
|
else
|
@@ -53,7 +54,8 @@ module Aruba
|
|
53
54
|
end
|
54
55
|
|
55
56
|
def start(*)
|
56
|
-
|
57
|
+
raise ArgumentError,
|
58
|
+
%(Unknown test framework. Please use one of :rspec, :cucumber or :minitest)
|
57
59
|
end
|
58
60
|
end
|
59
61
|
end
|
@@ -77,7 +79,7 @@ module Aruba
|
|
77
79
|
end
|
78
80
|
|
79
81
|
def create_helper
|
80
|
-
file =
|
82
|
+
file = "spec/spec_helper.rb"
|
81
83
|
creator = if File.exist? file
|
82
84
|
:append_to_file
|
83
85
|
else
|
@@ -93,7 +95,7 @@ module Aruba
|
|
93
95
|
end
|
94
96
|
|
95
97
|
def create_support_file
|
96
|
-
create_file
|
98
|
+
create_file "spec/support/aruba.rb", <<~EOS
|
97
99
|
require 'aruba/rspec'
|
98
100
|
EOS
|
99
101
|
end
|
@@ -118,7 +120,7 @@ module Aruba
|
|
118
120
|
end
|
119
121
|
|
120
122
|
def create_support_file
|
121
|
-
create_file
|
123
|
+
create_file "features/support/aruba.rb", <<~EOS
|
122
124
|
require 'aruba/cucumber'
|
123
125
|
EOS
|
124
126
|
end
|
@@ -143,7 +145,7 @@ module Aruba
|
|
143
145
|
end
|
144
146
|
|
145
147
|
def create_helper
|
146
|
-
file =
|
148
|
+
file = "test/test_helper.rb"
|
147
149
|
creator = if File.exist? file
|
148
150
|
:append_to_file
|
149
151
|
else
|
@@ -159,7 +161,7 @@ module Aruba
|
|
159
161
|
end
|
160
162
|
|
161
163
|
def create_example
|
162
|
-
create_file
|
164
|
+
create_file "test/use_aruba_with_minitest.rb", <<~EOS
|
163
165
|
$LOAD_PATH.unshift File.expand_path('../test', __FILE__)
|
164
166
|
|
165
167
|
require 'test_helper'
|
@@ -206,7 +208,7 @@ module Aruba
|
|
206
208
|
begin
|
207
209
|
initializers.find { |i| i.match? test_framework }.start [], {}
|
208
210
|
rescue ArgumentError => e
|
209
|
-
|
211
|
+
warn e.message
|
210
212
|
exit 0
|
211
213
|
end
|
212
214
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "aruba/matchers/base/object_formatter"
|
2
2
|
|
3
3
|
# Aruba
|
4
4
|
module Aruba
|
@@ -33,6 +33,8 @@ module Aruba
|
|
33
33
|
|
34
34
|
# @private
|
35
35
|
module HashFormatting
|
36
|
+
module_function
|
37
|
+
|
36
38
|
# `{ :a => 5, :b => 2 }.inspect` produces:
|
37
39
|
#
|
38
40
|
# {:a=>5, :b=>2}
|
@@ -45,7 +47,6 @@ module Aruba
|
|
45
47
|
def improve_hash_formatting(inspect_string)
|
46
48
|
inspect_string.gsub(/(\S)=>(\S)/, '\1 => \2')
|
47
49
|
end
|
48
|
-
module_function :improve_hash_formatting
|
49
50
|
end
|
50
51
|
|
51
52
|
include HashFormatting
|
@@ -70,16 +71,6 @@ module Aruba
|
|
70
71
|
def failure_message_when_negated
|
71
72
|
"expected #{description_of @actual} not to #{description}"
|
72
73
|
end
|
73
|
-
|
74
|
-
# @private
|
75
|
-
# rubocop:disable Naming/PredicateName
|
76
|
-
def self.has_default_failure_messages?(matcher)
|
77
|
-
matcher.method(:failure_message).owner == self &&
|
78
|
-
matcher.method(:failure_message_when_negated).owner == self
|
79
|
-
rescue NameError
|
80
|
-
false
|
81
|
-
end
|
82
|
-
# rubocop:enable Naming/PredicateName
|
83
74
|
end
|
84
75
|
|
85
76
|
include DefaultFailureMessages
|
@@ -8,9 +8,9 @@ module Aruba
|
|
8
8
|
module_function
|
9
9
|
|
10
10
|
def indent_multiline_message(message)
|
11
|
-
message = message.sub(/\n+\z/,
|
11
|
+
message = message.sub(/\n+\z/, "")
|
12
12
|
message.lines.map do |line|
|
13
|
-
/\S/.match?(line) ?
|
13
|
+
/\S/.match?(line) ? " #{line}" : line
|
14
14
|
end.join
|
15
15
|
end
|
16
16
|
end
|
@@ -12,8 +12,6 @@ module Aruba
|
|
12
12
|
prepare_for_inspection(object).inspect
|
13
13
|
end
|
14
14
|
|
15
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
16
|
-
|
17
15
|
# @private
|
18
16
|
# Prepares the provided object to be formatted by wrapping it as needed
|
19
17
|
# in something that, when `inspect` is called on it, will produce the
|
@@ -46,7 +44,6 @@ module Aruba
|
|
46
44
|
|
47
45
|
InspectableItem.new(inspection)
|
48
46
|
end
|
49
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
50
47
|
|
51
48
|
# @private
|
52
49
|
def self.prepare_hash(input)
|
@@ -55,7 +52,7 @@ module Aruba
|
|
55
52
|
end
|
56
53
|
end
|
57
54
|
|
58
|
-
TIME_FORMAT =
|
55
|
+
TIME_FORMAT = "%Y-%m-%d %H:%M:%S".freeze
|
59
56
|
|
60
57
|
if Time.method_defined?(:nsec)
|
61
58
|
# @private
|
@@ -64,7 +61,7 @@ module Aruba
|
|
64
61
|
end
|
65
62
|
end
|
66
63
|
|
67
|
-
DATE_TIME_FORMAT =
|
64
|
+
DATE_TIME_FORMAT = "%a, %d %b %Y %H:%M:%S.%N %z".freeze
|
68
65
|
|
69
66
|
# ActiveSupport sometimes overrides inspect. If `ActiveSupport` is
|
70
67
|
# defined use a custom format string that includes more time precision.
|
@@ -1 +1 @@
|
|
1
|
-
Aruba.platform.require_matching_files(
|
1
|
+
Aruba.platform.require_matching_files("../collection/**/*.rb", __FILE__)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "aruba/matchers/base/base_matcher"
|
2
|
+
require "aruba/matchers/base/message_indenter"
|
3
3
|
|
4
4
|
# Aruba
|
5
5
|
module Aruba
|
@@ -29,9 +29,7 @@ module Aruba
|
|
29
29
|
# @api private
|
30
30
|
# @return [String]
|
31
31
|
def failure_message
|
32
|
-
unless iterable?
|
33
|
-
return "#{improve_hash_formatting(super)}, but was not iterable"
|
34
|
-
end
|
32
|
+
return "#{improve_hash_formatting(super)}, but was not iterable" unless iterable?
|
35
33
|
|
36
34
|
return failed_objects.first if failed_objects.size == 1
|
37
35
|
|
@@ -91,7 +89,9 @@ module Aruba
|
|
91
89
|
|
92
90
|
def failure_message_for_item(index, failure_message)
|
93
91
|
failure_message = indent_multiline_message(add_new_line_if_needed(failure_message))
|
94
|
-
indent_multiline_message(
|
92
|
+
indent_multiline_message(
|
93
|
+
"object at index #{index} failed to match:#{failure_message}"
|
94
|
+
)
|
95
95
|
end
|
96
96
|
|
97
97
|
def add_new_line_if_needed(message)
|
@@ -1 +1 @@
|
|
1
|
-
Aruba.platform.require_matching_files(
|
1
|
+
Aruba.platform.require_matching_files("../command/**/*.rb", __FILE__)
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
1
|
+
require "rspec/expectations/version"
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "aruba/matchers/command/have_exit_status"
|
4
|
+
require "aruba/matchers/command/have_finished_in_time"
|
5
5
|
|
6
6
|
# @!method be_successfuly_executed
|
7
7
|
# This matchers checks if execution of <command> was successful
|
@@ -29,7 +29,9 @@ RSpec::Matchers.define :be_successfully_executed do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
failure_message do |_actual|
|
32
|
-
"Expected `#{@actual}` to succeed
|
32
|
+
"Expected `#{@actual}` to succeed" \
|
33
|
+
" but got non-zero exit status and the following output:" \
|
34
|
+
"\n\n#{@old_actual.output}\n"
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
@@ -23,7 +23,9 @@ RSpec::Matchers.define :have_exit_status do |expected|
|
|
23
23
|
@old_actual.stop
|
24
24
|
@actual = actual.exit_status
|
25
25
|
|
26
|
-
|
26
|
+
unless @old_actual.respond_to? :exit_status
|
27
|
+
raise "Expected #{@old_actual} to respond to #exit_status"
|
28
|
+
end
|
27
29
|
|
28
30
|
values_match? expected, @actual
|
29
31
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "rspec/expectations/version"
|
2
2
|
|
3
3
|
# @!method run_too_long
|
4
4
|
# This matchers checks if <command> run too long. Say the timeout is 10
|
@@ -24,7 +24,9 @@ RSpec::Matchers.define :have_finished_in_time do
|
|
24
24
|
@old_actual = actual
|
25
25
|
@actual = @old_actual.commandline
|
26
26
|
|
27
|
-
|
27
|
+
unless @old_actual.respond_to? :timed_out?
|
28
|
+
raise "Expected #{@old_actual} to respond to #timed_out?"
|
29
|
+
end
|
28
30
|
|
29
31
|
@old_actual.stop
|
30
32
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "aruba/matchers/base/message_indenter"
|
2
2
|
|
3
3
|
# @!method have_output
|
4
4
|
# This matchers checks if <command> has created output
|
@@ -19,7 +19,9 @@ RSpec::Matchers.define :have_output do |expected|
|
|
19
19
|
match do |actual|
|
20
20
|
@old_actual = actual
|
21
21
|
|
22
|
-
|
22
|
+
unless @old_actual.respond_to? :output
|
23
|
+
raise "Expected #{@old_actual} to respond to #output"
|
24
|
+
end
|
23
25
|
|
24
26
|
@old_actual.stop
|
25
27
|
|