Skip to content

Commit bd493ba

Browse files
committed
adds a magic comment to a test file
1 parent bc3b00d commit bd493ba

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

test/assert_select_test.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# coding: utf-8
2+
13
require 'abstract_unit'
24

35
class AssertSelectTest < ActionController::TestCase
@@ -47,7 +49,7 @@ def test_assert_select_from_rjs_with_single_result
4749
assert_select "#2"
4850
end
4951
end
50-
52+
5153
# With multiple results.
5254
def test_assert_select_from_rjs_with_multiple_results
5355
render_rjs do |page|
@@ -121,19 +123,22 @@ def test_assert_select_rjs_fails_if_nothing_to_pick
121123

122124
def test_assert_select_rjs_with_unicode
123125
# Test that non-ascii characters (which are converted into \uXXXX in RJS) are decoded correctly.
126+
127+
unicode = "\343\203\201\343\202\261\343\203\203\343\203\210"
124128
render_rjs do |page|
125-
page.replace "test", "<div id=\"1\">\343\203\201\343\202\261\343\203\203\343\203\210</div>"
129+
page.replace "test", %(<div id="1">#{unicode}</div>)
126130
end
131+
127132
assert_select_rjs do
128133
str = "#1"
129-
assert_select str, :text => "\343\203\201\343\202\261\343\203\203\343\203\210"
130-
assert_select str, "\343\203\201\343\202\261\343\203\203\343\203\210"
134+
assert_select str, :text => unicode
135+
assert_select str, unicode
131136
if str.respond_to?(:force_encoding)
132137
assert_select str, /\343\203\201..\343\203\210/u
133138
assert_raise(Assertion) { assert_select str, /\343\203\201.\343\203\210/u }
134139
else
135-
assert_select str, Regexp.new("\343\203\201..\343\203\210",0,'U')
136-
assert_raise(Assertion) { assert_select str, Regexp.new("\343\203\201.\343\203\210",0,'U') }
140+
assert_select str, Regexp.new("\343\203\201..\343\203\210", 0, 'U')
141+
assert_raise(Assertion) { assert_select str, Regexp.new("\343\203\201.\343\203\210", 0, 'U') }
137142
end
138143
end
139144
end

0 commit comments

Comments
 (0)