Sha256: 775831602e77edf3a79efcf219bfbb6a119b6999e240cbcb1df328a5fc8295cd

Contents?: true

Size: 828 Bytes

Versions: 5

Compression:

Stored size: 828 Bytes

Contents

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

    raise "String expected" 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

5 entries across 5 versions & 2 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/aruba-2.2.0/lib/aruba/matchers/directory/be_an_existing_directory.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/aruba-2.2.0/lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-2.2.0 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-2.1.0 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-2.0.1 lib/aruba/matchers/directory/be_an_existing_directory.rb