Sha256: 88385a59fbafebc2eaceccb5a5a12891dafa72d091e7c4d4ce69301034290492

Contents?: true

Size: 888 Bytes

Versions: 8

Compression:

Stored size: 888 Bytes

Contents

require 'rspec/expectations/version'

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

8 entries across 8 versions & 1 rubygems

Version Path
aruba-1.0.4 lib/aruba/matchers/path/be_an_absolute_path.rb
aruba-1.0.3 lib/aruba/matchers/path/be_an_absolute_path.rb
aruba-1.0.2 lib/aruba/matchers/path/be_an_absolute_path.rb
aruba-1.0.1 lib/aruba/matchers/path/be_an_absolute_path.rb
aruba-1.0.0 lib/aruba/matchers/path/be_an_absolute_path.rb
aruba-1.0.0.pre.alpha.5 lib/aruba/matchers/path/be_an_absolute_path.rb
aruba-1.0.0.pre.alpha.4 lib/aruba/matchers/path/be_an_absolute_path.rb
aruba-1.0.0.pre.alpha.3 lib/aruba/matchers/path/be_an_absolute_path.rb