{"action":"opened","issue":{"url":"https://api.github.com/repos/jnicklas/capybara/issues/1557","labels_url":"https://api.github.com/repos/jnicklas/capybara/issues/1557/labels{/name}","comments_url":"https://api.github.com/repos/jnicklas/capybara/issues/1557/comments","events_url":"https://api.github.com/repos/jnicklas/capybara/issues/1557/events","html_url":"https://github.com/jnicklas/capybara/issues/1557","id":98206635,"number":1557,"title":"Make script_name configurable","user":{"login":"betesh","id":2154282,"avatar_url":"https://avatars.githubusercontent.com/u/2154282?v=3","gravatar_id":"","url":"https://api.github.com/users/betesh","html_url":"https://github.com/betesh","followers_url":"https://api.github.com/users/betesh/followers","following_url":"https://api.github.com/users/betesh/following{/other_user}","gists_url":"https://api.github.com/users/betesh/gists{/gist_id}","starred_url":"https://api.github.com/users/betesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/betesh/subscriptions","organizations_url":"https://api.github.com/users/betesh/orgs","repos_url":"https://api.github.com/users/betesh/repos","events_url":"https://api.github.com/users/betesh/events{/privacy}","received_events_url":"https://api.github.com/users/betesh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-30T16:08:08Z","updated_at":"2015-07-30T16:08:08Z","closed_at":null,"body":"At line 5 of [lib/capybara/rails.rb](https://github.com/jnicklas/capybara/blob/3ae284460b1af35d40b077bf14f7222c2982c120/lib/capybara/rails.rb#L5), there is a hard-coded assumption that the app I am testing is rooted at \"/\"\r\n\r\n    map \"/\" do\r\n\r\nThis is not a guarantee.  My Rails 4.2 application is configured with:\r\n\r\n    ActionController::Base.relative_url_root = Rails.application.routes.default_url_options[:script_name] = ActionMailer::Base.default_url_options[:script_name] = Rails.application.config.session_options[:path] = \"some_nested_url\"\r\n\r\nso that the application lives at https://mydomain.com/some_nested_url.\r\n\r\nTo tell Capybara this, I have to monkey-patch the entire `Capybara.app = Rack::Builder.new do ...` in the above file.\r\n\r\nInstead of \"/\", the argument to `map` should really be:\r\n\r\n    ActionController::Base.relative_url_root.presence || '/'\r\n\r\nThis could even be a configurable option, with `ActionController::Base.relative_url_root.presence || '/'` as the default.\r\n\r\nIf I a PR that addresses this, will it be accepted?  Should I make it configurable or just check for `relative_url_root`?\r\n\r\n\r\n"}}