Skip to content

Commit

Permalink
resolves #293 fix asciidoc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed May 24, 2013
1 parent 102edc5 commit 2d248e0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions spec/asciidoc_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
require 'rspec/matchers.rb'

verify = lambda { |output|
output.gsub(/(^\s*\n|^\s*)/, '').should =~ %r(<div id="preamble">
# clean whitespace to make comparison easier
output.gsub(/(^\s*\n|^\s*|\s*$)/, '').should == %(<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>This is <strong>AsciiDoc</strong> in Awestruct.</p>
Expand All @@ -22,6 +23,7 @@
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)
Expand Down Expand Up @@ -69,7 +71,7 @@
]

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

end
3 changes: 1 addition & 2 deletions spec/support/shared_handler_example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ def create_handler(page)
it "should render page '#{theory[:page]}'" do
if theory[:unless].nil? or !theory[:unless][:exp].call()
handler = create_handler theory[:page]
handler.merge! additional_config_page if respond_to?("additional_config_page")

handler.update(additional_config_page) {|k, oldval, newval| oldval } if respond_to?("additional_config_page")
output = handler.rendered_content( handler.create_context )
output.should_not be_nil

Expand Down
3 changes: 2 additions & 1 deletion spec/test-data/handlers/asciidoctor_with_headers.ad
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
Stuart Rackham
2013-02-06
:awestruct-tags: [a, b, c]
:awestruct-layout: haml-layout
:name: NOT_HANDLED

This is *AsciiDoc* in {name}.
{awestruct-version}
{awestruct-version}
1 change: 1 addition & 0 deletions spec/test-data/handlers/empty-layout.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
=content

0 comments on commit 2d248e0

Please sign in to comment.