Sha256: 0af407dafa711237a6fab6c4d11b6fce139e64ad6b83be1758f1449997caae50

Contents?: true

Size: 831 Bytes

Versions: 2

Compression:

Stored size: 831 Bytes

Contents

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

    next false unless actual.is_a? String

    directory?(actual)
  end

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

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

RSpec::Matchers.alias_matcher :an_existing_directory, :be_an_existing_directory

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aruba-0.8.0.pre2 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.8.0.pre lib/aruba/matchers/directory/be_an_existing_directory.rb