X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/99ccffe4a9c0521d1202c4f0f1a37f8ef2dc0634..a32333ba12bb1fed2ca217e7994cbad0a3127dd2:/test/controllers/diary_entry_controller_test.rb diff --git a/test/controllers/diary_entry_controller_test.rb b/test/controllers/diary_entry_controller_test.rb index 6ab40e189..6e766460e 100644 --- a/test/controllers/diary_entry_controller_test.rb +++ b/test/controllers/diary_entry_controller_test.rb @@ -1,10 +1,15 @@ require "test_helper" class DiaryEntryControllerTest < ActionController::TestCase - fixtures :users, :user_roles, :languages + fixtures :users, :user_roles include ActionView::Helpers::NumberHelper + def setup + # Create the default language for diary entries + create(:language, :code => "en") + end + ## # test all routes which lead to this controller def test_routes @@ -162,6 +167,7 @@ class DiaryEntryControllerTest < ActionController::TestCase assert_equal new_language_code, UserPreference.where(:user_id => users(:normal_user).id, :k => "diary.default_language").first.v new_language_code = "de" + create(:language, :code => new_language_code) # Now try creating a diary entry in a different language assert_difference "DiaryEntry.count", 1 do @@ -472,6 +478,8 @@ class DiaryEntryControllerTest < ActionController::TestCase end def test_list_language + create(:language, :code => "de") + create(:language, :code => "sl") diary_entry_en = create(:diary_entry, :language_code => "en") diary_entry_en2 = create(:diary_entry, :language_code => "en") diary_entry_de = create(:diary_entry, :language_code => "de") @@ -490,6 +498,7 @@ class DiaryEntryControllerTest < ActionController::TestCase end def test_rss + create(:language, :code => "de") create(:diary_entry, :language_code => "en") create(:diary_entry, :language_code => "en") create(:diary_entry, :language_code => "de") @@ -506,6 +515,7 @@ class DiaryEntryControllerTest < ActionController::TestCase end def test_rss_language + create(:language, :code => "de") create(:diary_entry, :language_code => "en") create(:diary_entry, :language_code => "en") create(:diary_entry, :language_code => "de") @@ -521,6 +531,7 @@ class DiaryEntryControllerTest < ActionController::TestCase # end def test_rss_language_with_no_entries + create(:language, :code => "sl") create(:diary_entry, :language_code => "en") get :rss, :language => "sl", :format => :rss