pact-support 1.6.1 → 1.6.2

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: 4c584f8dad000c655b33004fe1fc0f2d1a264fe1
4
- data.tar.gz: 06ac6740417e58b3d004dd3e837af2921c5d9b21
3
+ metadata.gz: 7052ae315f37af6ae3f7ea9d1996f8cbb12ea7d0
4
+ data.tar.gz: 648fff2d0659c82cca19046f1c5440f86e9cf2ab
5
5
  SHA512:
6
- metadata.gz: 1d01444d16e4310290bada8fd89a93ac87d6d5ac52b882afebaa5a12e6e4f416d76246defcdf9a15e9defdbdd9b3e8d445e2bd1acc0e23df976d2c30658af259
7
- data.tar.gz: 3663da705c0bf5faffc385f6ba266b2b299b2b159b826b54358e2f567ca97071ab3c73fba4a189bdf29d256f3fb4ca82a983f42abde59c95c42cbac0ad0147f6
6
+ metadata.gz: 9c2f5d2b7f6c792582eeaf03a70446aff2c3d67395a4b6448c11fbd6a38e9fbb6538f0b206b1cf297b923cbc7c0d977854160d412f6e0b540f36bae250f8e420
7
+ data.tar.gz: 516d17b3b6c5b8590b264d934334dcdd6c8360e19a9581390f8e6353f17407ca098d63bedf35f213615e1076214d743eb03196063e7166fe56bb781698af1a77
@@ -1,3 +1,13 @@
1
+ <a name="v1.6.2"></a>
2
+ ### v1.6.2 (2018-05-31)
3
+
4
+
5
+ #### Bug Fixes
6
+
7
+ * **windows-path**
8
+ * prevent locale file paths to be parsed by URI to stop errors in windows paths like spaces in paths ([ecf64d6](/../../commit/ecf64d6))
9
+
10
+
1
11
  <a name="v1.6.1"></a>
2
12
  ### v1.6.1 (2018-05-21)
3
13
 
@@ -36,39 +36,25 @@ module Pact
36
36
  end
37
37
 
38
38
  def render_pact(uri_string, options)
39
- uri_obj = URI(windows_safe(uri_string))
40
- if uri_obj.userinfo
41
- options[:username] = uri_obj.user unless options[:username]
42
- options[:password] = uri_obj.password unless options[:password]
43
- end
44
- get(uri_obj, options)
39
+ local?(uri_string) ? get_local(uri_string, options) : get_remote_with_retry(uri_string, options)
45
40
  end
46
41
 
47
42
  private
48
-
49
- def get(uri, options)
50
- local?(uri) ? get_local(uri, options) : get_remote_with_retry(uri, options)
51
- end
52
-
43
+
53
44
  def local? uri
54
- !uri.host
45
+ !uri.start_with?("http://", "https://")
55
46
  end
56
47
 
57
- def get_local(uri, _)
58
- File.read uri.to_s
48
+ def get_local(filepath, _)
49
+ File.read windows_safe(filepath)
59
50
  end
60
51
 
61
- def get_remote(uri, options)
62
- request = Net::HTTP::Get.new(uri)
63
- request.basic_auth(options[:username], options[:password]) if options[:username]
64
- Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
65
- http.open_timeout = options[:open_timeout] || OPEN_TIMEOUT
66
- http.read_timeout = options[:read_timeout] || READ_TIMEOUT
67
- http.request(request)
68
- end
69
- end
70
-
71
- def get_remote_with_retry(uri, options)
52
+ def get_remote_with_retry(uri_string, options)
53
+ uri = URI(uri_string)
54
+ if uri.userinfo
55
+ options[:username] = uri.user unless options[:username]
56
+ options[:password] = uri.password unless options[:password]
57
+ end
72
58
  ((options[:retry_limit] || RETRY_LIMIT) + 1).times do |i|
73
59
  begin
74
60
  response = get_remote(uri, options)
@@ -88,6 +74,16 @@ module Pact
88
74
  end
89
75
  end
90
76
  end
77
+
78
+ def get_remote(uri, options)
79
+ request = Net::HTTP::Get.new(uri)
80
+ request.basic_auth(options[:username], options[:password]) if options[:username]
81
+ Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
82
+ http.open_timeout = options[:open_timeout] || OPEN_TIMEOUT
83
+ http.read_timeout = options[:read_timeout] || READ_TIMEOUT
84
+ http.request(request)
85
+ end
86
+ end
91
87
 
92
88
  def success?(response)
93
89
  response.code.to_i == 200
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module Support
3
- VERSION = "1.6.1"
3
+ VERSION = "1.6.2"
4
4
  end
5
5
  end
@@ -16,7 +16,7 @@ module Pact
16
16
  subject { MatchingRules.merge(object, rules, options)}
17
17
 
18
18
  context "when the pact_specification_version is nil" do
19
- let(:pact_specification_version) { nil }
19
+ let(:options) { { pact_specification_version: nil } }
20
20
 
21
21
  it "calls Merge" do
22
22
  expect(Merge).to receive(:call)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Fraser
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2018-05-21 00:00:00.000000000 Z
15
+ date: 2018-05-31 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: randexp