Sha256: 7607a1273e46770d093ee8560893e9d7993819c081e7ed95d381c61688f4502d

Contents?: true

Size: 895 Bytes

Versions: 4

Compression:

Stored size: 895 Bytes

Contents

require 'spec_helper'

describe Machined::Processors::FrontMatterProcessor do
  it 'parses the front matter and adds locals' do
    within_construct do |c|
      c.file 'pages/index.html.haml', <<-CONTENT.unindent
        ---
        title: Hello
        tags:
        - 1
        - 2
        ---
        = title.inspect
        = tags.inspect
      CONTENT

      machined.pages['index.html'].to_s.should == <<-CONTENT.unindent
        "Hello"
        [1, 2]
      CONTENT
    end
  end

  it 'ignores pages without front matter' do
    within_construct do |c|
      c.file 'pages/index.html.md', <<-CONTENT.unindent
        Title
        ---
        Another Title
        ---
        Content...
      CONTENT
      machined.pages['index.html'].to_s.should == <<-CONTENT.unindent
        <h2>Title</h2>

        <h2>Another Title</h2>

        <p>Content...</p>
      CONTENT
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
machined-1.1.0 spec/machined/processors/front_matter_processor_spec.rb
machined-1.0.3 spec/machined/processors/front_matter_processor_spec.rb
machined-1.0.2 spec/machined/processors/front_matter_processor_spec.rb
machined-1.0.1 spec/machined/processors/front_matter_processor_spec.rb