1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00
sinatra/test/encoding_test.rb

21 lines
600 B
Ruby
Raw Normal View History

2010-09-10 12:21:30 -04:00
# encoding: UTF-8
require File.expand_path('helper', __dir__)
require 'erb'
2010-09-10 12:21:30 -04:00
class BaseTest < Minitest::Test
2010-09-10 12:21:30 -04:00
setup do
@base = Sinatra.new(Sinatra::Base)
@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
next unless defined? Encoding
@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
@base.new!.erb(:utf8, {}, :value => "Some Lyrics".encode("ASCII"))
2010-09-10 12:21:30 -04:00
end
end