Sha256: 9cd187440733cbd016c87e2a5925bff2383b42f38f8102e6e0160538b774e34e

Contents?: true

Size: 896 Bytes

Versions: 13

Compression:

Stored size: 896 Bytes

Contents

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

    File.write('Rules', <<EOS)
  compile '/donkey.*' do
    filter :erb
    snapshot :secret, path: '/donkey-secret.html'
    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

13 entries across 13 versions & 1 rubygems

Version Path
nanoc-4.7.9 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.7.8 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.7.7 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.7.6 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.7.5 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.7.4 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.7.3 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.7.2 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.7.1 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.7.0 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.6.4 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.6.3 spec/nanoc/regressions/gh_776_spec.rb
nanoc-4.6.2 spec/nanoc/regressions/gh_776_spec.rb