Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails : Testing production

We're working on a Rails 3 project and testing using Capybara/RSpec. The problem is that the staging and production environment differ somewhat. Sometimes, the tests will run fine and there will be no problem on staging, but will break in production.

An example is when we added a middleware that uses Rack::File to send files. The application sent the header 'X-Sendfile' which works under Apache but Nginx expects 'X-Accel-Redirect'.

I'm looking for the best way to run a battery of tests when we push to production. Has anyone done this? Ideally the tests should not be run on the production server itself.

The tests would basically cover the core features of our product and would be different from the tests we are currently running.

Thanks a lot

like image 232
gmalette Avatar asked Sep 15 '11 14:09

gmalette


1 Answers

What I ended up doing is have another set of RSpec test in a production_test environment that has read-only access to the database. I use the capybara-webkit driver and each test starts by visiting the complete URL for that test.

like image 53
gmalette Avatar answered Oct 23 '22 04:10

gmalette