Sha256: 627a0b4699d5a1f8d730f5ae56a8786b08cb32667ca1c38f06bc97e9d604e7a1

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

describe 'GH-1031', site: true, stdio: true do
  before do
    File.write('content/foo.md', '[<%= @items["/bar.*"].compiled_content %>]')
    File.write('content/bar.md', 'I am bar!')

    File.write('Rules', <<EOS)
  compile '/bar.*' do
    write '/bar.txt'
  end

  compile '/foo.*', rep: :default do
    write '/foo.txt'
  end

  compile '/foo.*', rep: :depz do
    filter :erb
    write '/foo_deps.txt'
  end
EOS
  end

  it 'recompiles all reps of a changed item' do
    Nanoc::CLI.run(%w[compile])
    expect(File.file?('output/bar.txt')).to be
    expect(File.file?('output/foo.txt')).to be
    expect(File.file?('output/foo_deps.txt')).to be

    File.write('Rules', <<EOS)
  compile '/bar.*' do
    write '/bar.txt'
  end

  compile '/foo.*', rep: :default do
    write '/foo-new.txt'
  end

  compile '/foo.*', rep: :depz do
    filter :erb
    write '/foo_deps.txt'
  end
EOS

    Nanoc::CLI.run(%w[compile])
    expect(File.file?('output/bar.txt')).to be
    expect(File.file?('output/foo.txt')).to be
    expect(File.file?('output/foo_deps.txt')).to be
    expect(File.read('output/foo_deps.txt')).to eq('[I am bar!]')

    File.write('content/bar.md', 'I am a newer bar!')

    Nanoc::CLI.run(%w[compile])
    expect(File.read('output/foo_deps.txt')).to eq('[I am a newer bar!]')
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nanoc-4.7.9 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.7.8 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.7.7 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.7.6 spec/nanoc/regressions/gh_1031_spec.rb