Sha256: 3286d396e8d6eb81927d7c8ce7be2f89b5ac81ba5cb45cfb06fd5d29c7ff9b45

Contents?: true

Size: 1.96 KB

Versions: 3

Compression:

Stored size: 1.96 KB

Contents

require 'spec_helper'
require 'rspec/matchers.rb'

verify = lambda { |output|
  include EmmetMatchers
  # clean whitespace to make comparison easier
  output.should have_structure("div#preamble>div.sectionbody>div.paragraph>p>strong")
}

verify_front_matter = lambda { |output, page|
  page.title.should == 'AwestructAsciiDoc'
  output.should_not =~ %r(title: AwestructAsciiDoc)
}

verify_headers = lambda { |output, page|
  extend RSpec::Matchers
  page.author.should == 'Stuart Rackham'
  page.title.should == 'AsciiDoc'
  page.doctitle.should == 'AsciiDoc'
  page.name.should == 'Awestruct'
  page.layout.should == 'haml-layout'
  page.tags.should be_a_kind_of(Array)
  page.tags.should == %w(a b c)
  page.date.should be_a_kind_of(Date)
  output.should =~ %r(This is <strong>AsciiDoc</strong> in Awestruct.)
  output.should =~ %r(#{Awestruct::VERSION})
}

theories =
  [
    {
      :page => "asciidoc-page.ad",
      :simple_name => "asciidoc-page",
      :syntax => :asciidoc,
      :extension => '.html',
      :matcher => verify
    },
    {
      :page => "asciidoc-page.adoc",
      :simple_name => "asciidoc-page",
      :syntax => :asciidoc,
      :extension => '.html',
      :matcher => verify
    },
    {
      :page => "asciidoc-page.asciidoc",
      :simple_name => "asciidoc-page",
      :syntax => :asciidoc,
      :extension => '.html',
      :matcher => verify
    },
    {
      :page => "asciidoctor_with_front_matter.ad",
      :simple_name => "asciidoctor_with_front_matter",
      :syntax => :asciidoc,
      :extension => '.html' ,
      :matcher => verify_front_matter
    },
    {
      :page => "asciidoctor_with_headers.ad",
      :simple_name => "asciidoctor_with_headers",
      :syntax => :asciidoc,
      :extension => '.html',
      :matcher => verify_headers
    }
  ]

describe Awestruct::Handlers::AsciidoctorHandler do
  let(:additional_config_page) { {:name => 'Awestruct', :test => 10, :layout => 'empty-layout'} }
  it_should_behave_like "a handler", theories

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
awestruct-0.5.3 spec/asciidoc_handler_spec.rb
awestruct-0.5.2.1 spec/asciidoc_handler_spec.rb
awestruct-0.5.2 spec/asciidoc_handler_spec.rb