开发者

How to put capybara output html to a specific folder?

When I use the "Show me the page" step, with Capybara / Cucumber, can I control where t开发者_JAVA技巧he 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.


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=


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜