Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running capybara with nginx

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

like image 766
Alex Avatar asked Aug 13 '11 01:08

Alex


1 Answers

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)

like image 112
iafonov Avatar answered Oct 22 '22 04:10

iafonov