Avoid mutating the constants in a test case
This commit is contained in:
parent
5643cace2d
commit
cc9d1c5201
|
@ -8,7 +8,7 @@ class MultibyteCharsTest < ActiveSupport::TestCase
|
|||
|
||||
def setup
|
||||
@proxy_class = ActiveSupport::Multibyte::Chars
|
||||
@chars = @proxy_class.new UNICODE_STRING
|
||||
@chars = @proxy_class.new UNICODE_STRING.dup
|
||||
end
|
||||
|
||||
def test_wraps_the_original_string
|
||||
|
@ -50,8 +50,6 @@ class MultibyteCharsTest < ActiveSupport::TestCase
|
|||
def test_methods_are_forwarded_to_wrapped_string_for_byte_strings
|
||||
original_encoding = BYTE_STRING.encoding
|
||||
assert_equal BYTE_STRING.length, BYTE_STRING.mb_chars.length
|
||||
ensure
|
||||
BYTE_STRING.force_encoding(original_encoding)
|
||||
end
|
||||
|
||||
def test_forwarded_method_with_non_string_result_should_be_returned_vertabim
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# encoding: utf-8
|
||||
|
||||
module MultibyteTestHelpers
|
||||
UNICODE_STRING = 'こにちわ'
|
||||
ASCII_STRING = 'ohayo'
|
||||
BYTE_STRING = "\270\236\010\210\245".force_encoding("ASCII-8BIT")
|
||||
UNICODE_STRING = 'こにちわ'.freeze
|
||||
ASCII_STRING = 'ohayo'.freeze
|
||||
BYTE_STRING = "\270\236\010\210\245".force_encoding("ASCII-8BIT").freeze
|
||||
|
||||
def chars(str)
|
||||
ActiveSupport::Multibyte::Chars.new(str)
|
||||
|
|
Loading…
Reference in New Issue