Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. RSpec::Matchers.define(:be_same_file_as) do |exected_file_path|
  2. match do |actual_file_path|
  3. md5_hash(actual_file_path).should == md5_hash(exected_file_path)
  4. end
  5.  
  6. def md5_hash(file_path)
  7. Digest::MD5.hexdigest(File.read(file_path))
  8. end
  9. end
  10.  
  11. # e.g. path_to_foo.should be_same_file_as(path_to_bar)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement