]> git.openstreetmap.org Git - rails.git/blob - test/models/language_test.rb
Merge pull request #5247 from tomhughes/rails-72-defaults
[rails.git] / test / models / language_test.rb
1 require "test_helper"
2
3 class LanguageTest < ActiveSupport::TestCase
4   def test_name
5     create(:language, :code => "sl", :english_name => "Slovenian", :native_name => "slovenščina")
6     assert_equal "Slovenian (slovenščina)", Language.find("sl").name
7   end
8
9   def test_same_native_name
10     create(:language, :code => "af", :english_name => "Afrikaans", :native_name => "Afrikaans")
11     assert_equal "Afrikaans", Language.find("af").name
12   end
13
14   def test_load
15     assert_equal 0, Language.count
16     assert_raise ActiveRecord::RecordNotFound do
17       Language.find("zh")
18     end
19
20     Language.load("config/languages.yml")
21
22     assert_equal 197, Language.count
23     assert_not_nil Language.find("zh")
24   end
25 end