Sha256: 0945841660f589be340e666eb1a61598d0d332b2fc6247be02a1a31585bd109c

Contents?: true

Size: 690 Bytes

Versions: 14

Compression:

Stored size: 690 Bytes

Contents

# encoding: utf-8

class Nanoc::ChecksumStoreTest < Nanoc::TestCase

  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

14 entries across 14 versions & 1 rubygems

Version Path
nanoc-3.7.3 test/base/test_checksum_store.rb
nanoc-3.7.2 test/base/test_checksum_store.rb
nanoc-3.7.1 test/base/test_checksum_store.rb
nanoc-3.7.0 test/base/test_checksum_store.rb
nanoc-3.6.11 test/base/test_checksum_store.rb
nanoc-3.6.10 test/base/test_checksum_store.rb
nanoc-3.6.9 test/base/test_checksum_store.rb
nanoc-3.6.8 test/base/test_checksum_store.rb
nanoc-3.6.7 test/base/test_checksum_store.rb
nanoc-3.6.6 test/base/test_checksum_store.rb
nanoc-3.6.5 test/base/test_checksum_store.rb
nanoc-3.6.4 test/base/test_checksum_store.rb
nanoc-3.6.3 test/base/test_checksum_store.rb
nanoc-3.6.2 test/base/test_checksum_store.rb