From 0c20e0fa286fdd948cf941a03a350fe28e2b751e Mon Sep 17 00:00:00 2001 From: Alex Young Date: Thu, 16 Apr 2015 12:32:55 +0100 Subject: Use 1.9's Encoding to do do away with UTF8-checking in mauve/alert.rb --- test/tc_mauve_alert.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/tc_mauve_alert.rb b/test/tc_mauve_alert.rb index 3f22030..7456d20 100644 --- a/test/tc_mauve_alert.rb +++ b/test/tc_mauve_alert.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 $:.unshift "../lib" @@ -494,4 +495,17 @@ EOF end + + def test_remove_html_utf_8 + problem_string = "
This is a ûŧđ ™ message.\n\n

" + fixed_string = Alert.remove_html(problem_string) + assert_equal "This is a ûŧđ ™ message.", fixed_string.strip + end + + def test_remove_html_invalid_character + problem_string = "caf\xa9".force_encoding("ascii") + fixed_string = Alert.remove_html(problem_string) + assert_equal "caf?", fixed_string + end + end -- cgit v1.2.1