Created
February 9, 2012 02:47
-
-
Save pat/1776846 to your computer and use it in GitHub Desktop.
SSL Redirection RSpec Matcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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