Methods
#
S
T
Included Modules
Instance Public methods
__method_for_multibyte_testing()
# File activesupport/test/multibyte_chars_test.rb, line 19
def __method_for_multibyte_testing; 'result'; end
__method_for_multibyte_testing!()
# File activesupport/test/multibyte_chars_test.rb, line 37
def __method_for_multibyte_testing!; 'result'; end
__method_for_multibyte_testing_that_returns_nil!()
# File activesupport/test/multibyte_chars_test.rb, line 44
def __method_for_multibyte_testing_that_returns_nil!; end
__method_for_multibyte_testing_with_integer_result()
# File activesupport/test/multibyte_chars_test.rb, line 55
def __method_for_multibyte_testing_with_integer_result; 1; end
setup()
# File activesupport/test/multibyte_chars_test.rb, line 8
def setup
  @proxy_class = ActiveSupport::Multibyte::Chars
  @chars = @proxy_class.new UNICODE_STRING.dup
end
test_ascii_strings_are_treated_at_utf8_strings()
# File activesupport/test/multibyte_chars_test.rb, line 84
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 88
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 79
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 73
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_nil_when_result_is_nil()
# File activesupport/test/multibyte_chars_test.rb, line 43
def test_forwarded_bang_method_calls_should_return_nil_when_result_is_nil
  @chars.wrapped_string.singleton_class.class_eval { def __method_for_multibyte_testing_that_returns_nil!; end }

  assert_nil @chars.__method_for_multibyte_testing_that_returns_nil!
end
test_forwarded_bang_method_calls_should_return_the_original_chars_instance_when_result_is_not_nil()
# File activesupport/test/multibyte_chars_test.rb, line 36
def test_forwarded_bang_method_calls_should_return_the_original_chars_instance_when_result_is_not_nil
  @chars.wrapped_string.singleton_class.class_eval { def __method_for_multibyte_testing!; 'result'; end }

  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 29
def test_forwarded_method_calls_should_return_new_chars_instance
  @chars.wrapped_string.singleton_class.class_eval { def __method_for_multibyte_testing; 'result'; end }

  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 53
def test_forwarded_method_with_non_string_result_should_be_returned_vertabim
  str = ''
  str.singleton_class.class_eval { def __method_for_multibyte_testing_with_integer_result; 1; end }
  @chars.wrapped_string.singleton_class.class_eval { def __method_for_multibyte_testing_with_integer_result; 1; end }

  assert_equal str.__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 49
def test_methods_are_forwarded_to_wrapped_string_for_byte_strings
  assert_equal BYTE_STRING.length, BYTE_STRING.mb_chars.length
end
test_should_allow_method_calls_to_string()
# File activesupport/test/multibyte_chars_test.rb, line 18
def test_should_allow_method_calls_to_string
  @chars.wrapped_string.singleton_class.class_eval { def __method_for_multibyte_testing; 'result'; end }

  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 61
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_should_return_string_as_json()
# File activesupport/test/multibyte_chars_test.rb, line 95
def test_should_return_string_as_json
  assert_equal UNICODE_STRING, @chars.as_json
end
test_wraps_the_original_string()
# File activesupport/test/multibyte_chars_test.rb, line 13
def test_wraps_the_original_string
  assert_equal UNICODE_STRING, @chars.to_s
  assert_equal UNICODE_STRING, @chars.wrapped_string
end