require "spec_helper" require "fileutils" WORD_HTML_CSS = { wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", }.freeze WORD_HTML_CSS_HEADER_HTML = { wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", header: "spec/assets/header.html", }.freeze WORD_HTML_CSS_WORDINTRO = { wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html", }.freeze RSpec.describe IsoDoc do it "generates file based on string input" do IsoDoc::Iso::HtmlConvert.new(WORD_HTML_CSS.merge(filename: "test")).convert("test", <<~"INPUT", false) <title format="text/plain" language="en" type="title-intro">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 IsoDoc::Iso::HtmlConvert.new(WORD_HTML_CSS.dup).convert("test", <<~"INPUT", false) <title format="text/plain" language="en" type="title-intro">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 IsoDoc::Iso::WordConvert.new(WORD_HTML_CSS.dup).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(/