webrat/spec
Simon Rozet 4e07f5b654 Fix following of absolute redirect URL in Sinatra
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] 5c00dd698e/lib/rack/mock.rb (L79)
[2] 5c00dd698e/lib/rack/request.rb (L201)
[3] 5c00dd698e/lib/rack/request.rb (L72)
2009-02-28 03:30:26 +01:00
..
fakes Refactor redirect handling as Merb response doesn't support the redirect? method. All integration specs now passing again. 2008-12-29 22:45:55 -05:00
integration Fix following of absolute redirect URL in Sinatra 2009-02-28 03:30:26 +01:00
private Support for "modular" Sinatra app style 2009-02-28 03:30:25 +01:00
public Pulling attribute conditions up from have_selector to have_xpath 2009-02-23 20:47:02 -05:00
rcov.opts Added prelimary support for fully qualified links starting with http:// or https://. Restored missing commits(???) 2008-05-04 04:15:36 -04:00
spec.opts spec.opts 2008-11-13 21:28:28 -05:00
spec_helper.rb Need test/unit to test assert functionality 2009-01-17 16:34:00 -05:00