Sha256: 7cf3fab61099029776c1361177dac488162eb62be45c791b39a685047e332866

Contents?: true

Size: 924 Bytes

Versions: 6

Compression:

Stored size: 924 Bytes

Contents

require 'capybara/mechanize/cucumber' 

class Capybara::Driver::Mechanize
  def process_remote_request(method, url, *options)
    if remote?(url)
      remote_uri = URI.parse(url)
      if remote_uri.host.nil?
        #TODO: Ascertain whether this is really true...
        if(method == :post && @prev_url) #patch
          #require 'uri'
          #url = "http://#{URI.parse(@prev_url).host}#{URI.parse(@prev_url).path}"
          #p url
          url = @prev_url #patch
        else
          remote_host = @last_remote_host || Capybara.app_host || Capybara.default_host
          url = File.join(remote_host, url)
          url = "http://#{url}" unless url.include?("http")
        end
      else
        @last_remote_host = "#{remote_uri.host}:#{remote_uri.port}"
      end
      @prev_url = url #patch
      reset_cache
      @agent.send *( [method, url] + options)

      @last_request_remote = true
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
frameworks-capybara-0.0.32 lib/monkey-patches/capybara-mechanize-patches.rb
frameworks-capybara-0.0.31 lib/monkey-patches/capybara-mechanize-patches.rb
frameworks-capybara-0.0.30 lib/monkey-patches/capybara-mechanize-patches.rb
frameworks-capybara-0.0.29 lib/monkey-patches/capybara-mechanize-patches.rb
frameworks-capybara-0.0.28 lib/monkey-patches/capybara-mechanize-patches.rb
frameworks-capybara-0.0.27 lib/monkey-patches/capybara-mechanize-patches.rb