简体   繁体   English

如何在rspec / capybara中停止App Transport Security错误

[英]How to stop App Transport Security error in rspec/capybara

I am using rails 4.2.5.1 with rspec and capybara. 我使用rails 4.2.5.1与rspec和capybara。 One of my tests gives the following message 我的一个测试给出了以下消息

2016-01-28 08:56:07.805 webkit_server[31376:18902667] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

I have isolated the cause to the following lines of code in my view 我已将原因隔离到我视图中的以下代码行

<audio id="bellAudio">
    <source src="/assets/ion-sounds/bell_ring.mp3" type="audio/mp3" autobuffer="autobuffer" />
    <source src="/assets/ion-sounds/bell_ring.ogg" type="audio/ogg" autobuffer="autobuffer"/>
</audio>

which are activated by the following coffee script: 这些由以下咖啡脚本激活:

play_bell = ->
    $("#bellAudio")[0].load();
    $("#bellAudio")[0].play();

It seems very strange to get this message for what appears to be access to a local server. 看似访问本地服务器的消息似乎很奇怪。 How do I prevent this message? 如何阻止此消息? If the answer is to use add something to an Info.plist, where do I put that file? 如果答案是使用添加到Info.plist的东西,我在哪里放置该文件?

I swapped out the mp3 for one I generated and still got the deprecation message, so it is not a real security issue with the mp3. 我换了一个我生成的mp3并且仍然得到了弃用消息,所以这不是mp3的真正安全问题。

I changed out the webkit driver for poltergeist and the test works and I do not get the warning message any more. 我更改了用于poltergeistwebkit driver并且测试工作,我不再收到警告消息。 So I think it is just a problem with webkit . 所以我认为这只是webkit一个问题。 This post makes strong arguments to move to poltergeist. 这篇文章强烈反对转向恶作剧家。 So that is the way I solved it, ie I am now using poltergeist as my web driver for Capybara. 所以这就是我解决它的方式,即我现在使用poltergeist作为我的Capybara的网络驱动程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM