[rspec-users] [Cucumber] ssl requirement

Wincent Colaiuta win at wincent.com
Fri Feb 13 08:44:27 EST 2009


I'm trying to write features for an SSL-only site, but I can't test  
anything because every request in my stories results in a redirect  
(the site is set up to redirect non-SSL requests to SSL).

In my _specs_ I hack around this problem with this nasty kludge in my  
spec_helper:

   module ActionController
     class TestRequest
       def ssl?
         true
       end
     end
   end

But this doesn't seem to work for Cucumber when I add it to my  
features/support/env.rb, as my ssl? override is never called. I guess  
either Cucumber doesn't use ActionController::TestRequest under the  
covers, or if it does the real ActionController::TestRequest.ssl?  
method is evaluated _after_ and so my override gets overridden itself.

Any ideas for how I can stop the redirects from happening? Evidently  
I've already tried changing instances of:

   get '/foo'

To:

   get '/foo', :protocol => 'https'

But, that makes no difference.

Cheers,
Wincent




More information about the rspec-users mailing list