开发者

What is the best way to test SSL-only URLs with Capybara?

开发者 https://www.devze.com 2023-04-01 03:13 出处:网络
I\'ve gone round and round trying to come up with the cleanest / easiest way to write request specs for certain pages of my site. I basica开发者_C百科lly need a way to get Capybara to load pages that

I've gone round and round trying to come up with the cleanest / easiest way to write request specs for certain pages of my site. I basica开发者_C百科lly need a way to get Capybara to load pages that only accessible over https. Here are the pertinent details:

  • I'm currently using RSpec, Capybara and FactoryGirl on Rails 3.1.0
  • Its an e-commerce site. Some controllers force all actions ssl using the new force_ssl method in the controller class definition while some do not. I need the cart and checkout pages to be always https://, of course, while the rest of the site should remain accessible over http://.
  • I would be OK with somehow stubbing the SSL aspect of the requests if only I knew how to do it!

I'm sure many people out there have faced this same challenge. How did you do it?


What Capybara driver are you using? It should work fine with Selenium.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号