lib/capybara/httpclient_json/driver.rb in capybara-json-0.2.4 vs lib/capybara/httpclient_json/driver.rb in capybara-json-0.3.0.beta1
- old
+ new
@@ -80,16 +80,30 @@
handle_error { #{method}(url, json, headers) }
end
}
end
+ def needs_server?
+ true
+ end
+
def reset!
@client = nil
end
protected
def process(method, path, params = {}, headers = {}, options = {})
- @current_url = @rack_server.url(path)
+ @current_url = if @rack_server.respond_to?(:url)
+ @rack_server.url(path)
+ elsif path !~ /^http/
+ if Capybara.app_host
+ Capybara.app_host + path.to_s
+ else
+ "http://#{@rack_server.host}:#{@rack_server.port}" + path.to_s
+ end
+ else
+ path
+ end
begin
@response = client.__send__(method, @current_url, params, headers, options)
# hack for redirect