Sha256: f5547251e599afdfec23d8c75743fd9d95c6843e869baa3febf9c1bbbd53a1fb

Contents?: true

Size: 866 Bytes

Versions: 2

Compression:

Stored size: 866 Bytes

Contents

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

  failure_message do |actual|
    format("expected that path \"%s\" is absolute, but it's not", actual)
  end

  failure_message_when_negated do |actual|
    format("expected that path \"%s\" is not absolute, but it is", actual)
  end
end

RSpec::Matchers.alias_matcher :an_absolute_path, :be_an_absolute_path

Version data entries

2 entries across 2 versions & 1 rubygems

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