Merge pull request #5508 from Edouard-chin/ec-omniauth-allowed-methods

Use Omniauth.allowed_methods' as routing verbs for the auth path:
This commit is contained in:
Rafael Mendonça França
2023-06-09 19:50:07 -04:00
committed by GitHub
2 changed files with 23 additions and 1 deletions

View File

@@ -126,6 +126,28 @@ class OmniauthableIntegrationTest < Devise::IntegrationTest
end
end
test "authorization path via GET when Omniauth allowed_request_methods includes GET" do
original_allowed = OmniAuth.config.allowed_request_methods
OmniAuth.config.allowed_request_methods = [:get, :post]
get "/users/auth/facebook"
assert_response(:redirect)
ensure
OmniAuth.config.allowed_request_methods = original_allowed
end
test "authorization path via GET when Omniauth allowed_request_methods doesn't include GET" do
original_allowed = OmniAuth.config.allowed_request_methods
OmniAuth.config.allowed_request_methods = [:post]
assert_raises(ActionController::RoutingError) do
get "/users/auth/facebook"
end
ensure
OmniAuth.config.allowed_request_methods = original_allowed
end
test "generates a link to authenticate with provider" do
visit "/users/sign_in"
assert_select "form[action=?][method=post]", "/users/auth/facebook" do