jeudi 1 janvier 2015

Testing paths in rails app to be deployed to subdirectory

I have a Rails 4.1.1 app which is to be deployed using Passenger under a subdirectory. The deployment works fine using the RailsBaseURI functionality and links created with the URL helpers are OK but, not surprisingly, paths that have been hand-crafted use the webserver root rather than the subdirectory.


Most of these are easy enough to fix but, in the interests of TDD, testing them is another story. I thought setting config.relative_url_root = '/foo' in config/environment/test.rb would prepend paths created with URL helpers like link_to with "foo" but this setting appears to be ignored in the test environment.


Any suggestions on how I can test that the paths include the base URI?


Aucun commentaire:

Enregistrer un commentaire