frameworks-capybara 0.2.0.rc4 → 0.2.0.rc5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- frameworks-capybara (0.2.0.rc4)
4
+ frameworks-capybara (0.2.0.rc5)
5
5
  capybara (>= 1.0.0)
6
6
  capybara-celerity
7
7
  capybara-mechanize (>= 0.3.0)
@@ -77,7 +77,7 @@ Before do
77
77
  #This is ugly but unavoidable since Capybara::RackTest::Driver.reset_host! does @browser = nil and wipes all brower level settings
78
78
  #it was either this or a monkey patch - need to think about pushing a softer reset change to capybara-mechanize to override this
79
79
  if page.driver.class == Capybara::Mechanize::Driver
80
- page.driver.browser.agent.cert, driver.browser.agent.key = ENV['FW_CERT_LOCATION'], ENV['FW_CERT_LOCATION'] if ENV['FW_CERT_LOCATION']
80
+ page.driver.browser.agent.cert, page.driver.browser.agent.key = ENV['FW_CERT_LOCATION'], ENV['FW_CERT_LOCATION'] if ENV['FW_CERT_LOCATION']
81
81
  page.driver.browser.agent.ca_file = ENV['CA_CERT_LOCATION'] if ENV['CA_CERT_LOCATION']
82
82
  page.driver.browser.agent.set_proxy('www-cache.reith.bbc.co.uk',80) if ENV['PROXY_URL']
83
83
  end
@@ -1,41 +1,29 @@
1
1
  require 'capybara/mechanize/cucumber'
2
2
  require 'uri'
3
-
4
- class Capybara::Driver::Mechanize
5
- =begin
6
- def process_remote_request(method, url, *options)
3
+ class Capybara::Mechanize::Browser
4
+ #patch to remove catching all Mechanize exceptions (which are nice and specific) and throwing a useless RuntimeError
5
+ def process_remote_request(method, url, attributes, headers)
7
6
  if remote?(url)
8
- remote_uri = URI.parse(url)
9
-
10
- @scheme = remote_uri.scheme if remote_uri.scheme
11
-
12
- if remote_uri.host.nil?
13
- #TODO: Ascertain whether this is really true...
14
- if(method == :post && url == "" && @prev_url) #patch
15
- #require 'uri'
16
- #url = "http://#{URI.parse(@prev_url).host}#{URI.parse(@prev_url).path}"
17
- #p url
18
- url = @prev_url #patch
19
- else
20
- remote_host = @last_remote_host || Capybara.app_host || Capybara.default_host
21
- url = File.join(remote_host, url)
22
- #url = "http://#{url}" unless url.include?("http")
23
- url = "#{@scheme}://#{url}" unless url.match(/^http.*/)
24
- end
25
- else
26
- @last_remote_host = "#{remote_uri.host}:#{remote_uri.port}"
27
- end
28
- @prev_url = url #patch
29
- reset_cache
30
- @agent.send *( [method, url] + options)
7
+ uri = URI.parse(url)
8
+ uri = resolve_relative_url(url) if uri.host.nil?
9
+ @last_remote_uri = uri
10
+ url = uri.to_s
31
11
 
12
+ reset_cache!
13
+ args = []
14
+ args << attributes unless attributes.empty?
15
+ args << headers unless headers.empty?
16
+ @agent.send(method, url, *args)
32
17
  @last_request_remote = true
33
18
  end
34
19
  end
35
- =end
20
+ end
21
+
22
+ class Capybara::Mechanize::Driver
23
+ #Patch for friendly cookie handling api
36
24
  def cookies
37
25
  cookies = []
38
-
26
+
39
27
  browser.agent.cookie_jar.jar.each do |domain|
40
28
  domain[1].each do |path|
41
29
  path[1].each do |cookie|
@@ -52,11 +40,11 @@ class Capybara::Driver::Mechanize
52
40
  end
53
41
  cookies
54
42
  end
55
-
43
+
56
44
  def cookie_named(name)
57
45
  cookies.find { |c| c[:name] == name }
58
46
  end
59
-
47
+
60
48
  def delete_cookie(cookie_name)
61
49
  browser.agent.cookie_jar.jar.each do |domain|
62
50
  domain[1].each do |path|
@@ -68,13 +56,13 @@ class Capybara::Driver::Mechanize
68
56
  end
69
57
  end
70
58
  end
71
-
59
+
72
60
  def delete_all_cookies
73
61
  browser.agent.cookie_jar.clear!
74
62
  end
75
-
76
- FakeURI = Struct.new(:host)
77
- def add_cookie(attribs)
63
+
64
+ FakeURI = Struct.new(:host)
65
+ def add_cookie(attribs)
78
66
  c = Mechanize::Cookie.new(attribs[:name],attribs[:value])
79
67
  # remember: mechanize always removes leading '.' from domains
80
68
  c.domain = attribs[:domain]
data/lib/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module FrameworksCapybara
2
- VERSION = '0.2.0.rc4'
2
+ VERSION = '0.2.0.rc5'
3
3
  end
4
4
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frameworks-capybara
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424061
4
+ hash: 15424063
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
9
  - 0
10
10
  - rc
11
- - 4
12
- version: 0.2.0.rc4
11
+ - 5
12
+ version: 0.2.0.rc5
13
13
  platform: ruby
14
14
  authors:
15
15
  - matt robbins
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-04-02 00:00:00 +01:00
20
+ date: 2012-04-03 00:00:00 +01:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency