]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/site_controller_test.rb
Use .with_locale for about page
[rails.git] / test / controllers / site_controller_test.rb
index 6f6e7dcfa886c9af85a713029d104a51437c6f60..75a042bfeb95ca1ca14db8638b7040606010b3a1 100644 (file)
@@ -1,20 +1,6 @@
 require "test_helper"
 
 class SiteControllerTest < ActionDispatch::IntegrationTest
-  ##
-  # setup oauth keys
-  def setup
-    super
-
-    Settings.id_key = create(:client_application).key
-  end
-
-  ##
-  # clear oauth keys
-  def teardown
-    Settings.id_key = nil
-  end
-
   ##
   # test all routes which lead to this controller
   def test_routes
@@ -112,7 +98,7 @@ class SiteControllerTest < ActionDispatch::IntegrationTest
     assert_redirected_to :controller => :browse, :action => :relation, :id => 123
 
     get root_path(:note => 123)
-    assert_redirected_to :controller => :browse, :action => :note, :id => 123
+    assert_redirected_to :controller => :notes, :action => :show, :id => 123
 
     get root_path(:query => "test")
     assert_redirected_to :controller => :geocoder, :action => :search, :query => "test"
@@ -490,6 +476,11 @@ class SiteControllerTest < ActionDispatch::IntegrationTest
     assert_response :success
     assert_template "about"
     assert_select "div[lang='ar'][dir='rtl']"
+
+    # Page should still render even with incorrect locale
+    get about_path(:about_locale => "zzz")
+    assert_response :success
+    assert_template "about"
   end
 
   # Test the export page
@@ -534,4 +525,12 @@ class SiteControllerTest < ActionDispatch::IntegrationTest
     assert_template "id"
     assert_template :layout => false
   end
+
+  # Test the id frame when not logged in
+  def test_id_without_login
+    get id_path
+
+    assert_response :redirect
+    assert_redirected_to login_path(:referer => "/id")
+  end
 end