translation_test.rb 673 B

12345678910111213141516171819202122232425262728293031323334
  1. # encoding: utf-8
  2. require 'test_helper'
  3. class TranslationTest < ActiveSupport::TestCase
  4. test 'translation' do
  5. tests = [
  6. # test 1
  7. {
  8. :locale => 'en',
  9. :string => 'New',
  10. :result => 'New',
  11. },
  12. # test 2
  13. {
  14. :locale => 'de',
  15. :string => 'New',
  16. :result => 'Neu',
  17. },
  18. # test 3
  19. {
  20. :locale => 'de',
  21. :string => 'not translated - lalala',
  22. :result => 'not translated - lalala',
  23. },
  24. ]
  25. tests.each { |test|
  26. result = Translation.translate( test[:locale], test[:string] )
  27. assert_equal( result, test[:result], "verify result" )
  28. }
  29. end
  30. end