Sha256: da1331357bf36a0a1b79ca3194d91513095e2ed1d033b2c9cf42d14ab4cead1f

Contents?: true

Size: 1.32 KB

Versions: 3

Compression:

Stored size: 1.32 KB

Contents

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 == "<div class='entry'><p>hello</p></div>"
      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 == "<div class='entry'><p><em>hey</em></p></div>"
      end

      it 'should create a new paragraph when two newlines are encountered' do
        html = @parser.parse("para 1\n\npara 2").html
        html.should == "<div class='entry'><p>para 1</p><p>para 2</p></div>"
      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 == "<div class='entry'><p>para 1</p><p>para 2</p></div>"
      end

      it 'should create an empty div with the empty string' do
        html = @parser.parse("").html
        html.should == "<div class='entry'></div>"
      end

      it 'should be cool with an empty tag' do
        html = @parser.parse("\\emph{}").html
        html.should == "<div class='entry'><p><em></em></p></div>"
      end

    end


  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hemingway-1.0.0 spec/parser_spec.rb
hemingway-0.0.3 spec/parser_spec.rb
hemingway-0.0.2 spec/parser_spec.rb