Sha256: ca8308eafa60eb424db84c40dbf1eb2dd71cdd2bc992e65cbcc4b0ff89b4fa50

Contents?: true

Size: 873 Bytes

Versions: 3

Compression:

Stored size: 873 Bytes

Contents

# @!method be_a_command_found_in_path
#   This matchers checks if <command> can be found in path
#
#   @return [Boolean] The result
#
#     false:
#     * if command was not found in PATH
#     true:
#     * if command can be found in PATH
#
#   @example Use matcher
#
#     RSpec.describe do
#       it { expect(cmd).to be_a_command_found_in_path }
#     end
RSpec::Matchers.define :be_a_command_found_in_path do
  match do |actual|
    !which(actual).nil?
  end

  failure_message do |actual|
    format(%(expected that command "%s" can be found in PATH "%s".),
           actual, aruba.environment["PATH"])
  end

  failure_message_when_negated do |actual|
    format(%(expected that command "%s" cannot be found in PATH "%s".),
           actual, aruba.environment["PATH"])
  end
end

RSpec::Matchers.alias_matcher :a_command_found_in_path, :be_a_command_found_in_path

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/aruba-2.2.0/lib/aruba/matchers/file/be_a_command_found_in_path.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/aruba-2.2.0/lib/aruba/matchers/file/be_a_command_found_in_path.rb
aruba-2.2.0 lib/aruba/matchers/file/be_a_command_found_in_path.rb