frameworks-capybara 0.2.16 → 0.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/frameworks/cucumber.rb +23 -17
- data/lib/version.rb +1 -1
- data/spec/frameworks_cucumber_spec.rb +18 -0
- metadata +22 -22
data/Gemfile.lock
CHANGED
data/lib/frameworks/cucumber.rb
CHANGED
@@ -49,7 +49,7 @@ module Frameworks
|
|
49
49
|
end
|
50
50
|
|
51
51
|
proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
|
52
|
-
@proxy_host = proxy.scan(/http:\/\/(.*):80/)[0][0] if proxy
|
52
|
+
@proxy_host = proxy.scan(/http:\/\/(.*):80/)[0][0] if proxy && !proxy.empty?
|
53
53
|
end
|
54
54
|
|
55
55
|
def validate_online(src)
|
@@ -89,6 +89,27 @@ module Frameworks
|
|
89
89
|
@static_sandbox = "#{scheme}://static.sandbox.dev"
|
90
90
|
end
|
91
91
|
|
92
|
+
def setup_mechanize(agent, http_proxy=nil)
|
93
|
+
http_proxy = http_proxy || ENV['HTTP_PROXY'] || ENV['http_proxy']
|
94
|
+
|
95
|
+
if ENV['FW_CERT_LOCATION']
|
96
|
+
agent.cert, agent.key = ENV['FW_CERT_LOCATION'], ENV['FW_CERT_LOCATION']
|
97
|
+
end
|
98
|
+
|
99
|
+
agent.ca_file = ENV['CA_CERT_LOCATION'] if ENV['CA_CERT_LOCATION']
|
100
|
+
agent.set_proxy(http_proxy.scan(/http:\/\/(.*):80/)[0][0].to_s,80) if http_proxy && !http_proxy.empty?
|
101
|
+
|
102
|
+
#This is necessary because Mech2 does not ship with root certs like Mech1 did and boxes may not have the OpenSSL set installed
|
103
|
+
agent.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
104
|
+
end
|
105
|
+
|
106
|
+
def new_mechanize(http_proxy=nil)
|
107
|
+
require 'mechanize'
|
108
|
+
agent = Mechanize.new
|
109
|
+
setup_mechanize(agent, http_proxy)
|
110
|
+
agent
|
111
|
+
end
|
112
|
+
|
92
113
|
end #EnvHelper
|
93
114
|
end #Frameworks
|
94
115
|
|
@@ -100,22 +121,7 @@ World(Frameworks::EnvHelper)
|
|
100
121
|
Before do
|
101
122
|
#This is ugly but unavoidable since Capybara::RackTest::Driver.reset_host! does @browser = nil and wipes all brower level settings
|
102
123
|
#it was either this or a monkey patch - need to think about pushing a softer reset change to capybara-mechanize to override this
|
103
|
-
|
104
|
-
if page.driver.class == Capybara::Mechanize::Driver
|
105
|
-
|
106
|
-
if ENV['FW_CERT_LOCATION']
|
107
|
-
page.driver.browser.agent.cert, page.driver.browser.agent.key =
|
108
|
-
ENV['FW_CERT_LOCATION'],
|
109
|
-
ENV['FW_CERT_LOCATION']
|
110
|
-
end
|
111
|
-
|
112
|
-
page.driver.browser.agent.ca_file = ENV['CA_CERT_LOCATION'] if ENV['CA_CERT_LOCATION']
|
113
|
-
|
114
|
-
page.driver.browser.agent.set_proxy(http_proxy.scan(/http:\/\/(.*):80/).to_s,80) if http_proxy
|
115
|
-
|
116
|
-
#This is necessary because Mech2 does not ship with root certs like Mech1 did and boxes may not have the OpenSSL set installed
|
117
|
-
page.driver.browser.agent.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
118
|
-
end
|
124
|
+
setup_mechanize(page.driver.browser.agent) if page.driver.class == Capybara::Mechanize::Driver
|
119
125
|
|
120
126
|
generate_base_urls
|
121
127
|
end
|
data/lib/version.rb
CHANGED
@@ -136,5 +136,23 @@ describe Frameworks::EnvHelper do
|
|
136
136
|
validate_online(xhtml)
|
137
137
|
end
|
138
138
|
=end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe "independent mechanize agent" do
|
142
|
+
include Frameworks::EnvHelper
|
143
|
+
|
144
|
+
it "should allow you to create an independent, configured mechanize object" do
|
145
|
+
ENV['HTTP_PROXY'] = 'http://mycache.co.uk:80'
|
146
|
+
agent = new_mechanize
|
147
|
+
agent.should be_a_kind_of Mechanize
|
148
|
+
agent.proxy_addr.should == 'mycache.co.uk'
|
149
|
+
end
|
150
|
+
|
151
|
+
it "the proxy should be separately configurable" do
|
152
|
+
agent = new_mechanize(http_proxy='http://mycache.co.uk:80')
|
153
|
+
agent.should be_a_kind_of Mechanize
|
154
|
+
agent.proxy_addr.should == 'mycache.co.uk'
|
155
|
+
end
|
156
|
+
|
139
157
|
end
|
140
158
|
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: 53
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 17
|
10
|
+
version: 0.2.17
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- matt robbins
|
@@ -15,11 +15,10 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-07-
|
18
|
+
date: 2012-07-26 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
type: :runtime
|
23
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
23
|
none: false
|
25
24
|
requirements:
|
@@ -31,11 +30,11 @@ dependencies:
|
|
31
30
|
- 0
|
32
31
|
- 0
|
33
32
|
version: 1.0.0
|
34
|
-
name: capybara
|
35
33
|
version_requirements: *id001
|
36
34
|
prerelease: false
|
37
|
-
|
35
|
+
name: capybara
|
38
36
|
type: :runtime
|
37
|
+
- !ruby/object:Gem::Dependency
|
39
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
40
|
requirements:
|
@@ -47,11 +46,11 @@ dependencies:
|
|
47
46
|
- 3
|
48
47
|
- 0
|
49
48
|
version: 0.3.0
|
50
|
-
name: capybara-mechanize
|
51
49
|
version_requirements: *id002
|
52
50
|
prerelease: false
|
53
|
-
|
51
|
+
name: capybara-mechanize
|
54
52
|
type: :runtime
|
53
|
+
- !ruby/object:Gem::Dependency
|
55
54
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
55
|
none: false
|
57
56
|
requirements:
|
@@ -61,11 +60,11 @@ dependencies:
|
|
61
60
|
segments:
|
62
61
|
- 0
|
63
62
|
version: "0"
|
64
|
-
name: json
|
65
63
|
version_requirements: *id003
|
66
64
|
prerelease: false
|
67
|
-
|
65
|
+
name: json
|
68
66
|
type: :runtime
|
67
|
+
- !ruby/object:Gem::Dependency
|
69
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
70
69
|
none: false
|
71
70
|
requirements:
|
@@ -75,11 +74,11 @@ dependencies:
|
|
75
74
|
segments:
|
76
75
|
- 0
|
77
76
|
version: "0"
|
78
|
-
name: headless
|
79
77
|
version_requirements: *id004
|
80
78
|
prerelease: false
|
81
|
-
|
79
|
+
name: headless
|
82
80
|
type: :runtime
|
81
|
+
- !ruby/object:Gem::Dependency
|
83
82
|
requirement: &id005 !ruby/object:Gem::Requirement
|
84
83
|
none: false
|
85
84
|
requirements:
|
@@ -89,11 +88,11 @@ dependencies:
|
|
89
88
|
segments:
|
90
89
|
- 0
|
91
90
|
version: "0"
|
92
|
-
name: capybara-celerity
|
93
91
|
version_requirements: *id005
|
94
92
|
prerelease: false
|
95
|
-
|
93
|
+
name: capybara-celerity
|
96
94
|
type: :runtime
|
95
|
+
- !ruby/object:Gem::Dependency
|
97
96
|
requirement: &id006 !ruby/object:Gem::Requirement
|
98
97
|
none: false
|
99
98
|
requirements:
|
@@ -103,11 +102,11 @@ dependencies:
|
|
103
102
|
segments:
|
104
103
|
- 0
|
105
104
|
version: "0"
|
106
|
-
name: w3c_validators
|
107
105
|
version_requirements: *id006
|
108
106
|
prerelease: false
|
109
|
-
|
107
|
+
name: w3c_validators
|
110
108
|
type: :runtime
|
109
|
+
- !ruby/object:Gem::Dependency
|
111
110
|
requirement: &id007 !ruby/object:Gem::Requirement
|
112
111
|
none: false
|
113
112
|
requirements:
|
@@ -119,11 +118,11 @@ dependencies:
|
|
119
118
|
- 10
|
120
119
|
- 5
|
121
120
|
version: 0.10.5
|
122
|
-
name: cucumber
|
123
121
|
version_requirements: *id007
|
124
122
|
prerelease: false
|
123
|
+
name: cucumber
|
124
|
+
type: :runtime
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
type: :development
|
127
126
|
requirement: &id008 !ruby/object:Gem::Requirement
|
128
127
|
none: false
|
129
128
|
requirements:
|
@@ -133,11 +132,11 @@ dependencies:
|
|
133
132
|
segments:
|
134
133
|
- 0
|
135
134
|
version: "0"
|
136
|
-
name: rake
|
137
135
|
version_requirements: *id008
|
138
136
|
prerelease: false
|
139
|
-
|
137
|
+
name: rake
|
140
138
|
type: :development
|
139
|
+
- !ruby/object:Gem::Dependency
|
141
140
|
requirement: &id009 !ruby/object:Gem::Requirement
|
142
141
|
none: false
|
143
142
|
requirements:
|
@@ -149,9 +148,10 @@ dependencies:
|
|
149
148
|
- 0
|
150
149
|
- 0
|
151
150
|
version: 1.0.0
|
152
|
-
name: rspec
|
153
151
|
version_requirements: *id009
|
154
152
|
prerelease: false
|
153
|
+
name: rspec
|
154
|
+
type: :development
|
155
155
|
description: Gem to ease the pain of managing capybara driver config and provide a home for common utils and patches
|
156
156
|
email:
|
157
157
|
- mcrobbins@gmail.com
|