Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Conflicts:
	lib/capybara/mechanize/browser.rb
  • Loading branch information
jeroenvandijk committed Sep 9, 2011
2 parents 78f33ec + d6eb302 commit d6464b2
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.mdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 2 additions & 2 deletions capybara-mechanize.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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

8 changes: 6 additions & 2 deletions lib/capybara/mechanize/browser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/mechanize/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions spec/session/mechanize_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions spec/session/remote_mechanize_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

before do
@session = Capybara::Session.new(:mechanize)
@session.driver.options[:respect_data_method] = true
end

describe '#driver' do
Expand Down

0 comments on commit d6464b2

Please sign in to comment.