Last Updated: February 25, 2016
· thomasklemm

Set a custom redirect limit for Capybara in Rails

If you see a Capybara::InfiniteRedirectError but want to try to raise the default limit of 5 a little higher to see what happens then, this might help.

# spec/spec_helper.rb
Capybara.register_driver :rack_test do |app|, :respect_data_method => true, :redirect_limit => 20)

The error message (for Google to pick this up).

   redirected more than 5 times, check for infinite redirects.

Source: Capybara/Rails.