4e07f5b654
What's going on when the app redirects to an absolute URL? * Sinatra relies on Rack::MockSession which sets SERVER_NAME to "example.org" [1] on request it makes. However, Webrat expects it to be "www.example.com" * In MyClassyApp, the redirect URL is made out of Rack::Request#url [2] which uses SERVER_NAME, which is set to "example.org" by Rack::MockSession. As a result, Webrat see it as an external redirect and don't follow it. NOTE: * SERVER_NAME is stricly equivalent to HTTP_HOST [3] * This could have been fixed in Webrat::Session too. I'am not sure that it won't affect other frameworks so I left it intact. def request_page(url, http_method, data) #:nodoc: h = headers h['HTTP_REFERER'] = @current_url if @current_url + h['HTTP_HOST'] = 'www.example.com' [1] |
||
---|---|---|
.. | ||
fakes | ||
integration | ||
private | ||
public | ||
rcov.opts | ||
spec.opts | ||
spec_helper.rb |