Sha256: d60c5664910ce4583dfab2bf689a8b5e51ee5ba0bd54bf0b27adc51a967b29d8

Contents?: true

Size: 736 Bytes

Versions: 4

Compression:

Stored size: 736 Bytes

Contents

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

    File.write('lib/stuff.rb', <<EOS)
Class.new(Nanoc::Filter) do
  identifier :gh_1031_text2bin
  type :text => :binary

  def run(content, params = {})
    File.write(output_filename, content)
  end
end
EOS

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

  compile '/foo.*' do
    filter :erb
    write '/foo.txt'
  end
EOS
  end

  it 'can access textual content of now-binary item' do
    Nanoc::CLI.run(%w[compile])
    expect(File.read('output/foo.txt')).to eql('[I am bar!]')
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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