2010-09-10 12:21:30 -04:00
|
|
|
# encoding: UTF-8
|
2021-10-18 12:40:01 -04:00
|
|
|
require File.expand_path('helper', __dir__)
|
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)
|
2020-03-13 17:20:04 -04:00
|
|
|
@base.set :views, __dir__ + "/views"
|
2010-09-10 12:21:30 -04:00
|
|
|
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
|