Sha256: d57093345cb48b599ccfb2004fe4e8ce8ec106151b880126281e0770ef482da6

Contents?: true

Size: 916 Bytes

Versions: 5

Compression:

Stored size: 916 Bytes

Contents

require "rspec/expectations/version"

# @!method be_an_existing_path
#   This matchers checks if <path> exists in filesystem
#
#   @return [Boolean] 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

5 entries across 5 versions & 2 rubygems

Version Path
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/aruba-2.0.0/lib/aruba/matchers/path/be_an_existing_path.rb
aruba-2.0.0 lib/aruba/matchers/path/be_an_existing_path.rb
aruba-1.1.2 lib/aruba/matchers/path/be_an_existing_path.rb
aruba-1.1.1 lib/aruba/matchers/path/be_an_existing_path.rb
aruba-1.1.0 lib/aruba/matchers/path/be_an_existing_path.rb