title: Test an HTTPS (SSL) request in RSpec Rails
body: <p>I'd like to take advantage of the <a href="https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/force_ssl.rb" rel="noreferrer"><code>force_ssl</code> feature</a> in rails 3.1rc4. </p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
    force_ssl
  end
  </code></pre>
  
  <p>Problem is this breaks most/all of my existing RSpec controller specs. For example, this fails:</p>
  
  <pre><code>describe "GET 'index'" do
    it "renders the Start page" do
      get :index
      response.should render_template 'index'
    end
  end
  </code></pre>
  
  <p>Instead of rendering the page the response is a 301 redirect to <code>https://test.host/</code>.</p>
  
  <p>How can I change my specs to simulate an HTTPS GET/POST? </p>
  
  <p>And do I have to change each test manually or is there an easier way? (I realise I could invoke <code>force_ssl</code> only in production, but that's not ideal. Really, I should be testing that <code>force_ssl</code> does indeed redirect to https:// when expected.)</p>