]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/diary_entry_controller_test.rb
Stub nominatim for reverse lookups in diary tests
[rails.git] / test / controllers / diary_entry_controller_test.rb
index 6e766460ee97770d1e261b0027c57d88f135036b..5e53cb6b0cb137c92b4812e8eaf7d54fe0d66a1e 100644 (file)
@@ -8,6 +8,9 @@ class DiaryEntryControllerTest < ActionController::TestCase
   def setup
     # Create the default language for diary entries
     create(:language, :code => "en")
+    # Stub nominatim response for diary entry locations
+    stub_request(:get, %r{^http://nominatim\.openstreetmap\.org/reverse\?})
+      .to_return(:status => 404)
   end
 
   ##
@@ -563,6 +566,13 @@ class DiaryEntryControllerTest < ActionController::TestCase
     assert_response :not_found, "Should not be able to get a deleted users diary RSS"
   end
 
+  def test_rss_character_escaping
+    create(:diary_entry, :title => "<script>")
+    get :rss, :format => :rss
+
+    assert_match "<title>&lt;script&gt;</title>", response.body
+  end
+
   def test_view
     # Try a normal entry that should work
     diary_entry = create(:diary_entry, :user => users(:normal_user))