]> git.openstreetmap.org Git - rails.git/blobdiff - test/models/language_test.rb
Replace timecop with the rails builtin travel_to method
[rails.git] / test / models / language_test.rb
index ac79b3a9da7984087b0d5f155ebec5c55cbd9cff..f6a6e3234c58e904f21ea7b8d0defbd1a99d78e8 100644 (file)
@@ -1,7 +1,22 @@
+# coding: utf-8
+
 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_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