# -*- coding: UTF-8 -*-
require 'spec_helper'
require 'rbconfig'
verify = lambda { |output|
output.should =~ %r(
This is an ERB page
)
output.should =~ %r(The fruit of the day is: apples
)
output.should =~ %r(bacon
) ## interpolated
}
verify_with_xml = lambda { |output|
output.should =~ %r(bacon) ## interpolated
}
verify_with_utf8 = lambda { |output|
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,
:site_overrides => { :crunchy => 'bacon' }
},
{
:page => 'erb-page.xml.erb',
:simple_name => 'erb-page',
:syntax => :erb,
:extension => '.xml',
:matcher => verify_with_xml,
:site_overrides => { :crunchy => 'bacon' }
},
{
: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
it_should_behave_like 'a handler', theories
end