diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2011-08-23 14:55:31 +0100 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2011-08-23 14:56:04 +0100 |
commit | 13400ac289344dae002c77a3c2b820268f08745e (patch) | |
tree | 837ec5a22cfa29c2c8d59c8995bef0fd408e0e0a /actionpack/test/template | |
parent | f7f9003cd54a697fbacebb01675dc6a7467fbf88 (diff) | |
download | rails-13400ac289344dae002c77a3c2b820268f08745e.tar.gz rails-13400ac289344dae002c77a3c2b820268f08745e.tar.bz2 rails-13400ac289344dae002c77a3c2b820268f08745e.zip |
Ensure regexp and hash key are UTF-8
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/javascript_helper_test.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/test/template/javascript_helper_test.rb b/actionpack/test/template/javascript_helper_test.rb index bab9d42472..4b9c3c97b1 100644 --- a/actionpack/test/template/javascript_helper_test.rb +++ b/actionpack/test/template/javascript_helper_test.rb @@ -1,4 +1,5 @@ require 'abstract_unit' +require 'active_support/core_ext/string/encoding' class JavaScriptHelperTest < ActionView::TestCase tests ActionView::Helpers::JavaScriptHelper @@ -27,7 +28,11 @@ class JavaScriptHelperTest < ActionView::TestCase assert_equal %(This \\"thing\\" is really\\n netos\\'), escape_javascript(%(This "thing" is really\n netos')) assert_equal %(backslash\\\\test), escape_javascript( %(backslash\\test) ) assert_equal %(dont <\\/close> tags), escape_javascript(%(dont </close> tags)) - assert_equal %(unicode 
 newline), escape_javascript(%(unicode \342\200\250 newline)) + if "ruby".encoding_aware? + assert_equal %(unicode 
 newline), escape_javascript(%(unicode \342\200\250 newline).force_encoding('UTF-8').encode!) + else + assert_equal %(unicode 
 newline), escape_javascript(%(unicode \342\200\250 newline)) + end assert_equal %(dont <\\/close> tags), j(%(dont </close> tags)) end |