Running capybara with nginx
Is is possible to run capybara with ngin开发者_如何转开发x and passenger? instead or webrick? Capybara is installed with cucumber in a rails app.
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)
精彩评论