使用Nginx运行水豚 [英] Running capybara with nginx

查看:94
本文介绍了使用Nginx运行水豚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以与nginx和passenger一起运行水豚?取而代之还是webrick? Capybara随同Rails应用程序中的黄瓜一起安装.

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

推荐答案

这很容易-您唯一要做的就是改变主意-水豚和黄瓜都不与本地环境捆绑在一起,您可以测试以下应用程序:位于互联网上,它不会在乎它-如果需要,您甚至可以测试google.com.

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

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

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)

这篇关于使用Nginx运行水豚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆