Methods
S
T
Included Modules
Instance Public methods
setup()
# File activesupport/test/multibyte_chars_test.rb, line 14
def setup
  @proxy_class = ActiveSupport::Multibyte::Chars
  @chars = @proxy_class.new UNICODE_STRING
end
test_ascii_strings_are_treated_at_utf8_strings()
# File activesupport/test/multibyte_chars_test.rb, line 85
def test_ascii_strings_are_treated_at_utf8_strings
  assert_equal ActiveSupport::Multibyte.proxy_class, ASCII_STRING.mb_chars.class
end
test_concatenate_should_return_proxy_instance()
# File activesupport/test/multibyte_chars_test.rb, line 89
def test_concatenate_should_return_proxy_instance
  assert(('a'.mb_chars + 'b').kind_of?(@proxy_class))
  assert(('a'.mb_chars + 'b'.mb_chars).kind_of?(@proxy_class))
  assert(('a'.mb_chars << 'b').kind_of?(@proxy_class))
  assert(('a'.mb_chars << 'b'.mb_chars).kind_of?(@proxy_class))
end
test_concatenation_should_return_a_proxy_class_instance()
# File activesupport/test/multibyte_chars_test.rb, line 80
def test_concatenation_should_return_a_proxy_class_instance
  assert_equal ActiveSupport::Multibyte.proxy_class, ('a'.mb_chars + 'b').class
  assert_equal ActiveSupport::Multibyte.proxy_class, ('a'.mb_chars << 'b').class
end
test_consumes_utf8_strings()
# File activesupport/test/multibyte_chars_test.rb, line 63
def test_consumes_utf8_strings
  assert @proxy_class.consumes?(UNICODE_STRING)
  assert @proxy_class.consumes?(ASCII_STRING)
  assert !@proxy_class.consumes?(BYTE_STRING)
end
test_forwarded_bang_method_calls_should_return_the_original_chars_instance()
# File activesupport/test/multibyte_chars_test.rb, line 38
def test_forwarded_bang_method_calls_should_return_the_original_chars_instance
  assert_kind_of @proxy_class, @chars.__method_for_multibyte_testing!
  assert_equal @chars.object_id, @chars.__method_for_multibyte_testing!.object_id
end
test_forwarded_method_calls_should_return_new_chars_instance()
# File activesupport/test/multibyte_chars_test.rb, line 33
def test_forwarded_method_calls_should_return_new_chars_instance
  assert_kind_of @proxy_class, @chars.__method_for_multibyte_testing
  assert_not_equal @chars.object_id, @chars.__method_for_multibyte_testing.object_id
end
test_forwarded_method_with_non_string_result_should_be_returned_vertabim()
# File activesupport/test/multibyte_chars_test.rb, line 47
def test_forwarded_method_with_non_string_result_should_be_returned_vertabim
  assert_equal ''.__method_for_multibyte_testing_with_integer_result, @chars.__method_for_multibyte_testing_with_integer_result
end
test_methods_are_forwarded_to_wrapped_string_for_byte_strings()
# File activesupport/test/multibyte_chars_test.rb, line 43
def test_methods_are_forwarded_to_wrapped_string_for_byte_strings
  assert_equal BYTE_STRING.class, BYTE_STRING.mb_chars.class
end
test_should_allow_method_calls_to_string()
# File activesupport/test/multibyte_chars_test.rb, line 24
def test_should_allow_method_calls_to_string
  assert_nothing_raised do
    @chars.__method_for_multibyte_testing
  end
  assert_raise NoMethodError do
    @chars.__unknown_method
  end
end
test_should_concatenate()
# File activesupport/test/multibyte_chars_test.rb, line 51
def test_should_concatenate
  mb_a = 'a'.mb_chars
  mb_b = 'b'.mb_chars
  assert_equal 'ab', mb_a + 'b'
  assert_equal 'ab', 'a' + mb_b
  assert_equal 'ab', mb_a + mb_b

  assert_equal 'ab', mb_a << 'b'
  assert_equal 'ab', 'a' << mb_b
  assert_equal 'abb', mb_a << mb_b
end
test_unpack_raises_encoding_error_on_broken_strings()
# File activesupport/test/multibyte_chars_test.rb, line 74
def test_unpack_raises_encoding_error_on_broken_strings
  assert_raise(ActiveSupport::Multibyte::EncodingError) do
    ActiveSupport::Multibyte::Unicode.u_unpack(BYTE_STRING)
  end
end
test_unpack_utf8_strings()
# File activesupport/test/multibyte_chars_test.rb, line 69
def test_unpack_utf8_strings
  assert_equal 4, ActiveSupport::Multibyte::Unicode.u_unpack(UNICODE_STRING).length
  assert_equal 5, ActiveSupport::Multibyte::Unicode.u_unpack(ASCII_STRING).length
end
test_wraps_the_original_string()
# File activesupport/test/multibyte_chars_test.rb, line 19
def test_wraps_the_original_string
  assert_equal UNICODE_STRING, @chars.to_s
  assert_equal UNICODE_STRING, @chars.wrapped_string
end