Sha256: 6f8e930c84eda11a67ff8b0e4719ca34c95a10cf437dbf8021f0549e2a0ee503

Contents?: true

Size: 1.05 KB

Versions: 26

Compression:

Stored size: 1.05 KB

Contents

# @!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

Version data entries

26 entries across 26 versions & 3 rubygems

Version Path
aruba-0.14.14 lib/aruba/matchers/command/have_exit_status.rb
aruba-0.14.13 lib/aruba/matchers/command/have_exit_status.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/aruba-0.14.12/lib/aruba/matchers/command/have_exit_status.rb
aruba-0.14.12 lib/aruba/matchers/command/have_exit_status.rb
aruba-0.14.11 lib/aruba/matchers/command/have_exit_status.rb
aruba-0.14.10 lib/aruba/matchers/command/have_exit_status.rb
aruba-0.14.9 lib/aruba/matchers/command/have_exit_status.rb
aruba-0.14.8 lib/aruba/matchers/command/have_exit_status.rb
aruba-0.14.7 lib/aruba/matchers/command/have_exit_status.rb
aruba-0.14.6 lib/aruba/matchers/command/have_exit_status.rb
aruba-0.14.5 lib/aruba/matchers/command/have_exit_status.rb
aruba-0.14.4 lib/aruba/matchers/command/have_exit_status.rb
aruba-0.14.3 lib/aruba/matchers/command/have_exit_status.rb
aruba-1.0.0.pre.alpha.2 lib/aruba/matchers/command/have_exit_status.rb
aruba-1.0.0.pre.alpha.1 lib/aruba/matchers/command/have_exit_status.rb
aruba-win-fix-0.14.2 lib/aruba/matchers/command/have_exit_status.rb
aruba-0.14.2 lib/aruba/matchers/command/have_exit_status.rb
aruba-0.14.1 lib/aruba/matchers/command/have_exit_status.rb
aruba-0.14.0 lib/aruba/matchers/command/have_exit_status.rb
aruba-0.13.0 lib/aruba/matchers/command/have_exit_status.rb