如何将水豚输出的html放入特定文件夹?

发布于 2024-09-13 08:08:05 字数 127 浏览 0 评论 0原文

当我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

亚希 2024-09-20 08:08:05

确实有一个配置选项允许您指定输出文件的位置:

水豚.save_and_open_page_path

我相信它是在最新版本(0.3.9)中添加的。

在您的 env.rb 文件中,您可以执行以下操作:

Capybara.save_and_open_page_path = '/Users/jsboulanger/my-rails-project/tmp'

在 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:

Capybara.save_and_open_page_path

I believe it was added in the latest version (0.3.9)

In your env.rb file you can do something like:

Capybara.save_and_open_page_path = '/Users/jsboulanger/my-rails-project/tmp'

In Capybara 2.10, Capybara::save_and_open_page= is deprecated. Instead, call Capybara::save_path=

眼眸里的快感 2024-09-20 08:08:05

好的。谢谢你。

为了真正简洁,我将配置行添加到 config/environments/test.rb 中,因为您通常只在测试中使用水豚,而且效果很好。

由于 tmp/ 中有一堆子文件夹,我使用:

Capybara.save_and_open_page_path = 'tmp/capybara'

并创建了该文件夹。

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:

Capybara.save_and_open_page_path = 'tmp/capybara'

and created that folder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文