Skip to content

Commit

Permalink
adds a magic comment to a test file
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Dec 27, 2011
1 parent bc3b00d commit bd493ba
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions test/assert_select_test.rb
@@ -1,3 +1,5 @@
# coding: utf-8

require 'abstract_unit'

class AssertSelectTest < ActionController::TestCase
Expand Down Expand Up @@ -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|
Expand Down Expand Up @@ -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", "<div id=\"1\">\343\203\201\343\202\261\343\203\203\343\203\210</div>"
page.replace "test", %(<div id="1">#{unicode}</div>)
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
Expand Down

0 comments on commit bd493ba

Please sign in to comment.