From bd493ba93eef2964b1b1b1a7a990199c5b67309a Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 27 Dec 2011 14:59:46 -0800 Subject: [PATCH] adds a magic comment to a test file --- test/assert_select_test.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/test/assert_select_test.rb b/test/assert_select_test.rb index cabd277..f627f17 100644 --- a/test/assert_select_test.rb +++ b/test/assert_select_test.rb @@ -1,3 +1,5 @@ +# coding: utf-8 + require 'abstract_unit' class AssertSelectTest < ActionController::TestCase @@ -47,7 +49,7 @@ def test_assert_select_from_rjs_with_single_result assert_select "#2" end end - + # With multiple results. def test_assert_select_from_rjs_with_multiple_results render_rjs do |page| @@ -121,19 +123,22 @@ def test_assert_select_rjs_fails_if_nothing_to_pick def test_assert_select_rjs_with_unicode # Test that non-ascii characters (which are converted into \uXXXX in RJS) are decoded correctly. + + unicode = "\343\203\201\343\202\261\343\203\203\343\203\210" render_rjs do |page| - page.replace "test", "
\343\203\201\343\202\261\343\203\203\343\203\210
" + page.replace "test", %(
#{unicode}
) end + assert_select_rjs do str = "#1" - assert_select str, :text => "\343\203\201\343\202\261\343\203\203\343\203\210" - assert_select str, "\343\203\201\343\202\261\343\203\203\343\203\210" + assert_select str, :text => unicode + assert_select str, unicode if str.respond_to?(:force_encoding) assert_select str, /\343\203\201..\343\203\210/u assert_raise(Assertion) { assert_select str, /\343\203\201.\343\203\210/u } else - assert_select str, Regexp.new("\343\203\201..\343\203\210",0,'U') - assert_raise(Assertion) { assert_select str, Regexp.new("\343\203\201.\343\203\210",0,'U') } + assert_select str, Regexp.new("\343\203\201..\343\203\210", 0, 'U') + assert_raise(Assertion) { assert_select str, Regexp.new("\343\203\201.\343\203\210", 0, 'U') } end end end