/usr/lib/ruby/vendor_ruby/aruba/matchers/command/have_exit_status.rb is in ruby-aruba 0.14.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # @!method have_exit_status(status)
# This matchers checks if <command> has exit status <status>
#
# @param [Integer] status
# The value of the exit status
#
# @return [TrueClass, FalseClass] The result
#
# false:
# * if command does not have exit status
# true:
# * if command has exit status
#
# @example Use matcher
#
# RSpec.describe do
# it { expect(last_command_started).to have_exit_status(0) }
# end
RSpec::Matchers.define :have_exit_status do |expected|
match do |actual|
@old_actual = actual
@old_actual.stop
@actual = actual.exit_status
next false unless @old_actual.respond_to? :exit_status
values_match? expected, @actual
end
failure_message do |actual|
format(%(expected that command "%s" has exit status of "%s", but has "%s".), @old_actual.commandline, expected.to_s, actual.to_s)
end
failure_message_when_negated do |actual|
format(%(expected that command "%s" does not have exit status of "%s", but has "%s".), @old_actual.commandline, expected.to_s, actual.to_s)
end
end
|