Sha256: 3ad306b1e724368d4f066020303f0c06a04dae644c5255552849124dde12b657
Contents?: true
Size: 812 Bytes
Versions: 28
Compression:
Stored size: 812 Bytes
Contents
RSpec::Matchers.define(:have_same_content_of) do |file: nil| expected_file_path = file match do |actual_file_path| if File.exists?(actual_file_path) expect(md5_hash(actual_file_path)).to eq(md5_hash(expected_file_path)) else create_when_missing(expected_file_path, actual_file_path) end end def md5_hash(file_path) Digest::MD5.hexdigest(File.read(file_path)) end def create_when_missing(expected_file_path, actual_file_path) puts "+----------------------------------------------------" puts "|" puts "| The file bellow doesn't exists and will be created:" puts "|" puts "| #{actual_file_path}" puts "|" puts "+----------------------------------------------------" FileUtils.cp(expected_file_path, actual_file_path) false end end
Version data entries
28 entries across 28 versions & 1 rubygems