Sha256: db21e9713d2e6715746be1949c5c321f33f7bc0b174161987080e3f976f089f3

Contents?: true

Size: 675 Bytes

Versions: 37

Compression:

Stored size: 675 Bytes

Contents

require File.expand_path("../../../base", __FILE__)
require 'digest/md5'
require 'digest/sha1'

require 'vagrant/util/file_checksum'

describe FileChecksum do
  include_context "unit"

  let(:environment) { isolated_environment }

  it "should return a valid checksum for a file" do
    file = environment.workdir.join("file")
    file.open("w+") { |f| f.write("HELLO!") }

    # Check multiple digests
    instance = described_class.new(file, Digest::MD5)
    expect(instance.checksum).to eq("9ac96c64417b5976a58839eceaa77956")

    instance = described_class.new(file, Digest::SHA1)
    expect(instance.checksum).to eq("264b207c7913e461c43d0f63d2512f4017af4755")
  end
end

Version data entries

37 entries across 30 versions & 7 rubygems

Version Path
vagrant-packet-0.1.2 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/test/unit/vagrant/util/file_checksum_test.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/test/unit/vagrant/util/file_checksum_test.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/test/unit/vagrant/util/file_checksum_test.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/test/unit/vagrant/util/file_checksum_test.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/test/unit/vagrant/util/file_checksum_test.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/test/unit/vagrant/util/file_checksum_test.rb
vagrant-aws-detiber-0.7.2.pre.4 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/test/unit/vagrant/util/file_checksum_test.rb
vagrant-aws-detiber-0.7.2.pre.3 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/test/unit/vagrant/util/file_checksum_test.rb
vagrant-aws-detiber-0.7.2.pre.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/test/unit/vagrant/util/file_checksum_test.rb
vagrant-unbundled-2.0.2.0 test/unit/vagrant/util/file_checksum_test.rb
vagrant-unbundled-2.0.1.0 test/unit/vagrant/util/file_checksum_test.rb
vagrant-aws-mkubenka-0.7.2.pre.22 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-f3fdbf414272/test/unit/vagrant/util/file_checksum_test.rb
vagrant-aws-mkubenka-0.7.2.pre.16 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-1ee58c40e3f5/test/unit/vagrant/util/file_checksum_test.rb
vagrant-unbundled-2.0.0.1 test/unit/vagrant/util/file_checksum_test.rb
vagrant-unbundled-1.9.8.1 test/unit/vagrant/util/file_checksum_test.rb
vagrant-unbundled-1.9.7.1 test/unit/vagrant/util/file_checksum_test.rb
vagrant-aws-mkubenka-0.7.2.pre.14 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/vagrant/util/file_checksum_test.rb
vagrant-aws-mkubenka-0.7.2.pre.11 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/vagrant/util/file_checksum_test.rb
vagrant-aws-mkubenka-0.7.2.pre.10 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/vagrant/util/file_checksum_test.rb
vagrant-aws-mkubenka-0.7.2.pre.9 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/vagrant/util/file_checksum_test.rb