Sha256: ce4b4867a356e64b62d48b781717e0533d292f45ad1e8745987fce688107c6f8
Contents?: true
Size: 1.35 KB
Versions: 17
Compression:
Stored size: 1.35 KB
Contents
# frozen_string_literal: true describe Nanoc::Int::CompiledContentCache do let(:cache) { described_class.new(items: items) } let(:items) { [item] } let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo.md') } let(:item_rep) { Nanoc::Int::ItemRep.new(item, :default) } let(:other_item) { Nanoc::Int::Item.new('asdf', {}, '/sneaky.md') } let(:other_item_rep) { Nanoc::Int::ItemRep.new(other_item, :default) } let(:content) { Nanoc::Int::Content.create('omg') } it 'has no content by default' do expect(cache[item_rep]).to be_nil end context 'setting content on known item' do before { cache[item_rep] = { last: content } } it 'has content' do expect(cache[item_rep][:last].string).to eql('omg') end context 'after storing and loading' do before do cache.store cache.load end it 'has content' do expect(cache[item_rep][:last].string).to eql('omg') end end end context 'setting content on unknown item' do before { cache[other_item_rep] = { last: content } } it 'has content' do expect(cache[other_item_rep][:last].string).to eql('omg') end context 'after storing and loading' do before do cache.store cache.load end it 'has no content' do expect(cache[other_item_rep]).to be_nil end end end end
Version data entries
17 entries across 17 versions & 1 rubygems