pact 1.42.3 → 1.43.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +10 -0
- data/lib/pact/hal/link.rb +16 -3
- data/lib/pact/pact_broker/fetch_pact_uris_for_verification.rb +14 -15
- data/lib/pact/version.rb +1 -1
- data/pact.gemspec +5 -6
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b644026c464080ef14a4a202bbfe8106f5ece05a
|
4
|
+
data.tar.gz: b0fa73324f51d53bf0d51e1ec5adc1974fc20816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ff57177c9bebdfa42fa14ff4a158f1a44c5eb52602c33b9d606065573fe0461649c271001676405cf09bd4da5e6e0b5a73845e797386a3199fd162a17edef13
|
7
|
+
data.tar.gz: c98d162e93e3c21d32eae05ec850bf2d6c42af63afb400ffa04d2813b2ce8364a91dfe0b6d06f713637d31e5913f62235d2e4dbbbfe1846ac4f2d099fd809d11
|
data/CHANGELOG.md
CHANGED
data/lib/pact/hal/link.rb
CHANGED
@@ -6,6 +6,15 @@ module Pact
|
|
6
6
|
class Link
|
7
7
|
attr_reader :request_method, :href
|
8
8
|
|
9
|
+
DEFAULT_GET_HEADERS = {
|
10
|
+
"Accept" => "application/hal+json"
|
11
|
+
}.freeze
|
12
|
+
|
13
|
+
DEFAULT_POST_HEADERS = {
|
14
|
+
"Accept" => "application/hal+json",
|
15
|
+
"Content-Type" => "application/json"
|
16
|
+
}.freeze
|
17
|
+
|
9
18
|
def initialize(attrs, http_client)
|
10
19
|
@attrs = attrs
|
11
20
|
@request_method = attrs.fetch(:method, :get).to_sym
|
@@ -37,7 +46,7 @@ module Pact
|
|
37
46
|
end
|
38
47
|
|
39
48
|
def get(payload = {}, headers = {})
|
40
|
-
wrap_response(href, @http_client.get(href, payload, headers))
|
49
|
+
wrap_response(href, @http_client.get(href, payload, DEFAULT_GET_HEADERS.merge(headers)))
|
41
50
|
end
|
42
51
|
|
43
52
|
def get!(*args)
|
@@ -45,11 +54,15 @@ module Pact
|
|
45
54
|
end
|
46
55
|
|
47
56
|
def put(payload = nil, headers = {})
|
48
|
-
wrap_response(href, @http_client.put(href, payload ? payload.to_json : nil, headers))
|
57
|
+
wrap_response(href, @http_client.put(href, payload ? payload.to_json : nil, DEFAULT_POST_HEADERS.merge(headers)))
|
49
58
|
end
|
50
59
|
|
51
60
|
def post(payload = nil, headers = {})
|
52
|
-
wrap_response(href, @http_client.post(href, payload ? payload.to_json : nil, headers))
|
61
|
+
wrap_response(href, @http_client.post(href, payload ? payload.to_json : nil, DEFAULT_POST_HEADERS.merge(headers)))
|
62
|
+
end
|
63
|
+
|
64
|
+
def post!(payload = nil, headers = {})
|
65
|
+
post(payload, headers).assert_success!
|
53
66
|
end
|
54
67
|
|
55
68
|
def expand(params)
|
@@ -7,7 +7,7 @@ require 'pact/pact_broker/fetch_pacts'
|
|
7
7
|
module Pact
|
8
8
|
module PactBroker
|
9
9
|
class FetchPactURIsForVerification
|
10
|
-
attr_reader :provider, :consumer_version_selectors, :provider_version_tags, :broker_base_url, :http_client_options, :http_client
|
10
|
+
attr_reader :provider, :consumer_version_selectors, :provider_version_tags, :broker_base_url, :http_client_options, :http_client, :options
|
11
11
|
|
12
12
|
PACTS_FOR_VERIFICATION_RELATION = 'beta:provider-pacts-for-verification'.freeze
|
13
13
|
PACTS = 'pacts'.freeze
|
@@ -16,17 +16,18 @@ module Pact
|
|
16
16
|
SELF = 'self'.freeze
|
17
17
|
EMBEDDED = '_embedded'.freeze
|
18
18
|
|
19
|
-
def initialize(provider, consumer_version_selectors, provider_version_tags, broker_base_url, http_client_options)
|
19
|
+
def initialize(provider, consumer_version_selectors, provider_version_tags, broker_base_url, http_client_options, options = {})
|
20
20
|
@provider = provider
|
21
21
|
@consumer_version_selectors = consumer_version_selectors || []
|
22
22
|
@provider_version_tags = provider_version_tags || []
|
23
23
|
@http_client_options = http_client_options
|
24
24
|
@broker_base_url = broker_base_url
|
25
25
|
@http_client = Pact::Hal::HttpClient.new(http_client_options)
|
26
|
+
@options = options
|
26
27
|
end
|
27
28
|
|
28
|
-
def self.call(provider, consumer_version_selectors, provider_version_tags, broker_base_url, http_client_options)
|
29
|
-
new(provider, consumer_version_selectors, provider_version_tags, broker_base_url, http_client_options).call
|
29
|
+
def self.call(provider, consumer_version_selectors, provider_version_tags, broker_base_url, http_client_options, options = {})
|
30
|
+
new(provider, consumer_version_selectors, provider_version_tags, broker_base_url, http_client_options, options).call
|
30
31
|
end
|
31
32
|
|
32
33
|
def call
|
@@ -50,8 +51,7 @@ module Pact
|
|
50
51
|
pacts_for_verification_entity.response.body[EMBEDDED][PACTS].collect do | pact |
|
51
52
|
metadata = {
|
52
53
|
pending: pact["verificationProperties"]["pending"],
|
53
|
-
|
54
|
-
inclusion_reason: pact["verificationProperties"]["inclusionReason"],
|
54
|
+
notices: extract_notices(pact)
|
55
55
|
}
|
56
56
|
Pact::Provider::PactURI.new(pact[LINKS][SELF][HREF], http_client_options, metadata)
|
57
57
|
end
|
@@ -61,22 +61,21 @@ module Pact
|
|
61
61
|
index
|
62
62
|
._link(PACTS_FOR_VERIFICATION_RELATION)
|
63
63
|
.expand(provider: provider)
|
64
|
-
.
|
65
|
-
.get!
|
64
|
+
.post!(query)
|
66
65
|
end
|
67
66
|
|
68
67
|
def query
|
69
68
|
q = {}
|
70
|
-
if
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
if provider_version_tags.any?
|
75
|
-
q["provider_version_tags"] = provider_version_tags
|
76
|
-
end
|
69
|
+
q["includePendingStatus"] = true if options[:include_pending_status]
|
70
|
+
q["consumerVersionSelectors"] = consumer_version_selectors if consumer_version_selectors.any?
|
71
|
+
q["providerVersionTags"] = provider_version_tags if provider_version_tags.any?
|
77
72
|
q
|
78
73
|
end
|
79
74
|
|
75
|
+
def extract_notices(pact)
|
76
|
+
(pact["verificationProperties"]["notices"] || []).collect{ |notice| notice["text"] }.compact
|
77
|
+
end
|
78
|
+
|
80
79
|
def log_message
|
81
80
|
latest = consumer_version_selectors.any? ? "" : "latest "
|
82
81
|
message = "INFO: Fetching #{latest}pacts for #{provider} from #{broker_base_url}"
|
data/lib/pact/version.rb
CHANGED
data/pact.gemspec
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'pact/version'
|
5
4
|
|
@@ -15,21 +14,21 @@ Gem::Specification.new do |gem|
|
|
15
14
|
gem.required_ruby_version = '>= 2.0'
|
16
15
|
|
17
16
|
gem.files = `git ls-files bin lib pact.gemspec CHANGELOG.md LICENSE.txt`.split($/)
|
18
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
19
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
20
19
|
gem.require_paths = ["lib"]
|
21
20
|
gem.license = 'MIT'
|
22
21
|
|
23
22
|
gem.metadata = {
|
23
|
+
'changelog_uri' => 'https://github.com/pact-foundation/pact-ruby/blob/master/CHANGELOG.md',
|
24
24
|
'source_code_uri' => 'https://github.com/pact-foundation/pact-ruby',
|
25
25
|
'bug_tracker_uri' => 'https://github.com/pact-foundation/pact-ruby/issues',
|
26
26
|
'documentation_uri' => 'https://github.com/pact-foundation/pact-ruby/blob/master/README.md'
|
27
27
|
}
|
28
28
|
|
29
|
-
gem.add_runtime_dependency 'rspec', '>=2.14'
|
29
|
+
gem.add_runtime_dependency 'rspec', '>= 2.14'
|
30
30
|
gem.add_runtime_dependency 'rack-test', '>= 0.6.3', '< 2.0.0'
|
31
31
|
gem.add_runtime_dependency 'thor'
|
32
|
-
gem.add_runtime_dependency 'json','> 1.8.5'
|
33
32
|
gem.add_runtime_dependency 'webrick'
|
34
33
|
gem.add_runtime_dependency 'term-ansicolor', '~> 1.0'
|
35
34
|
|
@@ -38,7 +37,7 @@ Gem::Specification.new do |gem|
|
|
38
37
|
|
39
38
|
gem.add_development_dependency 'rake', '~> 10.0.3'
|
40
39
|
gem.add_development_dependency 'webmock', '~> 3.0'
|
41
|
-
|
40
|
+
gem.add_development_dependency 'pry-byebug'
|
42
41
|
gem.add_development_dependency 'fakefs', '0.5' # 0.6.0 blows up
|
43
42
|
gem.add_development_dependency 'hashie', '~> 2.0'
|
44
43
|
gem.add_development_dependency 'activesupport'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.43.0
|
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:
|
15
|
+
date: 2020-01-11 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rspec
|
@@ -62,20 +62,6 @@ dependencies:
|
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: json
|
67
|
-
requirement: !ruby/object:Gem::Requirement
|
68
|
-
requirements:
|
69
|
-
- - ">"
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: 1.8.5
|
72
|
-
type: :runtime
|
73
|
-
prerelease: false
|
74
|
-
version_requirements: !ruby/object:Gem::Requirement
|
75
|
-
requirements:
|
76
|
-
- - ">"
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: 1.8.5
|
79
65
|
- !ruby/object:Gem::Dependency
|
80
66
|
name: webrick
|
81
67
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,6 +146,20 @@ dependencies:
|
|
160
146
|
- - "~>"
|
161
147
|
- !ruby/object:Gem::Version
|
162
148
|
version: '3.0'
|
149
|
+
- !ruby/object:Gem::Dependency
|
150
|
+
name: pry-byebug
|
151
|
+
requirement: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
type: :development
|
157
|
+
prerelease: false
|
158
|
+
version_requirements: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
163
|
- !ruby/object:Gem::Dependency
|
164
164
|
name: fakefs
|
165
165
|
requirement: !ruby/object:Gem::Requirement
|
@@ -367,6 +367,7 @@ homepage: https://github.com/pact-foundation/pact-ruby
|
|
367
367
|
licenses:
|
368
368
|
- MIT
|
369
369
|
metadata:
|
370
|
+
changelog_uri: https://github.com/pact-foundation/pact-ruby/blob/master/CHANGELOG.md
|
370
371
|
source_code_uri: https://github.com/pact-foundation/pact-ruby
|
371
372
|
bug_tracker_uri: https://github.com/pact-foundation/pact-ruby/issues
|
372
373
|
documentation_uri: https://github.com/pact-foundation/pact-ruby/blob/master/README.md
|
@@ -386,7 +387,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
386
387
|
version: '0'
|
387
388
|
requirements: []
|
388
389
|
rubyforge_project:
|
389
|
-
rubygems_version: 2.
|
390
|
+
rubygems_version: 2.6.14.3
|
390
391
|
signing_key:
|
391
392
|
specification_version: 4
|
392
393
|
summary: Enables consumer driven contract testing, providing a mock service and DSL
|