# encoding=utf-8 require 'spec_helper' describe 'Polytexnic::Pipeline#to_html' do let(:pipeline) { Polytexnic::Pipeline.new(polytex) } subject(:processed_text) { pipeline.to_html } describe '\chapter' do context "with a name" do let(:polytex) do <<-'EOS' \chapter{Foo \emph{bar}} \label{cha:foo} EOS end let(:output) do <<-'EOS'
EOS end it { should resemble output } end context "with no name" do let(:polytex) do <<-'EOS' \chapter{} \label{cha:foo} EOS end let(:output) do <<-'EOS' EOS end it { should resemble output } end context "with an alternate to 'Chapter'" do before do pipeline.stub(:custom_commands). and_return('\renewcommand{\chaptername}{Chapitre}') end let(:polytex) do <<-'EOS' \chapter{Foo \emph{bar}} \label{cha:foo} EOS end let(:output) do <<-'EOS' EOS end it { should resemble output } end end describe '\section' do let(:polytex) do <<-'EOS' \section{Foo} \label{sec:foo} EOS end let(:output) do <<-'EOS' EOS end it { should resemble output } end describe '\subsection' do let(:polytex) do <<-'EOS' \section{Foo} \label{sec:foo} \subsection{Bar} \label{sec:bar} EOS end let(:output) do <<-'EOS' EOS end it { should resemble output } end describe '\subsubsection' do let(:polytex) do <<-'EOS' \chapter{The Chapter} \label{cha:the_chapter} \section{Foo} \label{sec:foo} \subsection{Bar} \label{sec:bar} \subsubsection{Baz} \label{sec:baz} EOS end let(:output) do <<-'EOS' EOS end it { should resemble output } end describe '\chapter*' do let(:polytex) do <<-'EOS' \chapter*{Preface} Lorem ipsum EOS end it { should resemble '