Sha256: d524d17df995a2b15092ffd9fa544a5ab19a55844492aed88e864ce9d501eee1

Contents?: true

Size: 784 Bytes

Versions: 11

Compression:

Stored size: 784 Bytes

Contents

# encoding: utf-8

class Nanoc::ChecksumStoreTest < MiniTest::Unit::TestCase

  include Nanoc::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 = Nanoc::ChecksumStore.new
    store.load
    obj = Nanoc::Item.new('Moo?', {}, '/moo/')
    assert_equal 'zomg', store[obj]
  end

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

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

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
nanoc-3.4.2 test/base/test_checksum_store.rb
nanoc-3.4.1 test/base/test_checksum_store.rb
nanoc-3.4.0 test/base/test_checksum_store.rb
nanoc-3.3.7 test/base/test_checksum_store.rb
nanoc-3.3.6 test/base/test_checksum_store.rb
nanoc-3.3.5 test/base/test_checksum_store.rb
nanoc-3.3.4 test/base/test_checksum_store.rb
nanoc-3.3.3 test/base/test_checksum_store.rb
nanoc-3.3.2 test/base/test_checksum_store.rb
nanoc-3.3.1 test/base/test_checksum_store.rb
nanoc-3.3.0 test/base/test_checksum_store.rb