Sha256: 18581081f2e3c45ec261f86fffc7faaac4d65eb8817d57f6d198873387d6da95

Contents?: true

Size: 1.3 KB

Versions: 18

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

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

18 entries across 18 versions & 1 rubygems

Version Path
nanoc-4.8.12 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.8.11 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.8.10 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.8.9 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.8.8 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.8.7 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.8.6 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.8.5 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.8.4 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.8.3 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.8.2 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.8.1 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.8.0 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.7.14 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.7.13 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.7.12 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.7.11 spec/nanoc/regressions/gh_1031_spec.rb
nanoc-4.7.10 spec/nanoc/regressions/gh_1031_spec.rb