Sha256: e04e18227dbd5444e528aaf7c885862b1d9e67fa43705d00cd4ddf31c6bfa53f
Contents?: true
Size: 925 Bytes
Versions: 2
Compression:
Stored size: 925 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('') } timestamp = Time.at(1_234_569) File.utime(timestamp, timestamp, 'tmp/myfile') # Create checksum pathname = Pathname.new('tmp/myfile') pathname.checksum.must_equal 'oU+0fYgGm4EDTl+uErBv8rB9YhU=' 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') } timestamp = Time.at(1_234_569) File.utime(timestamp, timestamp, 'tmp/myfile') # Create checksum pathname = Pathname.new('tmp/myfile') pathname.checksum.must_equal 'IAoqYXvcDheQjaYmZ8waPtEO8zU=' ensure FileUtils.rm_rf('tmp') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nanoc-3.8.0 | test/base/core_ext/pathname_spec.rb |
nanoc-3.7.5 | test/base/core_ext/pathname_spec.rb |