Using OmniAuth (with omniauth_crowd), I want the user to be redirected to the login page if he does not send the correct username and password. It works great in production, but I have an unpleasant problem with testing it.
To make fun of the OmniAuth provider, I use the following code, as recommended by the author of the OmniAuth plugin:
OmniAuth.config.test_mode = true
OmniAuth.config.mock_auth[:someProvider] = :invalid_credentials
visit_page @page
This code automatically (i.e. without entering a username and password) redirects Capybara to session#failure. My session#failureredirected to login_path.
So I end up in a loop:
redirected more than 5 times, check for infinite redirects. (Capybara::InfiniteRedirectError)
What is the best workaround for my case?
source
share