spec/spec_helper.rb in asciidoctor-iso-0.9.9 vs spec/spec_helper.rb in asciidoctor-iso-0.10.0

- old
+ new

@@ -130,10 +130,45 @@ <workgroup/> </editorialgroup> </bibdata> HDR +HTML_HDR = <<~END + <html xmlns:epub="http://www.idpf.org/2007/ops"> + <head> + <title>test</title> + </head> + <body lang="EN-US" link="blue" vlink="#954F72"> + <div class="title-section"> + <p>&#160;</p> + </div> + <br/> + <div class="prefatory-section"> + <p>&#160;</p> + </div> + <br/> + <div class="main-section"> +END + +WORD_HDR = <<~END + <html xmlns:epub="http://www.idpf.org/2007/ops"> + <head> + <title>test</title> + </head> + <body lang="EN-US" link="blue" vlink="#954F72"> + <div class="WordSection1"> + <p>&#160;</p> + </div> + <br clear="all" class="section"/> + <div class="WordSection2"> + <p>&#160;</p> + </div> + <br clear="all" class="section"/> + <div class="WordSection3"> +END + + def stub_fetch_ref(**opts) xml = "" hit = double("hit") expect(hit).to receive(:"[]").with("title") do @@ -177,5 +212,15 @@ xml = hit.to_xml nil, opts File.write file, xml xml end end + +def mock_open_uri(code) + expect(OpenURI).to receive(:open_uri).and_wrap_original do |m, *args| + expect(args[0]).to be_instance_of String + file = "spec/examples/#{code.tr('-', '_')}.html" + File.write file, m.call(*args).read unless File.exist? file + File.read file + end +end +