mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-09 14:58:05 -05:00
Revert "Update routes to match 'sign up'/'log in', incorporate feedback from @carlosantoniodasilva"
This reverts commit de2a24b3d3.
This commit is contained in:
@@ -30,10 +30,6 @@ class Devise::RegistrationsController < DeviseController
|
||||
end
|
||||
else
|
||||
clean_up_passwords resource
|
||||
@validatable = devise_mapping.validatable?
|
||||
if @validatable
|
||||
@minimum_password_length = resource_class.password_length.min
|
||||
end
|
||||
respond_with resource
|
||||
end
|
||||
end
|
||||
|
||||
@@ -357,9 +357,9 @@ module ActionDispatch::Routing
|
||||
|
||||
def devise_session(mapping, controllers) #:nodoc:
|
||||
resource :session, only: [], controller: controllers[:sessions], path: "" do
|
||||
get :new, path: mapping.path_names[:log_in], as: "new"
|
||||
post :create, path: mapping.path_names[:log_in]
|
||||
match :destroy, path: mapping.path_names[:log_out], as: "destroy", via: mapping.sign_out_via
|
||||
get :new, path: mapping.path_names[:sign_in], as: "new"
|
||||
post :create, path: mapping.path_names[:sign_in]
|
||||
match :destroy, path: mapping.path_names[:sign_out], as: "destroy", via: mapping.sign_out_via
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -51,20 +51,20 @@ class FailureTest < ActiveSupport::TestCase
|
||||
call_failure
|
||||
assert_equal 302, @response.first
|
||||
assert_equal 'You need to sign in or sign up before continuing.', @request.flash[:alert]
|
||||
assert_equal 'http://test.host/users/log_in', @response.second['Location']
|
||||
assert_equal 'http://test.host/users/sign_in', @response.second['Location']
|
||||
end
|
||||
|
||||
test 'returns to the default redirect location considering subdomain' do
|
||||
call_failure('warden.options' => { scope: :subdomain_user })
|
||||
assert_equal 302, @response.first
|
||||
assert_equal 'You need to sign in or sign up before continuing.', @request.flash[:alert]
|
||||
assert_equal 'http://sub.test.host/subdomain_users/log_in', @response.second['Location']
|
||||
assert_equal 'http://sub.test.host/subdomain_users/sign_in', @response.second['Location']
|
||||
end
|
||||
|
||||
test 'returns to the default redirect location for wildcard requests' do
|
||||
call_failure 'action_dispatch.request.formats' => nil, 'HTTP_ACCEPT' => '*/*'
|
||||
assert_equal 302, @response.first
|
||||
assert_equal 'http://test.host/users/log_in', @response.second['Location']
|
||||
assert_equal 'http://test.host/users/sign_in', @response.second['Location']
|
||||
end
|
||||
|
||||
test 'returns to the root path if no session path is available' do
|
||||
@@ -90,7 +90,7 @@ class FailureTest < ActiveSupport::TestCase
|
||||
swap Rails.application.config, relative_url_root: "/sample" do
|
||||
call_failure
|
||||
assert_equal 302, @response.first
|
||||
assert_equal 'http://test.host/sample/users/log_in', @response.second['Location']
|
||||
assert_equal 'http://test.host/sample/users/sign_in', @response.second['Location']
|
||||
end
|
||||
end
|
||||
|
||||
@@ -98,7 +98,7 @@ class FailureTest < ActiveSupport::TestCase
|
||||
swap Rails.application.config, relative_url_root: "/sample" do
|
||||
call_failure('warden.options' => { scope: :subdomain_user })
|
||||
assert_equal 302, @response.first
|
||||
assert_equal 'http://sub.test.host/sample/subdomain_users/log_in', @response.second['Location']
|
||||
assert_equal 'http://sub.test.host/sample/subdomain_users/sign_in', @response.second['Location']
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -106,7 +106,7 @@ class FailureTest < ActiveSupport::TestCase
|
||||
test 'uses the proxy failure message as symbol' do
|
||||
call_failure('warden' => OpenStruct.new(message: :invalid))
|
||||
assert_equal 'Invalid email or password.', @request.flash[:alert]
|
||||
assert_equal 'http://test.host/users/log_in', @response.second["Location"]
|
||||
assert_equal 'http://test.host/users/sign_in', @response.second["Location"]
|
||||
end
|
||||
|
||||
test 'uses custom i18n options' do
|
||||
@@ -117,7 +117,7 @@ class FailureTest < ActiveSupport::TestCase
|
||||
test 'uses the proxy failure message as string' do
|
||||
call_failure('warden' => OpenStruct.new(message: 'Hello world'))
|
||||
assert_equal 'Hello world', @request.flash[:alert]
|
||||
assert_equal 'http://test.host/users/log_in', @response.second["Location"]
|
||||
assert_equal 'http://test.host/users/sign_in', @response.second["Location"]
|
||||
end
|
||||
|
||||
test 'set content type to default text/html' do
|
||||
@@ -129,7 +129,7 @@ class FailureTest < ActiveSupport::TestCase
|
||||
call_failure
|
||||
assert_match(/You are being/, @response.last.body)
|
||||
assert_match(/redirected/, @response.last.body)
|
||||
assert_match(/users\/log_in/, @response.last.body)
|
||||
assert_match(/users\/sign_in/, @response.last.body)
|
||||
end
|
||||
|
||||
test 'works for any navigational format' do
|
||||
@@ -142,7 +142,7 @@ class FailureTest < ActiveSupport::TestCase
|
||||
test 'redirects the correct format if it is a non-html format request' do
|
||||
swap Devise, navigational_formats: [:js] do
|
||||
call_failure('formats' => Mime::JS)
|
||||
assert_equal 'http://test.host/users/log_in.js', @response.second["Location"]
|
||||
assert_equal 'http://test.host/users/sign_in.js', @response.second["Location"]
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -200,7 +200,7 @@ class FailureTest < ActiveSupport::TestCase
|
||||
swap Devise, http_authenticatable_on_xhr: false do
|
||||
call_failure('formats' => Mime::HTML, 'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest')
|
||||
assert_equal 302, @response.first
|
||||
assert_equal 'http://test.host/users/log_in', @response.second["Location"]
|
||||
assert_equal 'http://test.host/users/sign_in', @response.second["Location"]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -208,7 +208,7 @@ class FailureTest < ActiveSupport::TestCase
|
||||
swap Devise, http_authenticatable_on_xhr: false do
|
||||
call_failure('formats' => Mime::JSON, 'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest')
|
||||
assert_equal 302, @response.first
|
||||
assert_equal 'http://test.host/users/log_in.json', @response.second["Location"]
|
||||
assert_equal 'http://test.host/users/sign_in.json', @response.second["Location"]
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -234,7 +234,7 @@ class FailureTest < ActiveSupport::TestCase
|
||||
context 'With recall' do
|
||||
test 'calls the original controller if invalid email or password' do
|
||||
env = {
|
||||
"warden.options" => { recall: "devise/sessions#new", attempted_path: "/users/log_in" },
|
||||
"warden.options" => { recall: "devise/sessions#new", attempted_path: "/users/sign_in" },
|
||||
"devise.mapping" => Devise.mappings[:user],
|
||||
"warden" => stub_everything
|
||||
}
|
||||
@@ -245,7 +245,7 @@ class FailureTest < ActiveSupport::TestCase
|
||||
|
||||
test 'calls the original controller if not confirmed email' do
|
||||
env = {
|
||||
"warden.options" => { recall: "devise/sessions#new", attempted_path: "/users/log_in", message: :unconfirmed },
|
||||
"warden.options" => { recall: "devise/sessions#new", attempted_path: "/users/sign_in", message: :unconfirmed },
|
||||
"devise.mapping" => Devise.mappings[:user],
|
||||
"warden" => stub_everything
|
||||
}
|
||||
@@ -256,7 +256,7 @@ class FailureTest < ActiveSupport::TestCase
|
||||
|
||||
test 'calls the original controller if inactive account' do
|
||||
env = {
|
||||
"warden.options" => { recall: "devise/sessions#new", attempted_path: "/users/log_in", message: :inactive },
|
||||
"warden.options" => { recall: "devise/sessions#new", attempted_path: "/users/sign_in", message: :inactive },
|
||||
"devise.mapping" => Devise.mappings[:user],
|
||||
"warden" => stub_everything
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ class AuthenticationOthersTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
|
||||
test 'uses the custom controller with the custom controller view' do
|
||||
get '/admin_area/log_in'
|
||||
get '/admin_area/sign_in'
|
||||
assert_contain 'Log in'
|
||||
assert_contain 'Welcome to "admins/sessions" controller!'
|
||||
assert_contain 'Welcome to "sessions/new" view!'
|
||||
|
||||
@@ -20,7 +20,7 @@ class ConfirmationTest < ActionDispatch::IntegrationTest
|
||||
test 'user should be able to request a new confirmation' do
|
||||
resend_confirmation
|
||||
|
||||
assert_current_url '/users/log_in'
|
||||
assert_current_url '/users/sign_in'
|
||||
assert_contain 'You will receive an email with instructions for how to confirm your email address in a few minutes'
|
||||
assert_equal 1, ActionMailer::Base.deliveries.size
|
||||
assert_equal ['please-change-me@config-initializers-devise.com'], ActionMailer::Base.deliveries.first.from
|
||||
@@ -88,7 +88,7 @@ class ConfirmationTest < ActionDispatch::IntegrationTest
|
||||
visit_user_confirmation_with_token(user.raw_confirmation_token)
|
||||
|
||||
assert_contain 'Your email address has been successfully confirmed.'
|
||||
assert_current_url '/users/log_in'
|
||||
assert_current_url '/users/sign_in'
|
||||
assert user.reload.confirmed?
|
||||
end
|
||||
end
|
||||
@@ -170,7 +170,7 @@ class ConfirmationTest < ActionDispatch::IntegrationTest
|
||||
user = create_user(confirm: false)
|
||||
visit_user_confirmation_with_token(user.raw_confirmation_token)
|
||||
|
||||
assert_current_url '/users/log_in'
|
||||
assert_current_url '/users/sign_in'
|
||||
end
|
||||
|
||||
test 'error message is configurable by resource name' do
|
||||
@@ -228,7 +228,7 @@ class ConfirmationTest < ActionDispatch::IntegrationTest
|
||||
click_button 'Resend confirmation instructions'
|
||||
|
||||
assert_contain "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
|
||||
assert_current_url "/users/log_in"
|
||||
assert_current_url "/users/sign_in"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -244,7 +244,7 @@ class ConfirmationTest < ActionDispatch::IntegrationTest
|
||||
assert_not_contain "Email not found"
|
||||
|
||||
assert_contain "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
|
||||
assert_current_url "/users/log_in"
|
||||
assert_current_url "/users/sign_in"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -271,7 +271,7 @@ class ConfirmationOnChangeTest < ActionDispatch::IntegrationTest
|
||||
click_button 'Resend confirmation instructions'
|
||||
end
|
||||
|
||||
assert_current_url '/admin_area/log_in'
|
||||
assert_current_url '/admin_area/sign_in'
|
||||
assert_contain 'You will receive an email with instructions for how to confirm your email address in a few minutes'
|
||||
end
|
||||
|
||||
@@ -282,7 +282,7 @@ class ConfirmationOnChangeTest < ActionDispatch::IntegrationTest
|
||||
visit_admin_confirmation_with_token(admin.raw_confirmation_token)
|
||||
|
||||
assert_contain 'Your email address has been successfully confirmed.'
|
||||
assert_current_url '/admin_area/log_in'
|
||||
assert_current_url '/admin_area/sign_in'
|
||||
assert admin.reload.confirmed?
|
||||
assert_not admin.reload.pending_reconfirmation?
|
||||
end
|
||||
@@ -304,7 +304,7 @@ class ConfirmationOnChangeTest < ActionDispatch::IntegrationTest
|
||||
|
||||
visit_admin_confirmation_with_token(admin.raw_confirmation_token)
|
||||
assert_contain 'Your email address has been successfully confirmed.'
|
||||
assert_current_url '/admin_area/log_in'
|
||||
assert_current_url '/admin_area/sign_in'
|
||||
assert admin.reload.confirmed?
|
||||
assert_not admin.reload.pending_reconfirmation?
|
||||
end
|
||||
|
||||
@@ -54,7 +54,7 @@ class LockTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
|
||||
test 'unlocked pages should not be available if email strategy is disabled' do
|
||||
visit "/admin_area/log_in"
|
||||
visit "/admin_area/sign_in"
|
||||
|
||||
assert_raise Webrat::NotFoundError do
|
||||
click_link "Didn't receive unlock instructions?"
|
||||
@@ -83,7 +83,7 @@ class LockTest < ActionDispatch::IntegrationTest
|
||||
raw = user.lock_access!
|
||||
visit_user_unlock_with_token(raw)
|
||||
|
||||
assert_current_url "/users/log_in"
|
||||
assert_current_url "/users/sign_in"
|
||||
assert_contain 'Your account has been unlocked successfully. Please sign in to continue.'
|
||||
assert_not user.reload.access_locked?
|
||||
end
|
||||
@@ -181,7 +181,7 @@ class LockTest < ActionDispatch::IntegrationTest
|
||||
fill_in 'email', with: user.email
|
||||
click_button 'Resend unlock instructions'
|
||||
|
||||
assert_current_url "/users/log_in"
|
||||
assert_current_url "/users/sign_in"
|
||||
assert_contain "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
|
||||
end
|
||||
end
|
||||
@@ -196,7 +196,7 @@ class LockTest < ActionDispatch::IntegrationTest
|
||||
fill_in 'email', with: user.email
|
||||
click_button 'Resend unlock instructions'
|
||||
|
||||
assert_current_url "/users/log_in"
|
||||
assert_current_url "/users/sign_in"
|
||||
assert_contain "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
|
||||
end
|
||||
end
|
||||
@@ -211,7 +211,7 @@ class LockTest < ActionDispatch::IntegrationTest
|
||||
|
||||
assert_not_contain "1 error prohibited this user from being saved:"
|
||||
assert_not_contain "Email not found"
|
||||
assert_current_url "/users/log_in"
|
||||
assert_current_url "/users/sign_in"
|
||||
|
||||
assert_contain "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
|
||||
|
||||
@@ -231,7 +231,7 @@ class LockTest < ActionDispatch::IntegrationTest
|
||||
fill_in 'password', with: "abadpassword"
|
||||
click_button 'Log in'
|
||||
|
||||
assert_current_url "/users/log_in"
|
||||
assert_current_url "/users/sign_in"
|
||||
assert_not_contain "locked"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,7 +39,7 @@ class OmniauthableIntegrationTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
|
||||
test "can access omniauth.auth in the env hash" do
|
||||
visit "/users/log_in"
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with Facebook"
|
||||
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
@@ -53,7 +53,7 @@ class OmniauthableIntegrationTest < ActionDispatch::IntegrationTest
|
||||
|
||||
test "cleans up session on sign up" do
|
||||
assert_no_difference "User.count" do
|
||||
visit "/users/log_in"
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with Facebook"
|
||||
end
|
||||
|
||||
@@ -74,7 +74,7 @@ class OmniauthableIntegrationTest < ActionDispatch::IntegrationTest
|
||||
|
||||
test "cleans up session on cancel" do
|
||||
assert_no_difference "User.count" do
|
||||
visit "/users/log_in"
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with Facebook"
|
||||
end
|
||||
|
||||
@@ -85,7 +85,7 @@ class OmniauthableIntegrationTest < ActionDispatch::IntegrationTest
|
||||
|
||||
test "cleans up session on sign in" do
|
||||
assert_no_difference "User.count" do
|
||||
visit "/users/log_in"
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with Facebook"
|
||||
end
|
||||
|
||||
@@ -95,13 +95,13 @@ class OmniauthableIntegrationTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
|
||||
test "sign in and send remember token if configured" do
|
||||
visit "/users/log_in"
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with Facebook"
|
||||
assert_nil warden.cookies["remember_user_token"]
|
||||
|
||||
stub_action!(:sign_in_facebook) do
|
||||
create_user
|
||||
visit "/users/log_in"
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with Facebook"
|
||||
assert warden.authenticated?(:user)
|
||||
assert warden.cookies["remember_user_token"]
|
||||
@@ -110,24 +110,24 @@ class OmniauthableIntegrationTest < ActionDispatch::IntegrationTest
|
||||
|
||||
test "generates a proper link when SCRIPT_NAME is set" do
|
||||
header 'SCRIPT_NAME', '/q'
|
||||
visit "/users/log_in"
|
||||
visit "/users/sign_in"
|
||||
assert_select "a", href: "/q/users/auth/facebook"
|
||||
end
|
||||
|
||||
test "handles callback error parameter according to the specification" do
|
||||
OmniAuth.config.mock_auth[:facebook] = :access_denied
|
||||
visit "/users/auth/facebook/callback?error=access_denied"
|
||||
assert_current_url "/users/log_in"
|
||||
assert_current_url "/users/sign_in"
|
||||
assert_contain 'Could not authenticate you from Facebook because "Access denied".'
|
||||
end
|
||||
|
||||
test "handles other exceptions from omniauth" do
|
||||
OmniAuth.config.mock_auth[:facebook] = :invalid_credentials
|
||||
|
||||
visit "/users/log_in"
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with Facebook"
|
||||
|
||||
assert_current_url "/users/log_in"
|
||||
assert_current_url "/users/sign_in"
|
||||
assert_contain 'Could not authenticate you from Facebook because "Invalid credentials".'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,7 +38,7 @@ class PasswordTest < ActionDispatch::IntegrationTest
|
||||
fill_in 'email', with: 'foo@bar.com'
|
||||
end
|
||||
|
||||
assert_current_url '/users/log_in'
|
||||
assert_current_url '/users/sign_in'
|
||||
assert_contain 'You will receive an email with instructions on how to reset your password in a few minutes.'
|
||||
end
|
||||
|
||||
@@ -77,7 +77,7 @@ class PasswordTest < ActionDispatch::IntegrationTest
|
||||
fill_in 'email', with: ' foo@bar.com '
|
||||
end
|
||||
|
||||
assert_current_url '/users/log_in'
|
||||
assert_current_url '/users/sign_in'
|
||||
assert_contain 'You will receive an email with instructions on how to reset your password in a few minutes.'
|
||||
end
|
||||
|
||||
@@ -110,7 +110,7 @@ class PasswordTest < ActionDispatch::IntegrationTest
|
||||
create_user
|
||||
request_forgot_password
|
||||
|
||||
assert_current_url '/users/log_in'
|
||||
assert_current_url '/users/sign_in'
|
||||
assert_contain 'You will receive an email with instructions on how to reset your password in a few minutes.'
|
||||
end
|
||||
|
||||
@@ -136,7 +136,7 @@ class PasswordTest < ActionDispatch::IntegrationTest
|
||||
test 'not authenticated user without a reset password token should not be able to visit the page' do
|
||||
get edit_user_password_path
|
||||
assert_response :redirect
|
||||
assert_redirected_to "/users/log_in"
|
||||
assert_redirected_to "/users/sign_in"
|
||||
end
|
||||
|
||||
test 'not authenticated user with invalid reset password token should not be able to change their password' do
|
||||
@@ -303,7 +303,7 @@ class PasswordTest < ActionDispatch::IntegrationTest
|
||||
assert_not_contain "1 error prohibited this user from being saved:"
|
||||
assert_not_contain "Email not found"
|
||||
assert_contain "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
||||
assert_current_url "/users/log_in"
|
||||
assert_current_url "/users/sign_in"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -315,7 +315,7 @@ class PasswordTest < ActionDispatch::IntegrationTest
|
||||
click_button 'Send me reset password instructions'
|
||||
|
||||
assert_contain "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
||||
assert_current_url "/users/log_in"
|
||||
assert_current_url "/users/sign_in"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -36,6 +36,11 @@ class RegistrationTest < ActionDispatch::IntegrationTest
|
||||
assert_current_url "/?custom=1"
|
||||
end
|
||||
|
||||
test 'a guest admin should not see a warning about minimum password length' do
|
||||
get new_admin_session_path
|
||||
assert_not_contain 'characters minimum'
|
||||
end
|
||||
|
||||
|
||||
def user_sign_up
|
||||
ActionMailer::Base.deliveries.clear
|
||||
|
||||
@@ -90,8 +90,8 @@ class SessionTimeoutTest < ActionDispatch::IntegrationTest
|
||||
get expire_user_path(user)
|
||||
assert warden.authenticated?(:user)
|
||||
|
||||
get "/users/log_in"
|
||||
assert_redirected_to "/users/log_in"
|
||||
get "/users/sign_in"
|
||||
assert_redirected_to "/users/sign_in"
|
||||
follow_redirect!
|
||||
|
||||
assert_response :success
|
||||
@@ -103,7 +103,7 @@ class SessionTimeoutTest < ActionDispatch::IntegrationTest
|
||||
user = sign_in_as_user
|
||||
get expire_user_path(user)
|
||||
|
||||
post "/users/log_in", email: user.email, password: "123456"
|
||||
post "/users/sign_in", email: user.email, password: "123456"
|
||||
|
||||
assert_response :redirect
|
||||
follow_redirect!
|
||||
|
||||
@@ -78,8 +78,8 @@ class MappingTest < ActiveSupport::TestCase
|
||||
|
||||
test 'return default path names' do
|
||||
mapping = Devise.mappings[:user]
|
||||
assert_equal 'log_in', mapping.path_names[:log_in]
|
||||
assert_equal 'log_out', mapping.path_names[:log_out]
|
||||
assert_equal 'sign_in', mapping.path_names[:sign_in]
|
||||
assert_equal 'sign_out', mapping.path_names[:sign_out]
|
||||
assert_equal 'password', mapping.path_names[:password]
|
||||
assert_equal 'confirmation', mapping.path_names[:confirmation]
|
||||
assert_equal 'sign_up', mapping.path_names[:sign_up]
|
||||
@@ -88,8 +88,8 @@ class MappingTest < ActiveSupport::TestCase
|
||||
|
||||
test 'allow custom path names to be given' do
|
||||
mapping = Devise.mappings[:manager]
|
||||
assert_equal 'login', mapping.path_names[:log_in]
|
||||
assert_equal 'logout', mapping.path_names[:log_out]
|
||||
assert_equal 'login', mapping.path_names[:sign_in]
|
||||
assert_equal 'logout', mapping.path_names[:sign_out]
|
||||
assert_equal 'secret', mapping.path_names[:password]
|
||||
assert_equal 'verification', mapping.path_names[:confirmation]
|
||||
assert_equal 'register', mapping.path_names[:sign_up]
|
||||
|
||||
@@ -94,13 +94,13 @@ Rails.application.routes.draw do
|
||||
end
|
||||
|
||||
namespace :publisher, path_names: { sign_in: "i_dont_care", sign_out: "get_out" } do
|
||||
devise_for :accounts, class_name: "Admin", path_names: { log_in: "get_in" }
|
||||
devise_for :accounts, class_name: "Admin", path_names: { sign_in: "get_in" }
|
||||
end
|
||||
|
||||
scope ":locale", module: :invalid do
|
||||
devise_for :accounts, singular: "manager", class_name: "Admin",
|
||||
path_names: {
|
||||
log_in: "login", log_out: "logout",
|
||||
sign_in: "login", sign_out: "logout",
|
||||
password: "secret", confirmation: "verification",
|
||||
unlock: "unblock", sign_up: "register",
|
||||
registration: "management",
|
||||
|
||||
@@ -4,18 +4,18 @@ ExpectedRoutingError = Devise.rails4? ? MiniTest::Assertion : ActionController::
|
||||
|
||||
class DefaultRoutingTest < ActionController::TestCase
|
||||
test 'map new user session' do
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'new'}, {path: 'users/log_in', method: :get})
|
||||
assert_named_route "/users/log_in", :new_user_session_path
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'new'}, {path: 'users/sign_in', method: :get})
|
||||
assert_named_route "/users/sign_in", :new_user_session_path
|
||||
end
|
||||
|
||||
test 'map create user session' do
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'create'}, {path: 'users/log_in', method: :post})
|
||||
assert_named_route "/users/log_in", :user_session_path
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'create'}, {path: 'users/sign_in', method: :post})
|
||||
assert_named_route "/users/sign_in", :user_session_path
|
||||
end
|
||||
|
||||
test 'map destroy user session' do
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: 'users/log_out', method: :get})
|
||||
assert_named_route "/users/log_out", :destroy_user_session_path
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: 'users/sign_out', method: :get})
|
||||
assert_named_route "/users/sign_out", :destroy_user_session_path
|
||||
end
|
||||
|
||||
test 'map new user confirmation' do
|
||||
@@ -121,7 +121,7 @@ class CustomizedRoutingTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
test 'map admin with :controllers option' do
|
||||
assert_recognizes({controller: 'admins/sessions', action: 'new'}, {path: 'admin_area/log_in', method: :get})
|
||||
assert_recognizes({controller: 'admins/sessions', action: 'new'}, {path: 'admin_area/sign_in', method: :get})
|
||||
end
|
||||
|
||||
test 'does not map admin password' do
|
||||
@@ -131,7 +131,7 @@ class CustomizedRoutingTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
test 'subdomain admin' do
|
||||
assert_recognizes({"host"=>"sub.example.com", controller: 'devise/sessions', action: 'new'}, {host: "sub.example.com", path: '/sub_admin/log_in', method: :get})
|
||||
assert_recognizes({"host"=>"sub.example.com", controller: 'devise/sessions', action: 'new'}, {host: "sub.example.com", path: '/sub_admin/sign_in', method: :get})
|
||||
end
|
||||
|
||||
test 'does only map reader password' do
|
||||
@@ -166,24 +166,24 @@ class CustomizedRoutingTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
test 'map deletes with :sign_out_via option' do
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/deletes/log_out', method: :delete})
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/deletes/sign_out', method: :delete})
|
||||
assert_raise ExpectedRoutingError do
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/deletes/log_out', method: :get})
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/deletes/sign_out', method: :get})
|
||||
end
|
||||
end
|
||||
|
||||
test 'map posts with :sign_out_via option' do
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/posts/log_out', method: :post})
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/posts/sign_out', method: :post})
|
||||
assert_raise ExpectedRoutingError do
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/posts/log_out', method: :get})
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/posts/sign_out', method: :get})
|
||||
end
|
||||
end
|
||||
|
||||
test 'map delete_or_posts with :sign_out_via option' do
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/delete_or_posts/log_out', method: :post})
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/delete_or_posts/log_out', method: :delete})
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/delete_or_posts/sign_out', method: :post})
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/delete_or_posts/sign_out', method: :delete})
|
||||
assert_raise ExpectedRoutingError do
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/delete_or_posts/log_out', method: :get})
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/delete_or_posts/sign_out', method: :get})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -202,9 +202,9 @@ class CustomizedRoutingTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
test 'map with format false for sessions' do
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'new'}, {path: '/htmlonly_admin/log_in', method: :get})
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'new'}, {path: '/htmlonly_admin/sign_in', method: :get})
|
||||
assert_raise ExpectedRoutingError do
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'new'}, {path: '/htmlonly_admin/log_in.xml', method: :get})
|
||||
assert_recognizes({controller: 'devise/sessions', action: 'new'}, {path: '/htmlonly_admin/sign_in.xml', method: :get})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ class TestHelpersTest < ActionController::TestCase
|
||||
|
||||
test "returns the body of a failure app" do
|
||||
get :index
|
||||
assert_equal response.body, "<html><body>You are being <a href=\"http://test.host/users/log_in\">redirected</a>.</body></html>"
|
||||
assert_equal response.body, "<html><body>You are being <a href=\"http://test.host/users/sign_in\">redirected</a>.</body></html>"
|
||||
end
|
||||
|
||||
test "defined Warden after_authentication callback should not be called when sign_in is called" do
|
||||
|
||||
Reference in New Issue
Block a user