Sha256: 3d71e74f59f331e80a441c8b1708d75045a674967ce17b7c1e12857d16858252

Contents?: true

Size: 853 Bytes

Versions: 2

Compression:

Stored size: 853 Bytes

Contents

require 'rspec/expectations/version'

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

    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-1.0.0.pre.alpha.4 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-1.0.0.pre.alpha.3 lib/aruba/matchers/directory/be_an_existing_directory.rb