]> git.openstreetmap.org Git - rails.git/blobdiff - test/models/language_test.rb
Merge remote-tracking branch 'openstreetmap/pull/1483'
[rails.git] / test / models / language_test.rb
index 39e3f017b185a0e2447ce61389958482ea392927..9b2ef72c19125914afe87d0ea8f618df70a4ec5b 100644 (file)
@@ -1,9 +1,21 @@
+# coding: utf-8
 require "test_helper"
 
 class LanguageTest < ActiveSupport::TestCase
-  fixtures :languages
+  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_load
+    assert_equal 0, Language.count
+    assert_raise ActiveRecord::RecordNotFound do
+      Language.find("zh")
+    end
+
+    Language.load("config/languages.yml")
 
-  test "language count" do
-    assert_equal 3, Language.count
+    assert_equal 197, Language.count
+    assert_not_nil Language.find("zh")
   end
 end