
Merb support
Reported by Bryan Helmkamp | April 28th, 2008 @ 05:54 AM
In progress at https://github.com/gwynm/webrat
Comments and changes to this ticket
-
Bryan Helmkamp October 21st, 2008 @ 11:33 PM
- State changed from new to resolved
-
Bryan Helmkamp March 8th, 2009 @ 06:59 PM
(from [4e07f5b654018965c83425cd1fec14cdb8a87220]) 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] http://github.com/rack/rack/blob... [2] http://github.com/rack/rack/blob... [3] http://github.com/rack/rack/blob... http://github.com/brynary/webrat...
-
-
Bryan Helmkamp March 8th, 2009 @ 06:59 PM
(from [4e07f5b654018965c83425cd1fec14cdb8a87220]) 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] http://github.com/rack/rack/blob... [2] http://github.com/rack/rack/blob... [3] http://github.com/rack/rack/blob... http://github.com/brynary/webrat...
-
-
Bryan Helmkamp March 8th, 2009 @ 06:59 PM
(from [90baf3311c582390522c30d434ac3afe7822cb69]) Sinatra now provides sensible options for testing
In the lastest release, 0.9.1:
-
Set sensible defaults on Default for test env [1] http://github.com/sinatra/sinatr...
-
Set :environment to :test in TestHarness http://github.com/sinatra/sinatr...
-
Set :environment to :test when Sinatra::Test is included http://github.com/sinatra/sinatr...
[1] Only Sinatra::Default provides special options for testing. If you subclass
Sinatra::Base, you'll have to set them yourself.
-
-
Bryan Helmkamp March 8th, 2009 @ 06:59 PM
(from [90baf3311c582390522c30d434ac3afe7822cb69]) Sinatra now provides sensible options for testing
In the lastest release, 0.9.1:
-
Set sensible defaults on Default for test env [1] http://github.com/sinatra/sinatr...
-
Set :environment to :test in TestHarness http://github.com/sinatra/sinatr...
-
Set :environment to :test when Sinatra::Test is included http://github.com/sinatra/sinatr...
[1] Only Sinatra::Default provides special options for testing. If you subclass
Sinatra::Base, you'll have to set them yourself.
-
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Ruby Acceptance Testing for Web applications.
People watching this ticket
Referenced by
-
145 handle multiselects #1 needs some discussion and thought. I'd try and get bry...