Sha256: 8155dc00d6b7be03a404b5a057317ca81b0f3bf22cbc08630addf22f8b80c487

Contents?: true

Size: 942 Bytes

Versions: 9

Compression:

Stored size: 942 Bytes

Contents

describe 'GH-776', site: true do
  before do
    File.write('content/donkey.md', 'Donkey!')

    File.write('Rules', <<EOS)
  route '/donkey.*', snapshot: :secret do
    '/donkey-secret.html'
  end

  compile '/donkey.*' do
    filter :erb
    snapshot :secret
    write '/donkey.html'
  end

  layout '/foo.*', :erb
EOS
  end

  let(:site) { Nanoc::Int::SiteLoader.new.new_from_cwd }

  before do
    site.compile
  end

  context 'without pruning' do
    it 'writes two files' do
      expect(File.read('output/donkey.html')).to eql('Donkey!')
      expect(File.read('output/donkey-secret.html')).to eql('Donkey!')
    end
  end

  context 'with pruning' do
    before do
      Nanoc::Pruner.new(site.config, site.compiler.reps).run
    end

    it 'does not prune written snapshots' do
      expect(File.read('output/donkey.html')).to eql('Donkey!')
      expect(File.read('output/donkey-secret.html')).to eql('Donkey!')
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
nanoc-4.6.1 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.6.0 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.5.4 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.5.3 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.5.2 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.5.1 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.5.0 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.4.7 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.4.6 spec/nanoc/regressions/gh_776_spec.rb