]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/users_controller_test.rb
Merge branch 'master' into feature/add-communities-page
[rails.git] / test / controllers / users_controller_test.rb
index 6e156375b289fea99221627758aaf72e028eb0c7..44b5471ac35ce7128c3dc5bb7e8056690a230c2e 100644 (file)
@@ -560,7 +560,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
 
     get user_path(user)
     assert_response :success
-    assert_select "div#userinformation" do
+    assert_select "div.content-heading" do
       assert_select "a[href^='/user/#{ERB::Util.u(user.display_name)}/history']", 1
       assert_select "a[href='/user/#{ERB::Util.u(user.display_name)}/traces']", 1
       assert_select "a[href='/user/#{ERB::Util.u(user.display_name)}/diary']", 1
@@ -579,7 +579,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
     create(:user_block, :user => blocked_user)
     get user_path(blocked_user)
     assert_response :success
-    assert_select "div#userinformation" do
+    assert_select "div.content-heading" do
       assert_select "a[href^='/user/#{ERB::Util.u(blocked_user.display_name)}/history']", 1
       assert_select "a[href='/user/#{ERB::Util.u(blocked_user.display_name)}/traces']", 1
       assert_select "a[href='/user/#{ERB::Util.u(blocked_user.display_name)}/diary']", 1
@@ -595,7 +595,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
     create(:user_block, :creator => moderator_user)
     get user_path(moderator_user)
     assert_response :success
-    assert_select "div#userinformation" do
+    assert_select "div.content-heading" do
       assert_select "a[href^='/user/#{ERB::Util.u(moderator_user.display_name)}/history']", 1
       assert_select "a[href='/user/#{ERB::Util.u(moderator_user.display_name)}/traces']", 1
       assert_select "a[href='/user/#{ERB::Util.u(moderator_user.display_name)}/diary']", 1
@@ -612,7 +612,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
     # Test the normal user
     get user_path(user)
     assert_response :success
-    assert_select "div#userinformation" do
+    assert_select "div.content-heading" do
       assert_select "a[href^='/user/#{ERB::Util.u(user.display_name)}/history']", 1
       assert_select "a[href='/traces/mine']", 1
       assert_select "a[href='/user/#{ERB::Util.u(user.display_name)}/diary']", 1
@@ -629,7 +629,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
     # Test the normal user
     get user_path(user)
     assert_response :success
-    assert_select "div#userinformation" do
+    assert_select "div.content-heading" do
       assert_select "a[href^='/user/#{ERB::Util.u(user.display_name)}/history']", 1
       assert_select "a[href='/user/#{ERB::Util.u(user.display_name)}/traces']", 1
       assert_select "a[href='/user/#{ERB::Util.u(user.display_name)}/diary']", 1
@@ -649,21 +649,21 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
 
     get user_path(agreed_user)
     assert_response :success
-    assert_select "div#userinformation" do
+    assert_select "div.content-heading" do
       assert_select "dt", :count => 0, :text => /Contributor terms/
     end
 
     get user_path(seen_user)
     assert_response :success
     # put @response.body
-    assert_select "div#userinformation" do
+    assert_select "div.content-heading" do
       assert_select "dt", :count => 1, :text => /Contributor terms/
       assert_select "dd", /Declined/
     end
 
     get user_path(not_seen_user)
     assert_response :success
-    assert_select "div#userinformation" do
+    assert_select "div.content-heading" do
       assert_select "dt", :count => 1, :text => /Contributor terms/
       assert_select "dd", /Undecided/
     end
@@ -896,4 +896,18 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
     assert_equal "deleted", normal_user.reload.status
     assert_equal "deleted", confirmed_user.reload.status
   end
+
+  def test_auth_failure_callback
+    get auth_failure_path
+    assert_response :redirect
+    assert_redirected_to login_path
+
+    get auth_failure_path, :params => { :origin => "/" }
+    assert_response :redirect
+    assert_redirected_to root_path
+
+    get auth_failure_path, :params => { :origin => "http://www.google.com" }
+    assert_response :redirect
+    assert_redirected_to login_path
+  end
 end