Sha256: eac35a9f4d1c5336d3135e4c463040b16ba67aa18f47c7f2d18bea58f186d6b4
Contents?: true
Size: 1.25 KB
Versions: 19
Compression:
Stored size: 1.25 KB
Contents
# @!method match_path_pattern(pattern) # This matchers checks if <files>/directories match <pattern> # # @param [String, Regexp] pattern # The pattern to use. # # @return [TrueClass, FalseClass] The result # # false: # * if there are no files/directories which match the pattern # true: # * if there are files/directories which match the pattern # # @example Use matcher with regex # # RSpec.describe do # it { expect(Dir.glob(**/*)).to match_file_pattern(/.txt$/) } # end # # @example Use matcher with string # # RSpec.describe do # it { expect(Dir.glob(**/*)).to match_file_pattern('.txt$') } # end RSpec::Matchers.define :match_path_pattern do |_| match do |actual| Aruba.platform.deprecated('The use of `expect().to match_path_pattern` is deprecated. Please use `expect().to include pattern /regex/` instead.') next !actual.select { |a| a == expected }.empty? if expected.is_a? String !actual.grep(expected).empty? end failure_message do |actual| format("expected that path \"%s\" matches pattern \"%s\".", actual.join(", "), expected) end failure_message_when_negated do |actual| format("expected that path \"%s\" does not match pattern \"%s\".", actual.join(", "), expected) end end
Version data entries
19 entries across 19 versions & 3 rubygems