frameworks-capybara 0.0.25 → 0.0.27
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/frameworks-capybara.gemspec +3 -2
- data/lib/frameworks/capybara.rb +2 -1
- data/lib/monkey-patches/capybara-mechanize-patches.rb +29 -0
- metadata +5 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.27
|
data/frameworks-capybara.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{frameworks-capybara}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.27"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["mcrmfc"]
|
12
|
-
s.date = %q{2011-05-
|
12
|
+
s.date = %q{2011-05-09}
|
13
13
|
s.description = %q{gem ti aid setup of Capybara for testing bbc sites}
|
14
14
|
s.email = %q{mcrobbins@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
"lib/frameworks-capybara.rb",
|
29
29
|
"lib/frameworks/capybara.rb",
|
30
30
|
"lib/frameworks/cucumber.rb",
|
31
|
+
"lib/monkey-patches/capybara-mechanize-patches.rb",
|
31
32
|
"lib/monkey-patches/capybara-patches.rb",
|
32
33
|
"lib/monkey-patches/cucumber-patches.rb",
|
33
34
|
"lib/monkey-patches/send-keys.rb",
|
data/lib/frameworks/capybara.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'capybara/cucumber'
|
2
2
|
require 'monkey-patches/webdriver-patches'
|
3
3
|
require 'monkey-patches/capybara-patches'
|
4
|
+
require 'monkey-patches/capybara-mechanize-patches'
|
4
5
|
require 'monkey-patches/send-keys'
|
5
6
|
require 'selenium-webdriver'
|
7
|
+
require 'capybara/mechanize/cucumber'
|
6
8
|
|
7
9
|
class CapybaraSetup
|
8
10
|
|
@@ -114,7 +116,6 @@ class CapybaraSetup
|
|
114
116
|
end
|
115
117
|
|
116
118
|
def register_mechanize_driver (opts)
|
117
|
-
require 'capybara/mechanize/cucumber'
|
118
119
|
Capybara.register_driver :mechanize do |app|
|
119
120
|
opts.delete :browser #delete browser from options as value with be 'headless'
|
120
121
|
Capybara.app_host = "http://www.int.bbc.co.uk"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'capybara/mechanize/cucumber'
|
2
|
+
|
3
|
+
class Capybara::Driver::Mechanize
|
4
|
+
def process_remote_request(method, url, *options)
|
5
|
+
if remote?(url)
|
6
|
+
remote_uri = URI.parse(url)
|
7
|
+
if remote_uri.host.nil?
|
8
|
+
#TODO: Ascertain whether this is really true...
|
9
|
+
if(method == :post && @prev_url) #patch
|
10
|
+
#require 'uri'
|
11
|
+
#url = "http://#{URI.parse(@prev_url).host}#{URI.parse(@prev_url).path}"
|
12
|
+
#p url
|
13
|
+
url = @prev_url #patch
|
14
|
+
else
|
15
|
+
remote_host = @last_remote_host || Capybara.app_host || Capybara.default_host
|
16
|
+
url = File.join(remote_host, url)
|
17
|
+
url = "http://#{url}" unless url.include?("http")
|
18
|
+
end
|
19
|
+
else
|
20
|
+
@last_remote_host = "#{remote_uri.host}:#{remote_uri.port}"
|
21
|
+
end
|
22
|
+
@prev_url = url #patch
|
23
|
+
reset_cache
|
24
|
+
@agent.send *( [method, url] + options)
|
25
|
+
|
26
|
+
@last_request_remote = true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frameworks-capybara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 41
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 27
|
10
|
+
version: 0.0.27
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- mcrmfc
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-09 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/frameworks-capybara.rb
|
128
128
|
- lib/frameworks/capybara.rb
|
129
129
|
- lib/frameworks/cucumber.rb
|
130
|
+
- lib/monkey-patches/capybara-mechanize-patches.rb
|
130
131
|
- lib/monkey-patches/capybara-patches.rb
|
131
132
|
- lib/monkey-patches/cucumber-patches.rb
|
132
133
|
- lib/monkey-patches/send-keys.rb
|