aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/assertions/selector_assertions.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-04-27 17:52:35 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-04-28 10:52:23 -0700
commit642bcd2d011ce8c32a0a69bfb4fd6942593584bb (patch)
treee6e1d6044dcd622c11ce8806738e67bfd9d8ecdb /actionpack/lib/action_controller/assertions/selector_assertions.rb
parent8af98c3f8143d7086e15d4938fd56512ed584f2e (diff)
downloadrails-642bcd2d011ce8c32a0a69bfb4fd6942593584bb.tar.gz
rails-642bcd2d011ce8c32a0a69bfb4fd6942593584bb.tar.bz2
rails-642bcd2d011ce8c32a0a69bfb4fd6942593584bb.zip
Ruby 1.9 compat: force assert_select text encoding to the encoding of the regexp it's matching against.
Diffstat (limited to 'actionpack/lib/action_controller/assertions/selector_assertions.rb')
-rw-r--r--actionpack/lib/action_controller/assertions/selector_assertions.rb5
1 files changed, 4 insertions, 1 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)