Sha256: 47982ff1a28f05ad39a69a5e31fa73998d093b23f883d0555d257ab6d406b7dd

Contents?: true

Size: 790 Bytes

Versions: 8

Compression:

Stored size: 790 Bytes

Contents

# encoding: utf-8

class Nanoc3::ChecksumStoreTest < MiniTest::Unit::TestCase

  include Nanoc3::TestHelpers

  def test_get_with_existing_object
    require 'pstore'

    # Create store
    FileUtils.mkdir_p('tmp')
    pstore = PStore.new('tmp/checksums')
    pstore.transaction do
      pstore[:data] = { [ :item, '/moo/' ] => 'zomg' }
      pstore[:version] = 1
    end

    # Check
    store = Nanoc3::ChecksumStore.new
    store.load
    obj = Nanoc3::Item.new('Moo?', {}, '/moo/')
    assert_equal 'zomg', store[obj]
  end

  def test_get_with_nonexistant_object
    store = Nanoc3::ChecksumStore.new
    store.load

    # Check
    obj = Nanoc3::Item.new('Moo?', {}, '/animals/cow/')
    new_checksum = 'Moo?'.checksum + '-' + {}.checksum
    assert_equal nil, store[obj]
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nanoc3-3.2.4 test/base/test_checksum_store.rb
nanoc3-3.2.3 test/base/test_checksum_store.rb
nanoc3-3.2.2 test/base/test_checksum_store.rb
nanoc3-3.2.1 test/base/test_checksum_store.rb
nanoc3-3.2.0 test/base/test_checksum_store.rb
nanoc3-3.2.0b3 test/base/test_checksum_store.rb
nanoc3-3.2.0b2 test/base/test_checksum_store.rb
nanoc3-3.2.0b1 test/base/test_checksum_store.rb