Sha256: 85219d4ff06a94793ef5e83652a5dc91f6b113cc2fe7d229b4a81f7ca055acc2

Contents?: true

Size: 963 Bytes

Versions: 26

Compression:

Stored size: 963 Bytes

Contents

require 'rspec/expectations/version'
require 'shellwords'

# @!method be_an_existing_executable
#   This matchers checks if <file> exists in filesystem
#
#   @return [TrueClass, FalseClass] The result
#
#     false:
#     * if file does not exist
#     true:
#     * if file exists
#
#   @example Use matcher
#
#     RSpec.describe do
#       it { expect(file1).to be_an_existing_executable }
#     end
RSpec::Matchers.define :be_an_existing_executable do |_|
  match do |actual|
    @actual = Shellwords.split(actual.commandline).first if actual.respond_to? :commandline

    executable?(@actual)
  end

  failure_message do |actual|
    format("expected that executable \"%s\" exists", actual)
  end

  failure_message_when_negated do |actual|
    format("expected that executable \"%s\" does not exist", actual)
  end
end

if RSpec::Expectations::Version::STRING >= '3.0'
  RSpec::Matchers.alias_matcher :an_existing_executable, :be_an_existing_executable
end

Version data entries

26 entries across 26 versions & 3 rubygems

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