Hello World.
require "asciidoctor" def setup_tmpdir(method_name = :tmpdir) let(method_name) { File.join Dir.tmpdir, "asciidoctor-bibliography_tests" } around(:each) do |example| FileUtils.rm_rf method(method_name).call FileUtils.mkdir_p method(method_name).call example.run FileUtils.rm_rf method(method_name).call end end def setup_main_document(_path, content) input_path = File.join(tmpdir, "main.adoc") output_path = File.join(tmpdir, "main.html") File.open(input_path, "w") { |file| file.write content } [input_path, output_path] end def setup_file(_path, name, content) File.open(File.join(tmpdir, name), "w") { |file| file.write content } end def setup_bibliography(content) let(:bibliography_path) do File.join(tmpdir, "bibliography.bibtex") end before do File.open(bibliography_path, "w") { |file| file.write content } end end describe "asciidoctor integration" do setup_tmpdir setup_bibliography <<~BIBTEX @article{Foo00, author = {Foo Bar}, title = {Title}, publisher = {Publisher}, year = {2000} } BIBTEX describe "testing procedure" do it "works in the trivial case" do input_path, output_path = setup_main_document tmpdir, <<~'ADOC' Hello World. ADOC expect { `asciidoctor #{input_path}` }.to_not raise_exception expect(File.read(output_path)).to match <<~'BODY'
Hello World.
Hello World. (Bar, 2000)