require 'spec_helper' module Hemingway describe Parser do before do @parser = Parser.new end describe "#basics" do it 'should create a paragraph inside a entry div' do html = @parser.parse("hello").html html.should == "

hello

" end it 'should allow me to newline the hell out of a file (\n invariant)' do html = @parser.parse("\\emph{hey}\n\n\n\n\n\n").html html.should == "

hey

" end it 'should create a new paragraph when two newlines are encountered' do html = @parser.parse("para 1\n\npara 2").html html.should == "

para 1

para 2

" end it 'should create a new paragraph when more than two newlines are encountered' do html = @parser.parse("para 1\n\n\n\n\n\n\npara 2").html html.should == "

para 1

para 2

" end it 'should create an empty div with the empty string' do html = @parser.parse("").html html.should == "
" end it 'should be cool with an empty tag' do html = @parser.parse("\\emph{}").html html.should == "

" end end end end