Skip to content

Instantly share code, notes, and snippets.

@pat
Created February 9, 2012 02:47
Show Gist options
  • Save pat/1776846 to your computer and use it in GitHub Desktop.
Save pat/1776846 to your computer and use it in GitHub Desktop.
SSL Redirection RSpec Matcher
RSpec::Matchers.define(:redirect_to_ssl) do
description { 'redirect to same page using the HTTPS protocol' }
match { |status|
response.redirect_url == request.url.gsub(/^http:/, 'https:')
}
end
# in spec/requests or similar...
get('/admin/sign_in').should redirect_to_ssl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment