Sha256: 65faadae856ade2ded6773d9f3f36a65f674fe703914b4785e05ac3ebe7bc34b

Contents?: true

Size: 989 Bytes

Versions: 38

Compression:

Stored size: 989 Bytes

Contents

require 'rspec/expectations/version'

# @!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

if RSpec::Expectations::Version::STRING >= '3.0'
  RSpec::Matchers.alias_matcher :an_existing_path, :be_an_existing_path
end

Version data entries

38 entries across 38 versions & 3 rubygems

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