Sha256: 32a2685c10d1999f591a18a9dd6845ea6876c7caff34d675f83a71ccea4a96e3

Contents?: true

Size: 926 Bytes

Versions: 34

Compression:

Stored size: 926 Bytes

Contents

require 'rspec/expectations/version'

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

if RSpec::Expectations::Version::STRING >= '3.0'
  RSpec::Matchers.alias_matcher :an_existing_directory, :be_an_existing_directory
end

Version data entries

34 entries across 34 versions & 3 rubygems

Version Path
aruba-0.14.14 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.14.13 lib/aruba/matchers/directory/be_an_existing_directory.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/aruba-0.14.12/lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.14.12 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.14.11 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.14.10 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.14.9 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.14.8 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.14.7 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.14.6 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.14.5 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.14.4 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.14.3 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-1.0.0.pre.alpha.2 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-1.0.0.pre.alpha.1 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-win-fix-0.14.2 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.14.2 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.14.1 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.14.0 lib/aruba/matchers/directory/be_an_existing_directory.rb
aruba-0.13.0 lib/aruba/matchers/directory/be_an_existing_directory.rb