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.6.7 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.6.6 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.6.5 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.6.4 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.6.3 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.6.2 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.6.1 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.6.0 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.6.0.RC1 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.6.0.alpha4 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.6.0.alpha3 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.6.0.alpha1 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.7 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.7.RC2 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.7.RC1 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.6 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.6.beta9 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.6.beta8 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.6.beta7 spec/awestruct/handlers/erb_handler_spec.rb
awestruct-0.5.6.beta6 spec/awestruct/handlers/erb_handler_spec.rb