triskweline / capybara-ssl-issue

Test case exposing an issue when using Capybara/Rack::Test with SSL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The test case can be run with script/cucumber features/ssl.feature
A before_filter in ApplicationController prints out details about every request, so you can observe Capybara (or Rack::Test) losing the HTTPS protocol once it followed the redirect from ssl_requirement.

The issue (http://github.com/jnicklas/capybara/issues#issue/85) is this:

Capybara does not play nice 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.

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


About

Test case exposing an issue when using Capybara/Rack::Test with SSL


Languages

Language:Ruby 99.4%Language:JavaScript 0.6%