Sha256: 265418f1221e0bdd8a0e2bb6e76c1fca9808e7c9b75bc46ed33219a9acdee051

Contents?: true

Size: 896 Bytes

Versions: 2

Compression:

Stored size: 896 Bytes

Contents

# @!method be_an_existing_path
#   This matchers checks if <path> exists in filesystem
#
#   @return [TrueClass, FalseClass] The result
#
#     false:
#     * if path does not exist
#     true:
#     * if path exists
#
#   @example Use matcher
#
#     RSpec.describe do
#       it { expect(file).to be_an_existing_path }
#       it { expect(directory).to be_an_existing_path }
#       it { expect(all_directories).to all be_an_existing_path }
#       it { expect(all_directories).to include an_existing_path }
#     end
RSpec::Matchers.define :be_an_existing_path do |_|
  match do |actual|
    exist?(actual)
  end

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

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

RSpec::Matchers.alias_matcher :an_existing_path, :be_an_existing_path

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aruba-0.8.0.pre2 lib/aruba/matchers/path/be_an_existing_path.rb
aruba-0.8.0.pre lib/aruba/matchers/path/be_an_existing_path.rb