I'd like to take advantage of the force_ssl
feature in rails 3.1rc4.
class ApplicationController < ActionController::Base
force_ssl
end
Problem is this breaks most/all of my existing RSpec controller specs. For example, this fails:
describe "GET 'index'" do
it "renders the Start page" do
get :index
response.should render_template 'index'
end
end
Instead of rendering the page the response is a 301 redirect to https://test.host/
.
How can I change my specs to simulate an HTTPS GET/POST?
And do I have to change each test manually or is there an easier way? (I realise I could invoke force_ssl
only in production, but that's not ideal. Really, I should be testing that force_ssl
does indeed redirect to https:// when expected.)