]> git.openstreetmap.org Git - rails.git/blob - test/models/language_test.rb
Convert the languages fixtures to a factory
[rails.git] / test / models / language_test.rb
1 # coding: utf-8
2 require "test_helper"
3
4 class LanguageTest < ActiveSupport::TestCase
5   def test_name
6     create(:language, :code => "sl", :english_name => "Slovenian", :native_name => "slovenščina")
7     assert_equal "Slovenian (slovenščina)", Language.find("sl").name
8   end
9
10   def test_load
11     assert_equal 0, Language.count
12     assert_raise ActiveRecord::RecordNotFound do
13       Language.find("zh")
14     end
15
16     Language.load("config/languages.yml")
17
18     assert_equal 197, Language.count
19     assert_not_nil Language.find("zh")
20   end
21 end