X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b095b59d5e0ee805e49980af80b21bd1acff1345..3c2780f2c3463cbaa6953d7ee8edec93baa863dd:/test/models/language_test.rb?ds=sidebyside diff --git a/test/models/language_test.rb b/test/models/language_test.rb index a9d6f5d6a..f777d8e19 100644 --- a/test/models/language_test.rb +++ b/test/models/language_test.rb @@ -1,7 +1,25 @@ -require 'test_helper' +require "test_helper" class LanguageTest < ActiveSupport::TestCase - test "language count" do - assert_equal 3, Language.count + def test_name + create(:language, :code => "sl", :english_name => "Slovenian", :native_name => "slovenščina") + assert_equal "Slovenian (slovenščina)", Language.find("sl").name + end + + def test_same_native_name + create(:language, :code => "af", :english_name => "Afrikaans", :native_name => "Afrikaans") + assert_equal "Afrikaans", Language.find("af").name + end + + def test_load + assert_equal 0, Language.count + assert_raise ActiveRecord::RecordNotFound do + Language.find("zh") + end + + Language.load("config/languages.yml") + + assert_equal 197, Language.count + assert_not_nil Language.find("zh") end end