Sha256: b756a7b0453b107a36de7b0b6de25bc2c0cc7a6d3c55c1508344107391961d70

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

require "aruba/matchers/command/have_exit_status"
require "aruba/matchers/command/have_finished_in_time"

# @!method be_successfuly_executed
#   This matchers checks if execution of <command> was successful
#
#   @return [Boolean] The result
#
#     false:
#     * if command was not successful
#     true:
#     * if command was successful
#
#   @example Use matcher
#
#     RSpec.describe do
#       it { expect(last_command_started).to be_successfully_executed }
#       it { expect(last_command_started).not_to be_successfully_executed }
#       it { expect(last_command_started).to have_failed_running }
#     end
RSpec::Matchers.define :be_successfully_executed do
  match do |actual|
    @old_actual = actual
    @actual     = @old_actual.commandline

    expect(@old_actual).to have_exit_status(0)
  end

  failure_message do |_actual|
    "Expected `#{@actual}` to succeed" \
      " but got non-zero exit status and the following output:" \
      "\n\n#{@old_actual.output}\n"
  end
end

RSpec::Matchers.define_negated_matcher :have_failed_running, :be_successfully_executed

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/aruba-2.2.0/lib/aruba/matchers/command/be_successfully_executed.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/aruba-2.2.0/lib/aruba/matchers/command/be_successfully_executed.rb
aruba-2.2.0 lib/aruba/matchers/command/be_successfully_executed.rb
aruba-2.1.0 lib/aruba/matchers/command/be_successfully_executed.rb
aruba-2.0.1 lib/aruba/matchers/command/be_successfully_executed.rb