2010-09-10 12:21:30 -04:00
|
|
|
# encoding: UTF-8
|
2011-05-11 03:44:02 -04:00
|
|
|
require File.expand_path('../helper', __FILE__)
|
2011-02-24 02:18:32 -05:00
|
|
|
require 'erb'
|
2010-09-10 12:21:30 -04:00
|
|
|
|
2015-01-10 14:30:47 -05:00
|
|
|
class BaseTest < Minitest::Test
|
2010-09-10 12:21:30 -04:00
|
|
|
setup do
|
|
|
|
@base = Sinatra.new(Sinatra::Base)
|
|
|
|
@base.set :views, File.dirname(__FILE__) + "/views"
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'allows unicode strings in ascii templates per default (1.9)' do
|
2010-10-21 12:41:40 -04:00
|
|
|
next unless defined? Encoding
|
2011-03-21 06:57:15 -04:00
|
|
|
@base.new!.erb(File.read(@base.views + "/ascii.erb").encode("ASCII"), {}, :value => "åkej")
|
2010-09-10 12:21:30 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'allows ascii strings in unicode templates per default (1.9)' do
|
|
|
|
next unless defined? Encoding
|
2011-03-21 06:57:15 -04:00
|
|
|
@base.new!.erb(:utf8, {}, :value => "Some Lyrics".encode("ASCII"))
|
2010-09-10 12:21:30 -04:00
|
|
|
end
|
2011-02-24 02:18:32 -05:00
|
|
|
end
|