diff options
author | elijah <elijah@riseup.net> | 2015-06-15 17:14:26 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2015-06-15 17:14:26 -0700 |
commit | 83a9cadbb13bd2292c7d064d40721fa5f64119fb (patch) | |
tree | 294c13678a0514634a6817428d2c656738c14e52 /vendor/gems/common_languages/test | |
parent | 12ab515ecd448f98ff006e30a93e43626183b6d0 (diff) |
added CommonLanguages gem
Diffstat (limited to 'vendor/gems/common_languages/test')
-rw-r--r-- | vendor/gems/common_languages/test/test_helper.rb | 3 | ||||
-rw-r--r-- | vendor/gems/common_languages/test/usage_test.rb | 33 |
2 files changed, 36 insertions, 0 deletions
diff --git a/vendor/gems/common_languages/test/test_helper.rb b/vendor/gems/common_languages/test/test_helper.rb new file mode 100644 index 0000000..339e22d --- /dev/null +++ b/vendor/gems/common_languages/test/test_helper.rb @@ -0,0 +1,3 @@ +gem 'minitest' +require 'minitest/autorun' +require_relative '../lib/common_languages' diff --git a/vendor/gems/common_languages/test/usage_test.rb b/vendor/gems/common_languages/test/usage_test.rb new file mode 100644 index 0000000..dc545f4 --- /dev/null +++ b/vendor/gems/common_languages/test/usage_test.rb @@ -0,0 +1,33 @@ +require_relative 'test_helper' +require 'i18n' + +class UsageTest < MiniTest::Test + + def setup + CommonLanguages.reset + end + + def test_available_codes_are_sorted + I18n.available_locales = ['pt', 'en', :de, :es] + assert_equal ['es', 'en', 'pt', 'de'], CommonLanguages.available_codes + end + + def test_available + I18n.available_locales = [:en] + english = CommonLanguages::Language.new(CommonLanguages::DATA[2]) + assert_equal english, CommonLanguages.get(:en) + assert_equal [english], CommonLanguages.available + end + + def test_unique_codes + assert_equal CommonLanguages::DATA.size, CommonLanguages::languages.size + end + + #def test_data + # I18n.available_locales = [:en, :de, :pt] + # CommonLanguages.available.each do |language| + # p [language.code, language.name, language.english_name, language.rtl?] + # end + #end + +end |