pact 1.48.0 → 1.50.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +46 -0
- data/lib/pact/cli/run_pact_verification.rb +3 -1
- data/lib/pact/consumer/consumer_contract_builder.rb +4 -0
- data/lib/pact/consumer/interaction_builder.rb +6 -0
- data/lib/pact/pact_broker/fetch_pact_uris_for_verification.rb +3 -12
- data/lib/pact/pact_broker/pact_selection_description.rb +24 -0
- data/lib/pact/provider/pact_uri.rb +2 -2
- data/lib/pact/provider/rspec/json_formatter.rb +7 -5
- data/lib/pact/provider/test_methods.rb +3 -1
- data/lib/pact/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72dbb710ec5471bb551465a8f55342f32cc057cb2a6d36a7f1b4ec613e90fb19
|
4
|
+
data.tar.gz: b0c3329c670d4704517df5eeb79b4cbb8d874c2a52151851009a211d3ab89d36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a4fed394938fb5ad9489f79df8b06589d5982cc289cf45fd0c8a5056a23b875b48be9efb3b082e34477935ffbc7b7416a1de5daa9183bf9c2dbd20ba548f503
|
7
|
+
data.tar.gz: b8b501317bb1e1446d1776c7c3d9e5674632475cae4cbd4a5e38f726c374463a23000f95760e432c48cc3cee46fd74dbff17dae6226d5f614f4972f4938a2df2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,49 @@
|
|
1
|
+
<a name="v1.50.0"></a>
|
2
|
+
### v1.50.0 (2020-04-25)
|
3
|
+
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Set expected interactions on mock service but without writing them to pact file (#210) ([14f5327](/../../commit/14f5327))
|
8
|
+
|
9
|
+
|
10
|
+
<a name="v1.49.3"></a>
|
11
|
+
### v1.49.3 (2020-04-22)
|
12
|
+
|
13
|
+
|
14
|
+
#### Bug Fixes
|
15
|
+
|
16
|
+
* pact selection verification options logging ([9ff59f4](/../../commit/9ff59f4))
|
17
|
+
|
18
|
+
|
19
|
+
<a name="v1.49.2"></a>
|
20
|
+
### v1.49.2 (2020-04-08)
|
21
|
+
|
22
|
+
|
23
|
+
#### Bug Fixes
|
24
|
+
|
25
|
+
* json parser error for top level JSON values ([dafbc35](/../../commit/dafbc35))
|
26
|
+
|
27
|
+
|
28
|
+
<a name="v1.49.1"></a>
|
29
|
+
### v1.49.1 (2020-03-21)
|
30
|
+
|
31
|
+
|
32
|
+
#### Bug Fixes
|
33
|
+
|
34
|
+
* ensure diff is included in the json output ([0bd9753](/../../commit/0bd9753))
|
35
|
+
* ensure the presence of basic auth credentials does not cause an error when displaying the path of a pact on the local filesystem ([f6a0b4d](/../../commit/f6a0b4d))
|
36
|
+
|
37
|
+
|
38
|
+
<a name="v1.49.0"></a>
|
39
|
+
### v1.49.0 (2020-02-18)
|
40
|
+
|
41
|
+
|
42
|
+
#### Features
|
43
|
+
|
44
|
+
* use environment variables PACT_BROKER_USERNAME and PACT_BROKER_PASSWORD when verifying a pact by URL, if the environment variables are present ([308f25d](/../../commit/308f25d))
|
45
|
+
|
46
|
+
|
1
47
|
<a name="v1.48.0"></a>
|
2
48
|
### v1.48.0 (2020-02-13)
|
3
49
|
|
@@ -56,9 +56,11 @@ module Pact
|
|
56
56
|
|
57
57
|
def run_with_pact_url_string
|
58
58
|
pact_repository_uri_options = {}
|
59
|
+
pact_repository_uri_options[:username] = ENV['PACT_BROKER_USERNAME'] if ENV['PACT_BROKER_USERNAME']
|
60
|
+
pact_repository_uri_options[:password] = ENV['PACT_BROKER_PASSWORD'] if ENV['PACT_BROKER_PASSWORD']
|
61
|
+
pact_repository_uri_options[:token] = ENV['PACT_BROKER_TOKEN']
|
59
62
|
pact_repository_uri_options[:username] = options[:pact_broker_username] if options[:pact_broker_username]
|
60
63
|
pact_repository_uri_options[:password] = options[:pact_broker_password] if options[:pact_broker_password]
|
61
|
-
pact_repository_uri_options[:token] = ENV['PACT_BROKER_TOKEN']
|
62
64
|
pact_uri = ::Pact::Provider::PactURI.new(options[:pact_uri], pact_repository_uri_options)
|
63
65
|
Pact::Provider::PactSpecRunner.new([pact_uri], pact_spec_options).run
|
64
66
|
end
|
@@ -25,6 +25,10 @@ module Pact
|
|
25
25
|
@mock_service_base_url = "http://#{attributes[:host]}:#{attributes[:port]}"
|
26
26
|
end
|
27
27
|
|
28
|
+
def without_writing_to_pact
|
29
|
+
interaction_builder.without_writing_to_pact
|
30
|
+
end
|
31
|
+
|
28
32
|
def given(provider_state)
|
29
33
|
interaction_builder.given(provider_state)
|
30
34
|
end
|
@@ -13,6 +13,12 @@ module Pact
|
|
13
13
|
@callback = block
|
14
14
|
end
|
15
15
|
|
16
|
+
def without_writing_to_pact
|
17
|
+
interaction.metadata ||= {}
|
18
|
+
interaction.metadata[:write_to_pact] = false
|
19
|
+
self
|
20
|
+
end
|
21
|
+
|
16
22
|
def upon_receiving description
|
17
23
|
@interaction.description = description
|
18
24
|
self
|
@@ -4,10 +4,12 @@ require 'pact/provider/pact_uri'
|
|
4
4
|
require 'pact/errors'
|
5
5
|
require 'pact/pact_broker/fetch_pacts'
|
6
6
|
require 'pact/pact_broker/notices'
|
7
|
+
require 'pact/pact_broker/pact_selection_description'
|
7
8
|
|
8
9
|
module Pact
|
9
10
|
module PactBroker
|
10
11
|
class FetchPactURIsForVerification
|
12
|
+
include PactSelectionDescription
|
11
13
|
attr_reader :provider, :consumer_version_selectors, :provider_version_tags, :broker_base_url, :http_client_options, :http_client, :options
|
12
14
|
|
13
15
|
PACTS_FOR_VERIFICATION_RELATION = 'beta:provider-pacts-for-verification'.freeze
|
@@ -84,18 +86,7 @@ module Pact
|
|
84
86
|
end
|
85
87
|
|
86
88
|
def log_message
|
87
|
-
|
88
|
-
message = "INFO: Fetching pacts for #{provider} from #{broker_base_url} with the selection criteria: "
|
89
|
-
if consumer_version_selectors.any?
|
90
|
-
desc = consumer_version_selectors.collect do |selector|
|
91
|
-
all_or_latest = selector[:all] ? "all for tag" : "latest for tag"
|
92
|
-
# TODO support fallback
|
93
|
-
name = selector[:fallback] ? "#{selector[:tag]} (or #{selector[:fallback]} if not found)" : selector[:tag]
|
94
|
-
"#{all_or_latest} #{name}"
|
95
|
-
end.join(", ")
|
96
|
-
message << ": #{desc}"
|
97
|
-
end
|
98
|
-
Pact.configuration.output_stream.puts message
|
89
|
+
Pact.configuration.output_stream.puts "INFO: #{pact_selection_description(provider, consumer_version_selectors, options, broker_base_url)}"
|
99
90
|
end
|
100
91
|
end
|
101
92
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Pact
|
2
|
+
module PactBroker
|
3
|
+
module PactSelectionDescription
|
4
|
+
def pact_selection_description(provider, consumer_version_selectors, options, broker_base_url)
|
5
|
+
latest = consumer_version_selectors.any? ? "" : "latest "
|
6
|
+
message = "Fetching pacts for #{provider} from #{broker_base_url} with the selection criteria: "
|
7
|
+
if consumer_version_selectors.any?
|
8
|
+
desc = consumer_version_selectors.collect do |selector|
|
9
|
+
all_or_latest = !selector[:latest] ? "all for tag" : "latest for tag"
|
10
|
+
# TODO support fallback
|
11
|
+
fallback = selector[:fallback] || selector[:fallbackTag]
|
12
|
+
name = fallback ? "#{selector[:tag]} (or #{fallback} if not found)" : selector[:tag]
|
13
|
+
"#{all_or_latest} #{name}"
|
14
|
+
end.join(", ")
|
15
|
+
if options[:include_wip_pacts_since]
|
16
|
+
desc = "#{desc}, work in progress pacts created after #{options[:include_wip_pacts_since]}"
|
17
|
+
end
|
18
|
+
message << "#{desc}"
|
19
|
+
end
|
20
|
+
message
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -30,13 +30,15 @@ module Pact
|
|
30
30
|
output_hash[:examples] = notification.examples.map do |example|
|
31
31
|
format_example(example).tap do |hash|
|
32
32
|
e = example.exception
|
33
|
-
|
34
|
-
if e && ! e.is_a?(::RSpec::Expectations::ExpectationNotMetError)
|
33
|
+
if e
|
35
34
|
hash[:exception] = {
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:backtrace => e.backtrace,
|
35
|
+
class: e.class.name,
|
36
|
+
message: e.message,
|
39
37
|
}
|
38
|
+
# No point providing a backtrace for a mismatch, too much noise
|
39
|
+
if !e.is_a?(::RSpec::Expectations::ExpectationNotMetError)
|
40
|
+
hash[:exception][:backtrace]
|
41
|
+
end
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
@@ -29,7 +29,9 @@ module Pact
|
|
29
29
|
def parse_body_from_response rack_response
|
30
30
|
case rack_response.headers['Content-Type']
|
31
31
|
when /json/
|
32
|
-
|
32
|
+
# For https://github.com/pact-foundation/pact-net/issues/237
|
33
|
+
# Only required for the pact-ruby-standalone ¯\_(ツ)_/¯
|
34
|
+
JSON.load("[#{rack_response.body}]").first
|
33
35
|
else
|
34
36
|
rack_response.body
|
35
37
|
end
|
data/lib/pact/version.rb
CHANGED
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.50.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: 2020-
|
15
|
+
date: 2020-06-01 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rspec
|
@@ -319,6 +319,7 @@ files:
|
|
319
319
|
- lib/pact/pact_broker/fetch_pact_uris_for_verification.rb
|
320
320
|
- lib/pact/pact_broker/fetch_pacts.rb
|
321
321
|
- lib/pact/pact_broker/notices.rb
|
322
|
+
- lib/pact/pact_broker/pact_selection_description.rb
|
322
323
|
- lib/pact/project_root.rb
|
323
324
|
- lib/pact/provider.rb
|
324
325
|
- lib/pact/provider/configuration.rb
|