X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/113506bf5159bd06c218653a7d30d5a3c8d5c4e1..cc8bb7c6a5730e9d7d0389e4efd4c896702f575f:/test/integration/user_login_test.rb diff --git a/test/integration/user_login_test.rb b/test/integration/user_login_test.rb index 0470ad842..b83b90acf 100644 --- a/test/integration/user_login_test.rb +++ b/test/integration/user_login_test.rb @@ -25,7 +25,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest try_password_login user.email, "test" - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name end @@ -36,7 +36,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest try_password_login uppercase_user.email, "test" - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", uppercase_user.display_name end @@ -57,7 +57,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest try_password_login user.email, "test" - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name end @@ -66,7 +66,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest try_password_login user.email.upcase, "test" - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name end @@ -75,7 +75,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest try_password_login user.email.titlecase, "test" - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name end @@ -113,7 +113,9 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "login" assert_select "span.username", false - assert_select "div.flash.error", /your account has been suspended/ + assert_select "div.flash.error", /your account has been suspended/ do + assert_select "a[href='mailto:openstreetmap@example.com']", "webmaster" + end end def test_login_email_password_suspended_upcase @@ -123,7 +125,9 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "login" assert_select "span.username", false - assert_select "div.flash.error", /your account has been suspended/ + assert_select "div.flash.error", /your account has been suspended/ do + assert_select "a[href='mailto:openstreetmap@example.com']", "webmaster" + end end def test_login_email_password_suspended_titlecase @@ -133,7 +137,9 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "login" assert_select "span.username", false - assert_select "div.flash.error", /your account has been suspended/ + assert_select "div.flash.error", /your account has been suspended/ do + assert_select "a[href='mailto:openstreetmap@example.com']", "webmaster" + end end def test_login_email_password_blocked @@ -176,7 +182,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest try_password_login user.display_name, "test" - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name end @@ -187,7 +193,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest try_password_login uppercase_user.display_name, "test" - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", uppercase_user.display_name end @@ -208,7 +214,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest try_password_login user.display_name, "test" - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name end @@ -217,7 +223,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest try_password_login user.display_name.upcase, "test" - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name end @@ -226,7 +232,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest try_password_login user.display_name.downcase, "test" - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name end @@ -264,7 +270,9 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "login" assert_select "span.username", false - assert_select "div.flash.error", /your account has been suspended/ + assert_select "div.flash.error", /your account has been suspended/ do + assert_select "a[href='mailto:openstreetmap@example.com']", "webmaster" + end end def test_login_username_password_suspended_upcase @@ -274,7 +282,9 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "login" assert_select "span.username", false - assert_select "div.flash.error", /your account has been suspended/ + assert_select "div.flash.error", /your account has been suspended/ do + assert_select "a[href='mailto:openstreetmap@example.com']", "webmaster" + end end def test_login_username_password_suspended_downcase @@ -284,7 +294,9 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "login" assert_select "span.username", false - assert_select "div.flash.error", /your account has been suspended/ + assert_select "div.flash.error", /your account has been suspended/ do + assert_select "a[href='mailto:openstreetmap@example.com']", "webmaster" + end end def test_login_username_password_blocked @@ -322,7 +334,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest try_password_login user.email, "test", "yes" - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name assert session.key?(:_remember_for) end @@ -332,7 +344,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest try_password_login user.display_name, "test", "yes" - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name assert session.key?(:_remember_for) end @@ -341,65 +353,34 @@ class UserLoginTest < ActionDispatch::IntegrationTest user = create(:user, :auth_provider => "openid", :auth_uid => "http://example.com/john.doe") OmniAuth.config.add_mock(:openid, :uid => user.auth_uid) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history" + assert_redirected_to :controller => :users, :action => :login, :cookie_test => true, :referer => "/history" follow_redirect! assert_response :success - assert_template "user/login" - post "/login", :openid_url => "http://localhost:1123/john.doe", :referer => "/history" - assert_response :redirect - assert_redirected_to auth_path(:provider => "openid", :openid_url => "http://localhost:1123/john.doe", :origin => "/login?referer=%2Fhistory", :referer => "/history") - follow_redirect! + assert_template "users/login" + get auth_path(:provider => "openid", :openid_url => "http://localhost:1123/john.doe", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "openid", :openid_url => "http://localhost:1123/john.doe", :origin => "/login?referer=%2Fhistory", :referer => "/history") follow_redirect! assert_response :redirect follow_redirect! assert_response :success - assert_template "changeset/history" - assert_select "span.username", user.display_name - end - - def test_login_openid_remember_me - user = create(:user, :auth_provider => "openid", :auth_uid => "http://example.com/john.doe") - OmniAuth.config.add_mock(:openid, :uid => user.auth_uid) - - get "/login", :referer => "/history" - assert_response :redirect - assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history" - follow_redirect! - assert_response :success - assert_template "user/login" - post "/login", :openid_url => user.auth_uid, :remember_me_openid => true, :referer => "/history" - assert_response :redirect - assert_redirected_to auth_path(:provider => "openid", :openid_url => user.auth_uid, :origin => "/login?referer=%2Fhistory", :referer => "/history") - follow_redirect! - assert_response :redirect - assert_redirected_to auth_success_path(:provider => "openid", :openid_url => user.auth_uid, :origin => "/login?referer=%2Fhistory", :referer => "/history") - follow_redirect! - assert_response :redirect - follow_redirect! - assert_response :success - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name - assert session.key?(:_remember_for) end def test_login_openid_connection_failed user = create(:user, :auth_provider => "openid", :auth_uid => "http://example.com/john.doe") OmniAuth.config.mock_auth[:openid] = :connection_failed - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history" + assert_redirected_to :controller => :users, :action => :login, :cookie_test => true, :referer => "/history" follow_redirect! assert_response :success - assert_template "user/login" - post "/login", :openid_url => user.auth_uid, :referer => "/history" - assert_response :redirect - assert_redirected_to auth_path(:provider => "openid", :openid_url => user.auth_uid, :origin => "/login?referer=%2Fhistory", :referer => "/history") - follow_redirect! + assert_template "users/login" + get auth_path(:provider => "openid", :openid_url => user.auth_uid, :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "openid", :openid_url => user.auth_uid, :origin => "/login?referer=%2Fhistory", :referer => "/history") follow_redirect! @@ -418,16 +399,13 @@ class UserLoginTest < ActionDispatch::IntegrationTest user = create(:user, :auth_provider => "openid", :auth_uid => "http://example.com/john.doe") OmniAuth.config.mock_auth[:openid] = :invalid_credentials - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history" + assert_redirected_to :controller => :users, :action => :login, :cookie_test => true, :referer => "/history" follow_redirect! assert_response :success - assert_template "user/login" - post "/login", :openid_url => user.auth_uid, :referer => "/history" - assert_response :redirect - assert_redirected_to auth_path(:provider => "openid", :openid_url => user.auth_uid, :origin => "/login?referer=%2Fhistory", :referer => "/history") - follow_redirect! + assert_template "users/login" + get auth_path(:provider => "openid", :openid_url => user.auth_uid, :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "openid", :openid_url => user.auth_uid, :origin => "/login?referer=%2Fhistory", :referer => "/history") follow_redirect! @@ -445,23 +423,20 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_openid_unknown OmniAuth.config.add_mock(:openid, :uid => "http://localhost:1123/fred.bloggs") - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history" + assert_redirected_to :controller => :users, :action => :login, :cookie_test => true, :referer => "/history" follow_redirect! assert_response :success - assert_template "user/login" - post "/login", :openid_url => "http://localhost:1123/fred.bloggs", :referer => "/history" - assert_response :redirect - assert_redirected_to auth_path(:provider => "openid", :openid_url => "http://localhost:1123/fred.bloggs", :origin => "/login?referer=%2Fhistory", :referer => "/history") - follow_redirect! + assert_template "users/login" + get auth_path(:provider => "openid", :openid_url => "http://localhost:1123/fred.bloggs", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "openid", :openid_url => "http://localhost:1123/fred.bloggs", :origin => "/login?referer=%2Fhistory", :referer => "/history") follow_redirect! assert_response :redirect follow_redirect! assert_response :success - assert_template "user/new" + assert_template "users/new" assert_select "span.username", false end @@ -471,12 +446,12 @@ class UserLoginTest < ActionDispatch::IntegrationTest :id_info => { "openid_id" => "http://localhost:1123/fred.bloggs" } }) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "google", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "google") @@ -484,19 +459,19 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_response :redirect follow_redirect! assert_response :success - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name end def test_login_google_connection_failed OmniAuth.config.mock_auth[:google] = :connection_failed - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "google", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "google") @@ -515,12 +490,12 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_google_invalid_credentials OmniAuth.config.mock_auth[:google] = :invalid_credentials - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "google", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "google") @@ -541,12 +516,12 @@ class UserLoginTest < ActionDispatch::IntegrationTest :id_info => { "openid_id" => "http://localhost:1123/fred.bloggs" } }) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "google", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "google") @@ -554,7 +529,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_response :redirect follow_redirect! assert_response :success - assert_template "user/new" + assert_template "users/new" assert_select "span.username", false end @@ -564,12 +539,12 @@ class UserLoginTest < ActionDispatch::IntegrationTest :id_info => { "openid_id" => user.auth_uid } }) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "google", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "google") @@ -577,7 +552,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_response :redirect follow_redirect! assert_response :success - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name u = User.find_by(:display_name => user.display_name) @@ -589,12 +564,12 @@ class UserLoginTest < ActionDispatch::IntegrationTest user = create(:user, :auth_provider => "facebook", :auth_uid => "1234567890") OmniAuth.config.add_mock(:facebook, :uid => user.auth_uid) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "facebook", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "facebook") @@ -602,19 +577,19 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_response :redirect follow_redirect! assert_response :success - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name end def test_login_facebook_connection_failed OmniAuth.config.mock_auth[:facebook] = :connection_failed - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "facebook", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "facebook") @@ -633,12 +608,12 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_facebook_invalid_credentials OmniAuth.config.mock_auth[:facebook] = :invalid_credentials - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "facebook", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "facebook") @@ -657,12 +632,12 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_facebook_unknown OmniAuth.config.add_mock(:facebook, :uid => "987654321") - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "facebook", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "facebook") @@ -670,7 +645,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_response :redirect follow_redirect! assert_response :success - assert_template "user/new" + assert_template "users/new" assert_select "span.username", false end @@ -678,12 +653,12 @@ class UserLoginTest < ActionDispatch::IntegrationTest user = create(:user, :auth_provider => "windowslive", :auth_uid => "1234567890") OmniAuth.config.add_mock(:windowslive, :uid => user.auth_uid) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "windowslive", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "windowslive") @@ -691,19 +666,19 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_response :redirect follow_redirect! assert_response :success - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name end def test_login_windowslive_connection_failed OmniAuth.config.mock_auth[:windowslive] = :connection_failed - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "windowslive", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "windowslive") @@ -722,12 +697,12 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_windowslive_invalid_credentials OmniAuth.config.mock_auth[:windowslive] = :invalid_credentials - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "windowslive", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "windowslive") @@ -746,12 +721,12 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_windowslive_unknown OmniAuth.config.add_mock(:windowslive, :uid => "987654321") - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "windowslive", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "windowslive") @@ -759,7 +734,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_response :redirect follow_redirect! assert_response :success - assert_template "user/new" + assert_template "users/new" assert_select "span.username", false end @@ -767,35 +742,35 @@ class UserLoginTest < ActionDispatch::IntegrationTest user = create(:user, :auth_provider => "github", :auth_uid => "1234567890") OmniAuth.config.add_mock(:github, :uid => user.auth_uid) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect - assert_redirected_to auth_success_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") + assert_redirected_to auth_success_path(:provider => "github") follow_redirect! assert_response :redirect follow_redirect! assert_response :success - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name end def test_login_github_connection_failed OmniAuth.config.mock_auth[:github] = :connection_failed - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect - assert_redirected_to auth_success_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") + assert_redirected_to auth_success_path(:provider => "github") follow_redirect! assert_response :redirect assert_redirected_to auth_failure_path(:strategy => "github", :message => "connection_failed", :origin => "/login?referer=%2Fhistory") @@ -811,15 +786,15 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_github_invalid_credentials OmniAuth.config.mock_auth[:github] = :invalid_credentials - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect - assert_redirected_to auth_success_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") + assert_redirected_to auth_success_path(:provider => "github") follow_redirect! assert_response :redirect assert_redirected_to auth_failure_path(:strategy => "github", :message => "invalid_credentials", :origin => "/login?referer=%2Fhistory") @@ -835,20 +810,20 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_github_unknown OmniAuth.config.add_mock(:github, :uid => "987654321") - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect - assert_redirected_to auth_success_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") + assert_redirected_to auth_success_path(:provider => "github") follow_redirect! assert_response :redirect follow_redirect! assert_response :success - assert_template "user/new" + assert_template "users/new" assert_select "span.username", false end @@ -856,12 +831,12 @@ class UserLoginTest < ActionDispatch::IntegrationTest user = create(:user, :auth_provider => "wikipedia", :auth_uid => "1234567890") OmniAuth.config.add_mock(:wikipedia, :uid => user.auth_uid) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") @@ -869,19 +844,19 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_response :redirect follow_redirect! assert_response :success - assert_template "changeset/history" + assert_template "changesets/history" assert_select "span.username", user.display_name end def test_login_wikipedia_connection_failed OmniAuth.config.mock_auth[:wikipedia] = :connection_failed - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") @@ -900,12 +875,12 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_wikipedia_invalid_credentials OmniAuth.config.mock_auth[:wikipedia] = :invalid_credentials - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") @@ -924,12 +899,12 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_wikipedia_unknown OmniAuth.config.add_mock(:wikipedia, :uid => "987654321") - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! assert_response :success - assert_template "user/login" + assert_template "users/login" get auth_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") @@ -937,7 +912,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_response :redirect follow_redirect! assert_response :success - assert_template "user/new" + assert_template "users/new" assert_select "span.username", false end @@ -946,7 +921,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def try_password_login(username, password, remember_me = nil) get "/login" assert_response :redirect - assert_redirected_to :controller => :user, :action => :login, :cookie_test => true + assert_redirected_to :controller => :users, :action => :login, :cookie_test => true follow_redirect! assert_response :success assert_template "login" @@ -960,7 +935,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_select "[checked]", false end - post "/login", :username => username, :password => "wrong", :remember_me => remember_me, :referer => "/history" + post "/login", :params => { :username => username, :password => "wrong", :remember_me => remember_me, :referer => "/history" } assert_response :redirect follow_redirect! assert_response :success @@ -975,7 +950,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_select "[checked]", remember_me == "yes" end - post "/login", :username => username, :password => password, :remember_me => remember_me, :referer => "/history" + post "/login", :params => { :username => username, :password => password, :remember_me => remember_me, :referer => "/history" } assert_response :redirect follow_redirect! assert_response :success