Permalink
Browse files

Proper encoding test.

  • Loading branch information...
1 parent 222d2cb commit ea1426f38b46ee8bfeac17d9b38bfb29abe7aef4 @rkh committed Sep 10, 2010
Showing with 20 additions and 8 deletions.
  1. +18 −0 test/encoding_test.rb
  2. +0 −8 test/settings_test.rb
  3. +2 −0 test/views/utf8.haml
View
18 test/encoding_test.rb
@@ -0,0 +1,18 @@
+# encoding: UTF-8
+require File.dirname(__FILE__) + '/helper'
+
+class BaseTest < Test::Unit::TestCase
+ 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
+ @base.new.haml(:ascii, {}, :value => "åkej")
+ end
+
+ it 'allows ascii strings in unicode templates per default (1.9)' do
+ next unless defined? Encoding
+ @base.new.haml(:utf8, {}, :value => "Some Lyrics".encode("ASCII"))
+ end
+end
View
8 test/settings_test.rb
@@ -1,4 +1,3 @@
-# encoding: UTF-8
require File.dirname(__FILE__) + '/helper'
class SettingsTest < Test::Unit::TestCase
@@ -375,11 +374,4 @@ def foo=(value)
assert ! @application.lock?
end
end
-
- describe 'default_encoding' do
- it 'allows unicode strings in ascii templates per default (1.9)' do
- @base.set :views, File.dirname(__FILE__) + "/views"
- @base.new.haml(:ascii, {}, :value => "åkej")
- end
- end
end
View
2 test/views/utf8.haml
@@ -0,0 +1,2 @@
+%h1= value
+Ingen vill veta var du köpt din tröja.

0 comments on commit ea1426f

Please sign in to comment.