additionals/test/unit/i18n_test.rb

41 lines
958 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require File.expand_path '../../test_helper', __FILE__
2016-12-02 14:45:12 +03:00
2018-07-23 19:17:04 +03:00
class I18nTest < Additionals::TestCase
2018-07-15 13:07:09 +03:00
include Redmine::I18n
2016-12-02 14:45:12 +03:00
2018-07-15 13:07:09 +03:00
def setup
2018-07-23 19:17:04 +03:00
prepare_tests
2018-07-15 13:07:09 +03:00
User.current = nil
end
2016-12-02 14:45:12 +03:00
2018-07-15 13:07:09 +03:00
def teardown
set_language_if_valid 'en'
end
2016-12-02 14:45:12 +03:00
2018-07-15 13:07:09 +03:00
def test_valid_languages
2024-01-21 08:54:44 +03:00
assert_kind_of Array, valid_languages
assert_kind_of Symbol, valid_languages.first
2018-07-15 13:07:09 +03:00
end
2016-12-02 14:45:12 +03:00
2018-07-15 13:07:09 +03:00
def test_locales_validness
lang_files_count = Rails.root.glob('plugins/additionals/config/locales/*.yml').size
2022-10-30 19:08:52 +03:00
2020-08-23 20:16:01 +03:00
assert_equal 13, lang_files_count
2018-07-15 13:07:09 +03:00
valid_languages.each do |lang|
assert set_language_if_valid(lang)
2019-05-04 13:15:36 +03:00
case lang.to_s
when 'en'
2022-10-30 19:08:52 +03:00
assert_equal 'Open external URLs', l(:label_open_external_urls)
2020-08-28 08:19:23 +03:00
when 'pt-BR', 'cs', 'de', 'es', 'fr', 'it', 'ja', 'ko', 'po', 'ru', 'zh-TW', 'zh'
2022-10-30 19:08:52 +03:00
assert_not l(:label_open_external_urls) == 'Open external URLs', lang
2019-05-04 13:15:36 +03:00
end
2016-12-02 14:45:12 +03:00
end
2018-07-15 13:07:09 +03:00
set_language_if_valid 'en'
2016-12-02 14:45:12 +03:00
end
end