# encoding=utf-8
require 'spec_helper'
describe 'Polytexnic::Pipeline#to_html' do
subject(:processed_text) { Polytexnic::Pipeline.new(polytex).to_html }
describe "text formatting" do
describe "italics" do
let(:polytex) { '\emph{foo bar}' }
it { should resemble 'foo bar' }
context "multiple instances" do
let(:polytex) do
'\emph{foo bar} and also \emph{baz quux}'
end
it { should resemble 'foo bar' }
it { should resemble 'baz quux' }
end
end
describe "boldface" do
let(:polytex) { '\textbf{boldface}' }
it { should resemble 'boldface' }
end
describe "small caps" do
let(:polytex) { '\textsc{small caps}' }
it { should resemble 'small caps' }
end
describe "small text" do
let(:polytex) { '{\small small text}' }
it { should resemble 'small text' }
end
describe "typewriter text" do
let(:polytex) { '\texttt{typewriter text}' }
it { should resemble 'typewriter text
' }
end
describe "strikeout text" do
let(:polytex) { '\sout{foo} bar' }
it { should resemble 'foo bar' }
end
describe "horizontal rule" do
let(:polytex) { '\hrule' }
it { should resemble '
function_name
' }
end
context "coloredtext" do
describe "coloredtext command" do
let(:polytex) { '\coloredtext{red}{text}' }
it { should resemble 'text' }
end
context "coloredtexthtml command" do
describe "with a lower-case hex color" do
let(:polytex) { '\coloredtexthtml{ff0000}{text}' }
it "should raise an error" do
expect { processed_text }.to raise_error
end
end
describe "with an upper-case hex color" do
let(:polytex) { '\coloredtexthtml{FF0000}{text}' }
it { should resemble 'text' }
end
end
end
end
end