pact 1.49.0 → 1.50.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +46 -0
- 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/configuration/message_provider_dsl.rb +27 -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: 5b098430ba170a2290f1ae9c18b8d94ea7c2e968f5e8f3bd48c4e34155b4ea0d
|
4
|
+
data.tar.gz: 3b5f51717c2ba8934df7bf0fdbe9d68c74096e0058eeeae4f75804becd8366f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0049d4e11c748ebf653da1a754168d82198c73975cd30d16a67a4bcd837490740a30271b16a012612d19100b0a1c7139b5945e5f29686930407436a0acb47584'
|
7
|
+
data.tar.gz: 8e2e895e155d37650d5d677f062c9a4d391132beae3884144978cd41438bfa4c979caa33fc2a2623013b23cdd1c67e403d5506b84ed32def9c22be5e5a97f568
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,49 @@
|
|
1
|
+
<a name="v1.50.1"></a>
|
2
|
+
### v1.50.1 (2020-06-15)
|
3
|
+
|
4
|
+
|
5
|
+
#### Bug Fixes
|
6
|
+
|
7
|
+
* fix integration with pact-message-ruby (#216) ([d2da13e](/../../commit/d2da13e))
|
8
|
+
|
9
|
+
|
10
|
+
<a name="v1.50.0"></a>
|
11
|
+
### v1.50.0 (2020-04-25)
|
12
|
+
|
13
|
+
|
14
|
+
#### Features
|
15
|
+
|
16
|
+
* Set expected interactions on mock service but without writing them to pact file (#210) ([14f5327](/../../commit/14f5327))
|
17
|
+
|
18
|
+
|
19
|
+
<a name="v1.49.3"></a>
|
20
|
+
### v1.49.3 (2020-04-22)
|
21
|
+
|
22
|
+
|
23
|
+
#### Bug Fixes
|
24
|
+
|
25
|
+
* pact selection verification options logging ([9ff59f4](/../../commit/9ff59f4))
|
26
|
+
|
27
|
+
|
28
|
+
<a name="v1.49.2"></a>
|
29
|
+
### v1.49.2 (2020-04-08)
|
30
|
+
|
31
|
+
|
32
|
+
#### Bug Fixes
|
33
|
+
|
34
|
+
* json parser error for top level JSON values ([dafbc35](/../../commit/dafbc35))
|
35
|
+
|
36
|
+
|
37
|
+
<a name="v1.49.1"></a>
|
38
|
+
### v1.49.1 (2020-03-21)
|
39
|
+
|
40
|
+
|
41
|
+
#### Bug Fixes
|
42
|
+
|
43
|
+
* ensure diff is included in the json output ([0bd9753](/../../commit/0bd9753))
|
44
|
+
* 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))
|
45
|
+
|
46
|
+
|
1
47
|
<a name="v1.49.0"></a>
|
2
48
|
### v1.49.0 (2020-02-18)
|
3
49
|
|
@@ -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
|
@@ -22,6 +22,33 @@ module Pact
|
|
22
22
|
end
|
23
23
|
|
24
24
|
dsl do
|
25
|
+
def app &block
|
26
|
+
self.app_block = block
|
27
|
+
end
|
28
|
+
|
29
|
+
def app_version application_version
|
30
|
+
self.application_version = application_version
|
31
|
+
end
|
32
|
+
|
33
|
+
def app_version_tags tags
|
34
|
+
self.tags = tags
|
35
|
+
end
|
36
|
+
|
37
|
+
def publish_verification_results publish_verification_results
|
38
|
+
self.publish_verification_results = publish_verification_results
|
39
|
+
Pact::RSpec.with_rspec_2 do
|
40
|
+
Pact.configuration.error_stream.puts "WARN: Publishing of verification results is currently not supported with rspec 2. If you would like this functionality, please feel free to submit a PR!"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def honours_pact_with consumer_name, options = {}, &block
|
45
|
+
create_pact_verification consumer_name, options, &block
|
46
|
+
end
|
47
|
+
|
48
|
+
def honours_pacts_from_pact_broker &block
|
49
|
+
create_pact_verification_from_broker &block
|
50
|
+
end
|
51
|
+
|
25
52
|
def builder &block
|
26
53
|
self.app_block = lambda { RackToMessageAdapter.new(block) }
|
27
54
|
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.1
|
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-15 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
|