proxy_rb 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +6 -0
- data/README.md +7 -0
- data/lib/proxy_rb/credentials.rb +1 -2
- data/lib/proxy_rb/cucumber/hooks.rb +1 -1
- data/lib/proxy_rb/cucumber/steps.rb +24 -7
- data/lib/proxy_rb/cucumber.rb +4 -0
- data/lib/proxy_rb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9799738e3d8da056c25cf08f28647b281325c60b
|
4
|
+
data.tar.gz: b360d5d1de85945d4a7294c0f8a2f85b67bfb82b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e8d66e348e805b72dca73bed0e8fe03dda126140440a733777411823d18e78f781fb3176bdce419f0b1458b9031968d4928437579d3aecf5cf962a399c06fd2
|
7
|
+
data.tar.gz: caaa78ed74e2ea1ce33cc3d9c8431717c64483463c335555fe8526cb4900b82e3dc4f36bbc49d8c34972b7af33d037f6586b254ac8476a4cf6dfd38d7eadfe34
|
data/History.md
CHANGED
@@ -4,6 +4,12 @@ Empty
|
|
4
4
|
|
5
5
|
# RELEASED
|
6
6
|
|
7
|
+
## [v0.9.3](https://github.com/fedux-org/proxy_rb/compare/v0.9.2...v0.9.3)
|
8
|
+
|
9
|
+
* Added best practises for usage of cucumber steps
|
10
|
+
* Refactored steps to make it possible to check for body in proxy
|
11
|
+
* Added step to set user directly - required for best practises
|
12
|
+
|
7
13
|
## [v0.9.2](https://github.com/fedux-org/proxy_rb/compare/v0.9.1...v0.9.2)
|
8
14
|
|
9
15
|
* Fixed proxy authentication for cucumber steps
|
data/README.md
CHANGED
@@ -110,6 +110,13 @@ require 'proxy_rb/cucumber'
|
|
110
110
|
|
111
111
|
Create a file named `features/result.feature`.
|
112
112
|
|
113
|
+
Those steps given by `proxy_rb` are considered to be used as low level steps
|
114
|
+
which are called from more appropriate high level steps describing uses cases.
|
115
|
+
Using them directly is more like unit testing. Please see
|
116
|
+
[features/best_practises.feature](features/best_practises.feature] for some
|
117
|
+
more examples.
|
118
|
+
|
119
|
+
|
113
120
|
~~~ruby
|
114
121
|
Feature: Test the result code of a request
|
115
122
|
Scenario: Request is allowed
|
data/lib/proxy_rb/credentials.rb
CHANGED
@@ -5,8 +5,7 @@ require 'shellwords'
|
|
5
5
|
module ProxyRb
|
6
6
|
# Hold proxy credentials
|
7
7
|
class Credentials
|
8
|
-
|
9
|
-
attr_accessor :password
|
8
|
+
attr_accessor :user_name, :password
|
10
9
|
|
11
10
|
# @param [String] user_name
|
12
11
|
# The user name to use for authentication against proxy
|
@@ -2,11 +2,24 @@
|
|
2
2
|
require 'proxy_rb/http_proxy'
|
3
3
|
require 'proxy_rb/proxy_url_parser'
|
4
4
|
|
5
|
+
Given(/^I use the user "([^"]*)" with password "([^"]*)"$/) do |user_name, password|
|
6
|
+
u = OpenStruct.new
|
7
|
+
u.name = user_name
|
8
|
+
u.password = password
|
9
|
+
|
10
|
+
users << u
|
11
|
+
end
|
12
|
+
|
5
13
|
Given(/^I use the following proxies:$/) do |table|
|
6
14
|
@proxies = table.hashes.map do |r|
|
7
|
-
p = ProxyRb::HttpProxy.new(ProxyRb::ProxyUrlParser.new(r[:proxy]))
|
15
|
+
p = ProxyRb::HttpProxy.new(ProxyRb::ProxyUrlParser.new(r[:proxy]))
|
8
16
|
p.credentials.password = password(p.credentials.user_name) if p.credentials.password == '<PASSWORD>'
|
9
17
|
|
18
|
+
unless users.nil? || users.empty?
|
19
|
+
p.credentials.user_name = users.first.name
|
20
|
+
p.credentials.password = users.first.password
|
21
|
+
end
|
22
|
+
|
10
23
|
p
|
11
24
|
end
|
12
25
|
end
|
@@ -29,18 +42,22 @@ Then(/the following requests are( not)? allowed to pass the proxy:/) do |forbidd
|
|
29
42
|
end
|
30
43
|
|
31
44
|
When(/^I visit "([^"]*)"$/) do |url|
|
32
|
-
|
45
|
+
websites << url
|
33
46
|
end
|
34
47
|
|
35
48
|
When(/^I visit the following websites:$/) do |table|
|
36
|
-
|
49
|
+
websites.concat table.hashes.map { |r| r[:url] }
|
37
50
|
end
|
38
51
|
|
39
52
|
Then(/the (?:last response|last requested page) should( not)? contain:/) do |not_expected, content|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
53
|
+
proxies.each do |proxy|
|
54
|
+
visit websites.last, proxy
|
55
|
+
|
56
|
+
if not_expected
|
57
|
+
expect(page).not_to have_content content
|
58
|
+
else
|
59
|
+
expect(page).to have_content content
|
60
|
+
end
|
44
61
|
end
|
45
62
|
end
|
46
63
|
|
data/lib/proxy_rb/cucumber.rb
CHANGED
data/lib/proxy_rb/version.rb
CHANGED