Class: I18nSimpleBackendInterpolateTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- I18nSimpleBackendInterpolateTest
show all
- Includes:
- I18nSimpleBackendTestSetup
- Defined in:
- lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb
Instance Method Summary
collapse
#add_datetime_translations, #backend_get_translations, #setup_backend
Instance Method Details
#test_interpolate_given_a_non_unicode_multibyte_value_hash_interpolates_into_a_string_with_the_same_encoding ⇒ Object
264
265
266
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 264
def test_interpolate_given_a_non_unicode_multibyte_value_hash_interpolates_into_a_string_with_the_same_encoding
assert_equal euc_jp('Hi ゆきひろ!'), @backend.send(:interpolate, nil, 'Hi {{name}}!', :name => euc_jp('ゆきひろ'))
end
|
#test_interpolate_given_a_non_unicode_multibyte_value_hash_into_an_unicode_string_raises_encoding_compatibility_error ⇒ Object
274
275
276
277
278
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 274
def test_interpolate_given_a_non_unicode_multibyte_value_hash_into_an_unicode_string_raises_encoding_compatibility_error
assert_raise(Encoding::CompatibilityError) do
@backend.send(:interpolate, nil, 'こんにちは、{{name}}さん!', :name => euc_jp('ゆきひろ'))
end
end
|
#test_interpolate_given_a_string_containing_a_reserved_key_raises_reserved_interpolation_key ⇒ Object
297
298
299
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 297
def test_interpolate_given_a_string_containing_a_reserved_key_raises_reserved_interpolation_key
assert_raise(I18n::ReservedInterpolationKey) { @backend.send(:interpolate, nil, '{{default}}', {:default => nil}) }
end
|
#test_interpolate_given_a_value_hash_interpolates_into_unicode_string ⇒ Object
251
252
253
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 251
def test_interpolate_given_a_value_hash_interpolates_into_unicode_string
assert_equal 'Häi David!', @backend.send(:interpolate, nil, 'Häi {{name}}!', :name => 'David')
end
|
#test_interpolate_given_a_value_hash_interpolates_the_values_to_the_string ⇒ Object
247
248
249
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 247
def test_interpolate_given_a_value_hash_interpolates_the_values_to_the_string
assert_equal 'Hi David!', @backend.send(:interpolate, nil, 'Hi {{name}}!', :name => 'David')
end
|
#test_interpolate_given_a_values_hash_with_nil_values_interpolates_the_string ⇒ Object
289
290
291
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 289
def test_interpolate_given_a_values_hash_with_nil_values_interpolates_the_string
assert_equal 'Hi !', @backend.send(:interpolate, nil, 'Hi {{name}}!', {:name => nil})
end
|
#test_interpolate_given_an_empty_values_hash_raises_missing_interpolation_argument ⇒ Object
293
294
295
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 293
def test_interpolate_given_an_empty_values_hash_raises_missing_interpolation_argument
assert_raise(I18n::MissingInterpolationArgument) { @backend.send(:interpolate, nil, 'Hi {{name}}!', {}) }
end
|
#test_interpolate_given_an_non_string_as_a_string_returns_nil ⇒ Object
285
286
287
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 285
def test_interpolate_given_an_non_string_as_a_string_returns_nil
assert_equal [], @backend.send(:interpolate, nil, [], :name => 'David')
end
|
#test_interpolate_given_an_unicode_value_hash_interpolates_into_unicode_string ⇒ Object
259
260
261
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 259
def test_interpolate_given_an_unicode_value_hash_interpolates_into_unicode_string
assert_equal 'こんにちは、ゆきひろさん!', @backend.send(:interpolate, nil, 'こんにちは、{{name}}さん!', :name => 'ゆきひろ')
end
|
#test_interpolate_given_an_unicode_value_hash_interpolates_to_the_string ⇒ Object
255
256
257
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 255
def test_interpolate_given_an_unicode_value_hash_interpolates_to_the_string
assert_equal 'Hi ゆきひろ!', @backend.send(:interpolate, nil, 'Hi {{name}}!', :name => 'ゆきひろ')
end
|
#test_interpolate_given_an_unicode_value_hash_into_a_non_unicode_multibyte_string_raises_encoding_compatibility_error ⇒ Object
268
269
270
271
272
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 268
def test_interpolate_given_an_unicode_value_hash_into_a_non_unicode_multibyte_string_raises_encoding_compatibility_error
assert_raise(Encoding::CompatibilityError) do
@backend.send(:interpolate, nil, euc_jp('こんにちは、{{name}}さん!'), :name => 'ゆきひろ')
end
end
|
#test_interpolate_given_nil_as_a_string_returns_nil ⇒ Object
281
282
283
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 281
def test_interpolate_given_nil_as_a_string_returns_nil
assert_nil @backend.send(:interpolate, nil, nil, :name => 'David')
end
|