Permalink
Browse files

Using Rack::MockSession to get default host

  • Loading branch information...
1 parent 90a10c5 commit ef084a763c7ba14b5ce3da6f997e16ef9b53fd27 @dlibanori dlibanori committed Mar 3, 2011
Showing with 3 additions and 2 deletions.
  1. +1 −0 lib/webrat/adapters/rack.rb
  2. +2 −2 lib/webrat/core/session.rb
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
4 lib/webrat/core/session.rb
@@ -286,11 +286,11 @@ 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"] || adapter.session.rack_mock_session.default_host
end
def response_location_host
- URI.parse(response_location).host || "www.example.com"
+ URI.parse(response_location).host || adapter.session.rack_mock_session.default_host
end
def reset

0 comments on commit ef084a7

Please sign in to comment.