Sha256: 7ede2244e66473ea426a423d18e01bb59f1d904d91ffb1ef0cb54881e4fe426a

Contents?: true

Size: 923 Bytes

Versions: 7

Compression:

Stored size: 923 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(1234569)
      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(1234569)
      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

7 entries across 7 versions & 1 rubygems

Version Path
nanoc-3.7.4 test/base/core_ext/pathname_spec.rb
nanoc-3.7.3 test/base/core_ext/pathname_spec.rb
nanoc-3.7.2 test/base/core_ext/pathname_spec.rb
nanoc-3.7.1 test/base/core_ext/pathname_spec.rb
nanoc-3.7.0 test/base/core_ext/pathname_spec.rb
nanoc-3.6.11 test/base/core_ext/pathname_spec.rb
nanoc-3.6.10 test/base/core_ext/pathname_spec.rb