Sha256: 9d4ee1b0f43aa4cd45a76b738fe39b673f7fc41e90de73cefef0414fac368364

Contents?: true

Size: 922 Bytes

Versions: 1

Compression:

Stored size: 922 Bytes

Contents

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.__nanoc_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.__nanoc_checksum.must_equal 'IAoqYXvcDheQjaYmZ8waPtEO8zU='
    ensure
      FileUtils.rm_rf('tmp')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nanoc-4.0.0b3 test/base/core_ext/pathname_spec.rb