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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0bb57f101309355b205d0f087190e409c7349043
4
- data.tar.gz: c34869197694d2193219db461acf8a3826f2be56
3
+ metadata.gz: 9799738e3d8da056c25cf08f28647b281325c60b
4
+ data.tar.gz: b360d5d1de85945d4a7294c0f8a2f85b67bfb82b
5
5
  SHA512:
6
- metadata.gz: 9fe18b6359945971756bc5063d326d05ca304db97dc2c22e8dae2a106a0258b7854497540cbbf7096f251a6fcef65fd5b9423006ffc48c6872f30dde610cfb0b
7
- data.tar.gz: 9d2bbcfa91fe09d52e9f9e72920319dc85c0f07fa66be7a3bd195487a466ce65ec49549e0ca8b7c0209ca9232b626a43adadc5193966ffcefcad6ceddedf6b68
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
@@ -5,8 +5,7 @@ require 'shellwords'
5
5
  module ProxyRb
6
6
  # Hold proxy credentials
7
7
  class Credentials
8
- attr_reader :user_name
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
@@ -10,7 +10,7 @@ end
10
10
  resource_user
11
11
  http_response_headers
12
12
  ).each do |announcer|
13
- Before "@announce-#{announcer.to_s.gsub(/_/, '-')}" do
13
+ Before "@announce-#{announcer.to_s.tr('_', '-')}" do
14
14
  proxy_rb.announcer.activate(announcer)
15
15
  end
16
16
  end
@@ -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
- Array(proxies.first).each { |proxy| visit url, proxy }
45
+ websites << url
33
46
  end
34
47
 
35
48
  When(/^I visit the following websites:$/) do |table|
36
- @websites = table.hashes.map { |r| r[:url] }
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
- if not_expected
41
- expect(page).not_to have_content content
42
- else
43
- expect(page).to have_content content
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
 
@@ -17,6 +17,10 @@ module ProxyRb
17
17
  def websites
18
18
  @websites ||= []
19
19
  end
20
+
21
+ def users
22
+ @users ||= []
23
+ end
20
24
  end
21
25
  end
22
26
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # Main Module
3
3
  module ProxyRb
4
- VERSION = '0.9.2'
4
+ VERSION = '0.9.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxy_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Meyer