diff options
author | David Heinemeier Hansson <david@envy8.local> | 2008-04-28 13:29:23 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@envy8.local> | 2008-04-28 13:29:23 -0500 |
commit | 9a80e97d58610895d62bfc158ede4c4358582819 (patch) | |
tree | 3553e3fb178e24f8971f8c7ec3e87b34b620a687 | |
parent | 0a6980f2dc6ef8b211323e0655f41702a4ce3eae (diff) | |
parent | 642bcd2d011ce8c32a0a69bfb4fd6942593584bb (diff) | |
download | rails-9a80e97d58610895d62bfc158ede4c4358582819.tar.gz rails-9a80e97d58610895d62bfc158ede4c4358582819.tar.bz2 rails-9a80e97d58610895d62bfc158ede4c4358582819.zip |
Merge branch 'master' of git@github.com:rails/rails
-rw-r--r-- | actionpack/lib/action_controller/assertions/selector_assertions.rb | 5 | ||||
-rw-r--r-- | actionpack/test/controller/assert_select_test.rb | 15 |
2 files changed, 15 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/assertions/selector_assertions.rb b/actionpack/lib/action_controller/assertions/selector_assertions.rb index 573405c0f9..272b8f6841 100644 --- a/actionpack/lib/action_controller/assertions/selector_assertions.rb +++ b/actionpack/lib/action_controller/assertions/selector_assertions.rb @@ -263,12 +263,15 @@ module ActionController if match_with = equals[:text] matches.delete_if do |match| text = "" + text.force_encoding(match_with.encoding) if text.respond_to?(:force_encoding) stack = match.children.reverse while node = stack.pop if node.tag? stack.concat node.children.reverse else - text << node.content + content = node.content + content.force_encoding(match_with.encoding) if content.respond_to?(:force_encoding) + text << content end end text.strip! unless NO_STRIP.include?(match.name) diff --git a/actionpack/test/controller/assert_select_test.rb b/actionpack/test/controller/assert_select_test.rb index c8ad56cbc0..5af579f3e3 100644 --- a/actionpack/test/controller/assert_select_test.rb +++ b/actionpack/test/controller/assert_select_test.rb @@ -345,10 +345,17 @@ class AssertSelectTest < Test::Unit::TestCase page.replace "test", "<div id=\"1\">\343\203\201\343\202\261\343\203\203\343\203\210</div>" end assert_select_rjs do - assert_select "#1", :text => "\343\203\201\343\202\261\343\203\203\343\203\210" - assert_select "#1", "\343\203\201\343\202\261\343\203\203\343\203\210" - assert_select "#1", Regexp.new("\343\203\201..\343\203\210",0,'U') - assert_raises(AssertionFailedError) { assert_select "#1", Regexp.new("\343\203\201.\343\203\210",0,'U') } + 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" + if str.respond_to?(:force_encoding) + str.force_encoding(Encoding::UTF_8) + assert_select str, /\343\203\201..\343\203\210/u + assert_raises(AssertionFailedError) { 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_raises(AssertionFailedError) { assert_select str, Regexp.new("\343\203\201.\343\203\210",0,'U') } + end end end |