spec/asciidoc_handler_spec.rb in awestruct-0.5.4.beta1 vs spec/asciidoc_handler_spec.rb in awestruct-0.5.4.rc
- old
+ new
@@ -13,21 +13,48 @@
}
verify_headers = lambda { |output, page|
extend RSpec::Matchers
page.author.should == 'Stuart Rackham'
+ page.email.should == 'srackham@example.com'
+ page.authors.should_not be_nil
+ page.authors.size.should == 2
+ page.authors.first.name.should == 'Stuart Rackham'
+ page.authors.first.email.should == 'srackham@example.com'
+ page.authors.last.name.should == 'Dan Allen'
+ page.authors.last.email.should be_nil
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(This is <strong>AsciiDoc</strong> page named Awestruct in an Awestruct site.)
output.should =~ %r(#{Awestruct::VERSION})
+ output.should =~ %r(UTF-8)
}
+verify_attributes = lambda { |output, page|
+ extend RSpec::Matchers
+ expect(output).to RSpec::Matchers::BuiltIn::Include.new("docname=#{page.simple_name};")
+ expect(output).to RSpec::Matchers::BuiltIn::Include.new("docfile=#{File.expand_path page.source_path};")
+ expect(output).to RSpec::Matchers::BuiltIn::Include.new("docdir=#{File.expand_path File.dirname(page.source_path)};")
+}
+
+verify_interpolation = lambda { |output, page|
+ extend RSpec::Matchers
+ output.should =~ %r(UTF-8)
+ page.site.interpolate.should == true
+}
+
+verify_no_interpolation = lambda { |output, page|
+ extend RSpec::Matchers
+ output.should =~ %r(\#\{site\.encoding\})
+ page.site.interpolate.should == true
+}
+
theories =
[
{
:page => 'asciidoc-page.ad',
:simple_name => 'asciidoc-page',
@@ -60,9 +87,32 @@
:page => 'asciidoctor_with_headers.ad',
:simple_name => 'asciidoctor_with_headers',
:syntax => :asciidoc,
:extension => '.html',
:matcher => verify_headers
+ },
+ {
+ :page => 'asciidoc_with_attributes.ad',
+ :simple_name => 'asciidoc_with_attributes',
+ :syntax => :asciidoc,
+ :extension => '.html',
+ :matcher => verify_attributes
+ },
+ {
+ :page => 'asciidoc_with_interpolation.ad',
+ :simple_name => 'asciidoc_with_interpolation',
+ :syntax => :asciidoc,
+ :extension => '.html',
+ :matcher => verify_interpolation,
+ :site_overrides => { :interpolate => true }
+ },
+ {
+ :page => 'asciidoc_without_interpolation.ad',
+ :simple_name => 'asciidoc_without_interpolation',
+ :syntax => :asciidoc,
+ :extension => '.html',
+ :matcher => verify_no_interpolation,
+ :site_overrides => { :interpolate => true }
}
]
describe Awestruct::Handlers::AsciidoctorHandler do