如何将水豚输出的html放入特定文件夹?
当我使用 Capybara / Cucumber 的“显示页面”步骤时,我可以控制文件的输出位置吗?我似乎找不到这个配置,我的谷歌福让我失败。
现在看来,默认情况下它们会转到我的 Rails 文件夹的根目录并弄乱那里的东西。
When I use the "Show me the page" step, with Capybara / Cucumber, can I control where the files get output? I can't seem to find the config for this, and my google fu is failing me.
Right now it appears that by default they go to the root of my rails folder and clutter up things there.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确实有一个配置选项允许您指定输出文件的位置:
我相信它是在最新版本(0.3.9)中添加的。
在您的 env.rb 文件中,您可以执行以下操作:
在 Capybara 2.10 中,
Capybara::save_and_open_page=
已弃用。相反,调用Capybara::save_path=
There is indeed a config option that allows you to specify where to output the files:
I believe it was added in the latest version (0.3.9)
In your env.rb file you can do something like:
In Capybara 2.10,
Capybara::save_and_open_page=
is deprecated. Instead, callCapybara::save_path=
好的。谢谢你。
为了真正简洁,我将配置行添加到 config/environments/test.rb 中,因为您通常只在测试中使用水豚,而且效果很好。
由于 tmp/ 中有一堆子文件夹,我使用:
并创建了该文件夹。
Nice. Thanks for this.
To be really neat about it I added the config line to
config/environments/test.rb
, since you generally only use capybara in test, and that works fine.Since there's a bunch of subfolders in tmp/ I used:
and created that folder.