Easy way to specify protocol for a controller spec?

Hi all,

I’d like to add some controller specs that use HTTPS rather than HTTP.
I’ve poked a bit into the get() and post() methods that are provided
by ControllerTestCase, but it doesn’t seem as though there’s an easy
way to specify that it should be using SSL from there.

In ActionController, I can specify request.ssl! to force the request
to be over HTTPS, but it looks like the request object provided by
ControllerTestCase is using ActionController::TestRequest… and to do
that, you’d usually do ths:

@request.env[‘HTTPS’] = ‘on’ # from
http://snippets.dzone.com/posts/show/467

But when I try this in a controller spec, this gives me a 302 redirect:

request.env[‘HTTPS’] = ‘on’
get :foo

So I must be missing something. Anyone know how to do this?

Will.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs