Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #52 from dlibanori/webrat

---

Actually this is a patch for Rack applications redirects.

This patch changes current specs and shows where they fail.

I think it is not so hard coded as forcing mock session to comply with Rack::Test example.org url.
  • Loading branch information...
commit 6b7c4223f4b3e18d949c192d7b56ebf1e03b20e4 2 parents 9891e51 + 55c9a99
@indirect indirect authored
View
1  lib/webrat/adapters/rack.rb
@@ -4,6 +4,7 @@ module Webrat
class RackAdapter
extend Forwardable
+ attr :session
def_delegators :@session, :get, :post, :put, :delete
def initialize(session) #:nodoc:
View
8 lib/webrat/core/session.rb
@@ -286,11 +286,15 @@ def response_location
end
def current_host
- URI.parse(current_url).host || @custom_headers["Host"] || "www.example.com"
+ URI.parse(current_url).host || @custom_headers["Host"] || default_current_host
end
def response_location_host
- URI.parse(response_location).host || "www.example.com"
+ URI.parse(response_location).host || default_current_host
+ end
+
+ def default_current_host
+ adapter.session.rack_mock_session.default_host
end
def reset
View
2  spec/integration/rack/test/webrat_rack_test.rb
@@ -8,7 +8,7 @@ class WebratRackTest < Test::Unit::TestCase
include Webrat::HaveTagMatcher
def build_rack_mock_session
- Rack::MockSession.new(app, "www.example.com")
+ Rack::MockSession.new(app, "example.net")
end
def test_visits_pages
Please sign in to comment.
Something went wrong with that request. Please try again.