Sha256: db649abe18218009932fdc2e2af119eab7ec759fb23bfb54d5ddf57e637a71d6
Contents?: true
Size: 841 Bytes
Versions: 13
Compression:
Stored size: 841 Bytes
Contents
# encoding: utf-8 describe 'Pathname#checksum' do it 'should work on empty files' do begin # Create file FileUtils.mkdir_p('tmp') File.open('tmp/myfile', 'w') { |io| io.write('') } now = Time.now File.utime(now, now, 'tmp/myfile') # Create checksum pathname = Pathname.new('tmp/myfile') pathname.checksum.must_equal '0-' + now.to_s ensure FileUtils.rm_rf('tmp') end end it 'should work on all files' do begin # Create file FileUtils.mkdir_p('tmp') File.open('tmp/myfile', 'w') { |io| io.write('abc') } now = Time.now File.utime(now, now, 'tmp/myfile') # Create checksum pathname = Pathname.new('tmp/myfile') pathname.checksum.must_equal '3-' + now.to_s ensure FileUtils.rm_rf('tmp') end end end
Version data entries
13 entries across 13 versions & 1 rubygems