]> git.openstreetmap.org Git - rails.git/blobdiff - test/models/language_test.rb
Remove unused countries fixture.
[rails.git] / test / models / language_test.rb
index 39e3f017b185a0e2447ce61389958482ea392927..cb4c8c6318d195a0ee3a347128ab666a80a7ba2a 100644 (file)
@@ -1,9 +1,28 @@
+# coding: utf-8
 require "test_helper"
 
 class LanguageTest < ActiveSupport::TestCase
   fixtures :languages
 
 require "test_helper"
 
 class LanguageTest < ActiveSupport::TestCase
   fixtures :languages
 
-  test "language count" do
+  def test_language_count
     assert_equal 3, Language.count
   end
     assert_equal 3, Language.count
   end
+
+  def test_name
+    assert_equal "English (English)", languages(:en).name
+    assert_equal "German (Deutsch)", languages(:de).name
+    assert_equal "Slovenian (slovenščina)", languages(:sl).name
+  end
+
+  def test_load
+    assert_equal 3, 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
 end