Sha256: 11c2b35879b1b172ff3d6de19ab4291a73357189e0fb40b348d9d6f7b203556a

Contents?: true

Size: 538 Bytes

Versions: 18

Compression:

Stored size: 538 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

18 entries across 18 versions & 1 rubygems

Version Path
machined-1.0.0 spec/support/match_paths_matcher.rb
machined-0.9.3 spec/support/match_paths_matcher.rb
machined-0.9.2 spec/support/match_paths_matcher.rb
machined-0.9.1 spec/support/match_paths_matcher.rb
machined-0.9.0 spec/support/match_paths_matcher.rb
machined-0.8.0 spec/support/match_paths_matcher.rb
machined-0.7.1 spec/support/match_paths_matcher.rb
machined-0.7.0 spec/support/match_paths_matcher.rb
machined-0.6.0 spec/support/match_paths_matcher.rb
machined-0.5.0 spec/support/match_paths_matcher.rb
machined-0.4.0 spec/support/match_paths_matcher.rb
machined-0.3.1 spec/support/match_paths_matcher.rb
machined-0.3.0 spec/support/match_paths_matcher.rb
machined-0.2.2 spec/support/match_paths_matcher.rb
machined-0.2.1 spec/support/match_paths_matcher.rb
machined-0.2.0 spec/support/match_paths_matcher.rb
machined-0.1.1 spec/support/match_paths_matcher.rb
machined-0.1.0 spec/support/match_paths_matcher.rb