使用 nginx 运行水豚

发布于 11-29 15:19 字数 79 浏览 1 评论 0原文

是否可以使用 nginx 和乘客来运行水豚?而是 webrick? Capybara 与 Cucumber 一起安装在 Rails 应用程序中。

Is is possible to run capybara with nginx and passenger? instead or webrick? Capybara is installed with cucumber in a rails app.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

我恋#小黄人2024-12-06 15:19:31

这很简单 - 你唯一要做的就是改变你的想法 - 水豚和黄瓜都不受本地环境的束缚,你可以测试位于互联网上的应用程序,它不会关心它 - 你甚至可以测试谷歌。如果你愿意的话。

对于您的特定问题,您必须设置

Capybara.run_server = false
Capybara.server_port = 8000 # or whatever port is your instance of nginx is configured to serve
Capybara.app_host = 'http://www.google.com' # if your instance is running on remote machine, else just drop it and capybara will use localhost

您可以使用黄瓜钩子轻松控制应用程序的重新启动,您可以将其配置为在每次测试之前或测试套件之前重新启动。 (请参阅 cucumber wiki)在钩子中,您必须发出 FileUtils.touch tmp/restart.txt 命令。与数据库相同 - 您可以手动设置挂钩以在需要时截断它(请参阅 database_cleaner gem)

It is easy - the only thing you have to do is to switch your mind - neither capybara nor cucumber are not tied to local environment you can test application that is located in internet and it will not care about it - you can even test google.com if you want.

For your particular problem you'll have to set

Capybara.run_server = false
Capybara.server_port = 8000 # or whatever port is your instance of nginx is configured to serve
Capybara.app_host = 'http://www.google.com' # if your instance is running on remote machine, else just drop it and capybara will use localhost

You can easily control restarting of your application using cucumber hooks, you can configure it to restart before each test or before test suite. (See cucumber wiki) Within hook you'll have to issue FileUtils.touch tmp/restart.txt command. The same with database - you can manually setup hook to truncate it whenever it is needed (See database_cleaner gem)

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