Sha256: 0dc56cc85673b96bb33a13a7ccf43a76d9a3dd68ca829088c6db04efb2baea3a

Contents?: true

Size: 1.39 KB

Versions: 32

Compression:

Stored size: 1.39 KB

Contents

# -*- coding: UTF-8 -*-
require 'spec_helper'
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
}

verify_with_xml = lambda { |output|
  output.should =~ %r(<h>bacon</h>) ## 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

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
awestruct-0.5.6.beta5 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.6.beta4 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.6.beta3 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.6.beta2 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.6.beta spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.5 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.4.2 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.4.1 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.4 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.4.rc3 spec/erb_handler_spec.rb
awestruct-0.5.4.rc2 spec/erb_handler_spec.rb
awestruct-0.5.4.rc spec/erb_handler_spec.rb