require "spec_helper"
require "fileutils"
RSpec.describe IsoDoc do
it "generates file based on string input" do
FileUtils.rm_f "test.doc"
FileUtils.rm_f "test.html"
IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).convert("test", <<~"INPUT", false)
Cereals and pulses
Specifications and test methods
Rice
These results are based on a study carried out on three different types of kernel.
INPUT
expect(File.exist?("test.html")).to be true
html = File.read("test.html", encoding: "UTF-8")
expect(html).to match(%r{
Cereals and pulses\ \— Specifications and test methods\ \— Rice})
expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
end
it "generates HTML output docs with null configuration" do
FileUtils.rm_f "test.doc"
FileUtils.rm_f "test.html"
IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
Cereals and pulses
Specifications and test methods
Rice
These results are based on a study carried out on three different types of kernel.
INPUT
expect(File.exist?("test.html")).to be true
html = File.read("test.html", encoding: "UTF-8")
expect(html).to match(%r{Cereals and pulses\ \— Specifications and test methods\ \— Rice})
expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
end
it "generates Word output docs with null configuration" do
FileUtils.rm_f "test.doc"
FileUtils.rm_f "test.html"
IsoDoc::Iso::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
These results are based on a study carried out on three different types of kernel.
INPUT
expect(File.exist?("test.doc")).to be true
word = File.read("test.doc", encoding: "UTF-8")
expect(word).to match(/