Sha256: 61b77cc29a2ec43bcd8e194fd6eae2563e9b0f86e591e14361fbc2b834e3c10c

Contents?: true

Size: 729 Bytes

Versions: 6

Compression:

Stored size: 729 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/')
    assert_equal nil, store[obj]
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nanoc-3.6.1 test/base/test_checksum_store.rb
nanoc-3.6.0 test/base/test_checksum_store.rb
nanoc-3.5.0 test/base/test_checksum_store.rb
nanoc-3.5.0b2 test/base/test_checksum_store.rb
nanoc-3.5.0b1 test/base/test_checksum_store.rb
nanoc-3.4.3 test/base/test_checksum_store.rb