Skip to content
Browse files

Add a test for ActiveSupport::Multibyte::Chars.consumes?.

  • Loading branch information...
1 parent 22f75d5 commit 042fd971271791659c90e065e761cf90d3117b74 @Manfred Manfred committed Sep 21, 2008
Showing with 8 additions and 1 deletion.
  1. +8 −1 activesupport/test/multibyte_chars_test.rb
View
9 activesupport/test/multibyte_chars_test.rb
@@ -29,7 +29,8 @@ class MultibyteCharsTest < Test::Unit::TestCase
include MultibyteTest
def setup
- @chars = ActiveSupport::Multibyte::Chars.new UNICODE_STRING
+ @proxy_class = ActiveSupport::Multibyte::Chars
+ @chars = @proxy_class.new UNICODE_STRING
end
def test_wraps_the_original_string
@@ -70,6 +71,12 @@ def test_should_concatenate
assert_equal 'ab', 'a'.mb_chars << 'b'.mb_chars
end
+ def test_consumes_utf8_strings
+ assert @proxy_class.consumes?(UNICODE_STRING)
+ assert @proxy_class.consumes?(ASCII_STRING)
+ assert !@proxy_class.consumes?(BYTE_STRING)
+ end
+
if RUBY_VERSION < '1.9'
def test_concatenation_should_return_a_proxy_class_instance
assert_equal ActiveSupport::Multibyte.proxy_class, ('a'.mb_chars + 'b').class

0 comments on commit 042fd97

Please sign in to comment.
Something went wrong with that request. Please try again.