Sha256: 8e4658b76b237766e3598e3357bea5e3f9975b4a20d223c627b61625a5d3b55c

Contents?: true

Size: 530 Bytes

Versions: 4

Compression:

Stored size: 530 Bytes

Contents

# Determines if the given `Array` of paths
# matches the expected `Array` of paths. For consistency,
# each path is converted to a string for comparison. Also,
# the expected paths can be joined with a root path, using
# the `with_root` method.
RSpec::Matchers.define :match_paths do |expected|
  match do |actual|
    expected.map!(&:to_s)
    actual.map!(&:to_s)
    expected.map! { |path| File.join(@root, path) } if @root

    actual == expected
  end

  chain :with_root do |root|
    @root = root.to_s
  end

  diffable
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
machined-1.1.0 spec/support/match_paths_matcher.rb
machined-1.0.3 spec/support/match_paths_matcher.rb
machined-1.0.2 spec/support/match_paths_matcher.rb
machined-1.0.1 spec/support/match_paths_matcher.rb