This a very short note on setting up Capybara to correctly follow redirects with Rails classic
redirect_to @object pattern.
The problem why Capybara might not properly follow redirects in this case is that when
redirect_to is called with ActiveRecord object argument an
absolute URL is created and passed instead of relative one. So depending on the way of how Capybara server is started this might not work. To avoid this issue, one has to properly setup
app_host and Capybara server settings (
Here we use port
3002 for both port settings and Capybara redirects as expected!
← BUY THE PRE-RELEASE
I am writing a complete guide on web application deployment. Ruby with Puma, Python with Gunicorn, NGINX, PostgreSQL, Redis, networking, processes, systemd, backups, and all your usual suspects. Final release soon!