Permalink
Browse files

Merge https://github.com/bhollis/capybara-mechanize

Conflicts:
	lib/capybara/mechanize/browser.rb
  • Loading branch information...
2 parents 78f33ec + d6eb302 commit d6464b228d57a64cf7d4b4de62f5f8f3d5ebabad @jeroenvandijk committed Sep 9, 2011
View
@@ -1,4 +1,4 @@
-Copyright (c) 2010 Jeroen van Dijk
+Copyright (c) 2010-2011 Jeroen van Dijk and contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -73,4 +73,4 @@ Note on Patches/Pull Requests
Copyright
---------
-Copyright (c) 2010 Jeroen van Dijk. See LICENSE for details.
+Copyright (c) 2010-2011 Jeroen van Dijk. See LICENSE for details.
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.7}
- s.add_runtime_dependency(%q<mechanize>, ["~> 1.0.0"])
- s.add_runtime_dependency(%q<capybara>, ["~> 1.0.0"])
+ s.add_runtime_dependency(%q<mechanize>, ["~> 2.0.0"])
+ s.add_runtime_dependency(%q<capybara>, ["~> 1.1.0"])
end
@@ -7,7 +7,7 @@ class Capybara::Mechanize::Browser < Capybara::RackTest::Browser
def_delegator :agent, :scheme_handlers
def_delegator :agent, :scheme_handlers=
- def initialize(app, options)
+ def initialize(driver)
@agent = ::Mechanize.new
@agent.redirect_ok = false
@agent.user_agent = default_user_agent
@@ -80,7 +80,11 @@ def determine_path(path)
unless path.start_with?('/')
folders = request_path.split('/')
- path = (folders[0, folders.size - 1] << path).join('/')
+ if folders.empty?
+ path = '/' + path
+ else
+ path = (folders[0, folders.size - 1] << path).join('/')
+ end
end
path = current_host + path
end
@@ -15,7 +15,7 @@ def remote?(url)
end
def browser
- @browser ||= Capybara::Mechanize::Browser.new(app, options)
+ @browser ||= Capybara::Mechanize::Browser.new(self)
end
end
@@ -4,6 +4,7 @@
context 'with mechanize driver' do
before do
@session = Capybara::Session.new(:mechanize, TestApp)
+ @session.driver.options[:respect_data_method] = true
Capybara.default_host = 'http://www.local.com'
end
@@ -13,6 +13,7 @@
before do
@session = Capybara::Session.new(:mechanize)
+ @session.driver.options[:respect_data_method] = true
end
describe '#driver' do

0 comments on commit d6464b2

Please sign in to comment.