Read more

Marry Capybara with SSL-enabled applications

Henning Koch
August 31, 2010Software engineer at makandra GmbH

Capybara does not play nice Show archive.org snapshot with sites that have some actions protected by SSL, some not. A popular way to implement this in Rails is using the ssl_requirement plugin by DHH, which redirects a requests from HTTP to HTTPS if the requested action requires SSL and vice versa.

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

Capybara follows the redirect, but seems to forget the changed protocol for the next request. The only hack-free workaround right now is to use URLs in lieu of paths everywhere (links, form actions).

For a hackful fix, copy the attached file to features/support/ssl_fix.rb.

This issue is fixed Show archive.org snapshot in the Capybara master and should no longer be present in future releases of the gem (I'm writing this on 2011-05-22).

Posted by Henning Koch to makandra dev (2010-08-31 18:47)