[rspec-users] Fake SSL in specs when using ssl_requirement plug-in

Johan Sørensen johan at johansorensen.com
Tue Jun 26 08:11:40 EDT 2007


On Jun 26, 2007, at 1:56 PM, Ashley Moran wrote:

>    describe "GET /gap/get_qote" do
>      controller_name :gap
>
>      it "should redirect to the HTTPS version of the action" do
>        get 'get_quote', :id => "finance"
>        response.should redirect_to('https://test.host/gap/get_quote/
> finance')
>      end
>    end
>
> ...with no problems.  But I can't figure out how to fake an SSL
> request in the spec setups so all my other specs are failing as they
> are being treated as non-SSL by the controller and redirected.

Maybe with:
>      it "should redirect to the HTTPS version of the action" do
	  request.stub!(:ssl?).and_return(true)
>        get 'get_quote', :id => "finance"
>        response.should redirect_to('https://test.host/gap/get_quote/
> finance')
>      end

eg. stub out the method that the ssl redirect method checks against

JS


More information about the rspec-users mailing list