[rspec-users] [Cucumber] ssl requirement

Chris Flipse cflipse at gmail.com
Tue Feb 17 08:48:31 EST 2009


>
> Ok, so I tried just sticking an "ENV['HTTPS'] = 'on'" in my
> spec/spec_helper.rb file and re-running my spec suite. Looks like this is
> not enough in itself, as I got about 77 spec failures, all of them
> apparently caused by "ssl?" returning false and producing unwanted
> redirects.
>

Rails doesn't pull the HTTPS from the env, it pulls it from the request
headers.  In rails integration tests, you specify those by providing a
*third* argument for get/post/put/delete:

  get :show, { :id => :foobar }, { "HTTPS" => "on" }

... If you're using webrat, you can just call

  header("HTTPS", "on")

and that will, as of 0.4, be sticky through all the redirects and everything
else your app can throw at it.  I've been doing this at work for a while,
and it does work.

http://devcaffeine.com/2009/02/16/integration-testing-ssl-with-cucumber/



-- 
// anything worth taking seriously is worth making fun of
// http://blog.devcaffeine.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090217/9e075237/attachment.html>


More information about the rspec-users mailing list