Skip to content

Commit

Permalink
Removes testing deprecations
Browse files Browse the repository at this point in the history
Also some reformating
  • Loading branch information
LightGuard committed Jul 31, 2013
1 parent 5eb4832 commit 0ae70ce
Show file tree
Hide file tree
Showing 8 changed files with 246 additions and 223 deletions.
83 changes: 43 additions & 40 deletions spec/asciidoc_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
verify = lambda { |output|
include EmmetMatchers
# clean whitespace to make comparison easier
output.should have_structure("div#preamble>div.sectionbody>div.paragraph>p>strong")
output.should have_structure('div#preamble>div.sectionbody>div.paragraph>p>strong')
}

verify_front_matter = lambda { |output, page|
Expand All @@ -27,46 +27,49 @@
}

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
}
]
[
{
: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
def additional_config_page
{ :name => 'Awestruct', :test => 10, :layout => 'empty-layout' }
end

it_should_behave_like 'a handler', theories
end
64 changes: 33 additions & 31 deletions spec/erb_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,52 @@
require 'rbconfig'

verify = lambda { |output|
output.should =~ %r(<h1>This is an ERB page</h1>)
output.should =~ %r(<h2>The fruit of the day is: apples</h2>)
output.should =~ %r(<h3>bacon</h3>) ## interpolated
output.should =~ %r(<h1>This is an ERB page</h1>)
output.should =~ %r(<h2>The fruit of the day is: apples</h2>)
output.should =~ %r(<h3>bacon</h3>) ## interpolated
}

verify_with_xml = lambda { |output|
output.should =~ %r(<h>bacon</h>) ## interpolated
output.should =~ %r(<h>bacon</h>) ## interpolated
}

verify_with_utf8 = lambda { |output|
if(RbConfig::CONFIG['target_os'] !~ /mswin|mingw/)
if RbConfig::CONFIG['target_os'] !~ /mswin|mingw/
output.should == "Besøg fra Danmark\n"
else
output.should == "\r\nBesøg fra Danmark\r\n"
end
}

theories =
[
{
:page => "erb-page.html.erb",
:simple_name => "erb-page",
:syntax => :erb,
:extension => '.html',
:matcher => verify
},
{
:page => "erb-page.xml.erb",
:simple_name => "erb-page",
:syntax => :erb,
:extension => '.xml',
:matcher => verify_with_xml
},
{
:page => "erb-utf-page.html.erb",
:simple_name => "erb-utf-page",
:syntax => :erb,
:extension => '.html',
:matcher => verify_with_utf8
}
]
[
{
:page => 'erb-page.html.erb',
:simple_name => 'erb-page',
:syntax => :erb,
:extension => '.html',
:matcher => verify
},
{
:page => 'erb-page.xml.erb',
:simple_name => 'erb-page',
:syntax => :erb,
:extension => '.xml',
:matcher => verify_with_xml
},
{
:page => 'erb-utf-page.html.erb',
:simple_name => 'erb-utf-page',
:syntax => :erb,
:extension => '.html',
:matcher => verify_with_utf8
}
]

describe Awestruct::Handlers::TiltHandler.to_s + "-Erb" do
let(:additional_config) { {:crunchy => 'bacon'} }
it_should_behave_like "a handler", theories
describe Awestruct::Handlers::TiltHandler.to_s + '-Erb' do
def additional_config
{ :crunchy => 'bacon' }
end
it_should_behave_like 'a handler', theories

end
121 changes: 62 additions & 59 deletions spec/haml_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
}

verify_atom = lambda { |output|
output.should == %(<?xml version="1.0" encoding="utf-8" ?>
output.should == '<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>http://example.com</id>
<title>A News Feed</title>
</feed>
)
'
}

verify_with_markdown = lambda { |output|
Expand All @@ -31,63 +31,66 @@
}

theories =
[
{
:page => "haml-page.html.haml",
:simple_name => "haml-page",
:syntax => :haml,
:extension => '.html',
:format => :html5,
:matcher => verify
},
{
:page => "haml-page.xml.haml",
:simple_name => "haml-page",
:syntax => :haml,
:extension => '.xml',
:format => :xhtml,
:matcher => verify
},
{
:page => 'haml-page.atom.haml',
:simple_name => 'haml-page',
:syntax => :haml,
:extension => '.atom',
:format => :xhtml,
:matcher => verify_atom
},
{
:page => "haml-with-markdown-page.html.haml",
:simple_name => "haml-with-markdown-page",
:syntax => :haml,
:extension => '.html',
:matcher => verify_with_markdown
},
{
:page => "haml-with-textile-page.html.haml",
:simple_name => "haml-with-textile-page",
:syntax => :haml,
:extension => '.html',
:matcher => verify_with_textile
},
{
:page => "haml-with-utf.html.haml",
:simple_name => "haml-with-utf",
:syntax => :haml,
:extension => '.html',
:matcher => verify_with_utf8
},
{
:page => "haml-with-variables.html.haml",
:simple_name => "haml-with-variables",
:syntax => :haml,
:extension => '.html',
:matcher => verify_with_variables
}
]
[
{
:page => 'haml-page.html.haml',
:simple_name => 'haml-page',
:syntax => :haml,
:extension => '.html',
:format => :html5,
:matcher => verify
},
{
:page => 'haml-page.xml.haml',
:simple_name => 'haml-page',
:syntax => :haml,
:extension => '.xml',
:format => :xhtml,
:matcher => verify
},
{
:page => 'haml-page.atom.haml',
:simple_name => 'haml-page',
:syntax => :haml,
:extension => '.atom',
:format => :xhtml,
:matcher => verify_atom
},
{
:page => 'haml-with-markdown-page.html.haml',
:simple_name => 'haml-with-markdown-page',
:syntax => :haml,
:extension => '.html',
:matcher => verify_with_markdown
},
{
:page => 'haml-with-textile-page.html.haml',
:simple_name => 'haml-with-textile-page',
:syntax => :haml,
:extension => '.html',
:matcher => verify_with_textile
},
{
:page => 'haml-with-utf.html.haml',
:simple_name => 'haml-with-utf',
:syntax => :haml,
:extension => '.html',
:matcher => verify_with_utf8
},
{
:page => 'haml-with-variables.html.haml',
:simple_name => 'haml-with-variables',
:syntax => :haml,
:extension => '.html',
:matcher => verify_with_variables
}
]

describe Awestruct::Handlers::TiltHandler.to_s + "-Haml" do
let(:additional_config) { {:crunchy => 'bacon'} }
it_should_behave_like "a handler", theories

describe Awestruct::Handlers::TiltHandler.to_s + '-Haml' do
def additional_config
{ :crunchy => 'bacon' }
end

it_should_behave_like 'a handler', theories
end
29 changes: 16 additions & 13 deletions spec/javascript_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@
require 'spec_helper'

verify = lambda { |output|
output.should =~ %r(var crunchy = "bacon")
output.should =~ %r(var crunchy = "bacon")
}

theories =
[
{
:page => "javascript-page.js",
:simple_name => "javascript-page",
:syntax => :javascript,
:extension => '.js',
:matcher => verify
}
]
[
{
:page => 'javascript-page.js',
:simple_name => 'javascript-page',
:syntax => :javascript,
:extension => '.js',
:matcher => verify
}
]

describe Awestruct::Handlers::TiltHandler.to_s + "-JavaScript" do
let(:additional_config) { {:interpolate => true, :crunchy => 'bacon'} }
it_should_behave_like "a handler", theories

describe Awestruct::Handlers::TiltHandler.to_s + '-JavaScript' do
def additional_config
{ :interpolate => true, :crunchy => 'bacon' }
end

it_should_behave_like 'a handler', theories
end
18 changes: 11 additions & 7 deletions spec/mustache_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,27 @@
theories =
[
{
:page => "mustache-page.html.mustache",
:simple_name => "mustache-page",
:page => 'mustache-page.html.mustache',
:simple_name => 'mustache-page',
:syntax => :mustache,
:extension => '.html',
:matcher => verify
},
{
:page => "mustache-page.xml.mustache",
:simple_name => "mustache-page",
:page => 'mustache-page.xml.mustache',
:simple_name => 'mustache-page',
:syntax => :mustache,
:extension => '.xml',
:matcher => verify
}
]

describe Awestruct::Handlers::TiltHandler.to_s + "-Mustache" do
let(:additional_config) { {:markup_type => 'Mustache'} }
it_should_behave_like "a handler", theories

describe Awestruct::Handlers::TiltHandler.to_s + '-Mustache' do
def additional_config
{:markup_type => 'Mustache'}
end

it_should_behave_like 'a handler', theories

end

0 comments on commit 0ae70ce

Please sign in to comment.