Sha256: ad3809b11ea48273533d1e7e69e717b26d233fe42120d3a41d661fff891a6f1b

Contents?: true

Size: 711 Bytes

Versions: 6

Compression:

Stored size: 711 Bytes

Contents

# coding: utf-8
$KCODE = 'U'

require 'test_helper'
require 'generators/i18n_translation/lib/translator'

class I27r::TranslatorTest < Test::Unit::TestCase
  setup do
    @translator = I27r::Translator.new 'ja'
  end

  test 'when successfully translated' do
    stub(@translator)._translate { 'こんにちは' }

    assert_equal 'こんにちは', @translator.translate('hello')
  end

  test 'when translation failed with error code' do
    stub(@translator)._translate { '' }

    assert_equal 'hello', @translator.translate('hello')
  end

  test 'when translation raised an error' do
    stub(@translator)._translate { raise 'ERROR!' }

    assert_equal 'hello', @translator.translate('hello')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
i18n_generators-2.2.2 test/translator_test.rb
i18n_generators-2.2.1 test/translator_test.rb
i18n_generators-2.2.0 test/translator_test.rb
i18n_generators-2.1.1 test/translator_test.rb
i18n_generators-2.1.0 test/translator_test.rb
i18n_generators-2.0.0 test/translator_test.rb