Sha256: 5b0869eb39af68bfe77a57e689d11e08c0a283f6bc7349893b55a5d8a32cb5da

Contents?: true

Size: 1.86 KB

Versions: 1

Compression:

Stored size: 1.86 KB

Contents

require 'spec_helper'

describe Marksman::Parser do

  it 'should parse a file with meta data' do
    presentation = Marksman::Parser.new.parse('spec/data/example.md')
    expect(presentation.title).to eq('This is an example presentation')
    expect(presentation.slides).to eq([
      Marksman::Slide.new({
        slide: '<p>First Page</p>',
        notes: ''
      }),
      Marksman::Slide.new({
        slide: '<p>Second Page</p>',
        notes: '<p>Author comment</p>'
      }),
      Marksman::Slide.new({
        slide: '<p>Third Page</p>',
        notes: ''
      })
    ])

    expect(presentation.filename).to eq('example.md')
    expect(presentation.theme).to eq(Marksman::Theme.new('plain'))
    expect(presentation.metadata).to eq({
      example: true,
      filename: 'example.md',
      theme: 'plain',
      title: 'This is an example presentation'
    })
  end

  it 'should parse a file without meta data' do
    presentation = Marksman::Parser.new.parse('spec/data/example_without_metadata.md')
    expect(presentation.title).to eq('example_without_metadata.md')
    expect(presentation.slides).to eq([
      Marksman::Slide.new({
        slide: '<p>First Page</p>',
        notes: ''
      }),
      Marksman::Slide.new({
        slide: '<p>Second Page</p>',
        notes: '<p>Author comment</p>'
      }),
      Marksman::Slide.new({
        slide: '<p>Third Page</p>',
        notes: ''
      })
    ])

    expect(presentation.filename).to eq('example_without_metadata.md')
    expect(presentation.theme).to eq(Marksman::Theme.new('plain'))
    expect(presentation.metadata).to eq({
      filename: 'example_without_metadata.md',
      theme: 'plain',
      title: 'example_without_metadata.md'
    })
  end

  it 'should throw an exception if the file was not there' do
    expect{Marksman::Parser.new.parse('spec/data/example-not-existing.md')}.to raise_error
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marksman-0.1 spec/marksman/parser_spec.rb