Ashley Moran
2007-Jun-26 11:56 UTC
[rspec-users] Fake SSL in specs when using ssl_requirement plug-in
Hi I''ve used the ssl_required line from the ssl_requirement plug-in at the start of a controller for SSL. Its implemented as redirects so I can spec this... 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. Anyone know how to do this? Thanks in advance Ashley
Johan Sørensen
2007-Jun-26 12:11 UTC
[rspec-users] Fake SSL in specs when using ssl_requirement plug-in
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" dorequest.stub!(:ssl?).and_return(true)> get ''get_quote'', :id => "finance" > response.should redirect_to(''https://test.host/gap/get_quote/ > finance'') > endeg. stub out the method that the ssl redirect method checks against JS
Ashley Moran
2007-Jun-26 13:01 UTC
[rspec-users] Fake SSL in specs when using ssl_requirement plug-in
On 26 Jun 2007, at 13:11, Johan S?rensen wrote:> request.stub!(:ssl?).and_return(true)Now why didn''t I think of that :) I was looking for a way to set the request headers or protocol or something... Ta very much
Jonathan Linowes
2007-Jun-26 14:00 UTC
[rspec-users] Fake SSL in specs when using ssl_requirement plug-in
I wonder if there could be some kind of tool that dumps a potential call sequence and stack so you could more easily see where stubs could go. On Jun 26, 2007, at 9:01 AM, Ashley Moran wrote:> > On 26 Jun 2007, at 13:11, Johan S?rensen wrote: > >> request.stub!(:ssl?).and_return(true) > > Now why didn''t I think of that :) I was looking for a way to set the > request headers or protocol or something... > > Ta very much > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Ashley Moran
2007-Jun-27 15:33 UTC
[rspec-users] Fake SSL in specs when using ssl_requirement plug-in
On 26 Jun 2007, at 15:00, Jonathan Linowes wrote:> I wonder if there could be some kind of tool that dumps a potential > call sequence and stack so you could more easily see where stubs > could go.How do you mean exactly? I''m not sure it would be possible - you''d have to know where it should "fail" before you would know what sequence to fail, and if you could do that, you''d know what to do anyway. That''s if I understood you? Ashley