require 'spec_helper' describe Softcover::Builders::Html do describe "when generating from PolyTeX source" do before(:all) { generate_book } after(:all) { remove_book } describe "#build!" do subject(:builder) { Softcover::Builders::Html.new } let(:file_to_be_removed) { path('html/should_be_removed.html') } before do # Create an empty file that should be removed automatically. File.write(file_to_be_removed, '') builder.build! end its(:built_files) { should include File.join('html', 'book.html') } it "should remove the HTML file without a corresponding LaTeX file" do expect(file_to_be_removed).not_to exist end describe "HTML output" do let(:output) { File.read("html/book.html") } subject { output } it { should include '' } it { should include 'pygments.css' } it { should include 'MathJax' } it { should_not include 'functionNumber'} context "HTML document" do subject(:doc) { Nokogiri::HTML(output) } context "frontmatter" do subject(:frontmatter) { doc.at_css('#frontmatter') } it { should_not be_nil } it "should link the preface to the frontmatter page" do link = '