From 0a47407bb645cfe81883c815d5b06ad2e7e3a367 Mon Sep 17 00:00:00 2001 From: Aleksandr Koss Date: Sun, 16 May 2010 08:01:09 +0700 Subject: [PATCH] Fix assert_select with utf-8 on 1.9.2 [#4518 state:resolved] --- .../action_dispatch/testing/assertions/selector.rb | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/actionpack/lib/action_dispatch/testing/assertions/selector.rb b/actionpack/lib/action_dispatch/testing/assertions/selector.rb index 9deabf5..3533de5 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/selector.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/selector.rb @@ -1,4 +1,5 @@ require 'action_controller/vendor/html-scanner' +require 'iconv' #-- # Copyright (c) 2006 Assaf Arkin (http://labnotes.org) @@ -279,6 +280,8 @@ module ActionDispatch end end text.strip! unless NO_STRIP.include?(match.name) + ic = Iconv.new('UTF-8//IGNORE', 'UTF-8') + text = ic.iconv(text + ' ')[0..-2] unless match_with.is_a?(Regexp) ? (text =~ match_with) : (text == match_with.to_s) content_mismatch ||= build_message(message, " expected but was\n.", match_with, text) true -- 1.6.6