mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-09 14:58:05 -05:00
Do not use the dynamic :action segment on Omniauth routes.
This was deprecated on rails/rails#23980. We now generate scope and provider specific routes, like `user_facebook_omniauth_callback` or `user_github_omniauth_callback`. We could deprecate the `omniauth_authorize_path` in favor of the generated routes, but the `shared/links.html.erb` depends on it to generate all omniauth links at once. Closes #3983.
This commit is contained in:
@@ -1,23 +1,21 @@
|
||||
require 'test_helper'
|
||||
|
||||
class OmniAuthRoutesTest < ActionController::TestCase
|
||||
ExpectedUrlGeneratiorError = ActionController::UrlGenerationError
|
||||
|
||||
tests ApplicationController
|
||||
|
||||
def assert_path(action, provider, with_param=true)
|
||||
# Resource param
|
||||
assert_equal @controller.send(action, :user, provider),
|
||||
@controller.send("user_#{action}", provider)
|
||||
@controller.send("user_#{provider}_#{action}")
|
||||
|
||||
# With an object
|
||||
assert_equal @controller.send(action, User.new, provider),
|
||||
@controller.send("user_#{action}", provider)
|
||||
@controller.send("user_#{provider}_#{action}")
|
||||
|
||||
if with_param
|
||||
# Default url params
|
||||
assert_equal @controller.send(action, :user, provider, param: 123),
|
||||
@controller.send("user_#{action}", provider, param: 123)
|
||||
@controller.send("user_#{provider}_#{action}", param: 123)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,7 +30,7 @@ class OmniAuthRoutesTest < ActionController::TestCase
|
||||
test 'should generate authorization path' do
|
||||
assert_match "/users/auth/facebook", @controller.omniauth_authorize_path(:user, :facebook)
|
||||
|
||||
assert_raise ExpectedUrlGeneratiorError do
|
||||
assert_raise NoMethodError do
|
||||
@controller.omniauth_authorize_path(:user, :github)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user