pact 1.55.2 → 1.55.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5bc7edfd2afca203239799e173f2245076887f4d38df625bbaec1ddfc655fda
4
- data.tar.gz: c71945880bf5878c9e712b67f5b87262b7f72444b1628c12dc8eaec725022653
3
+ metadata.gz: 90eaa90df07b95c461c6172d516567dfccb033e3a45e09b4bd5c9ef95038261b
4
+ data.tar.gz: e4d5c2d42dd9409dc774127d7be200ebefc772af3030573f366234b5e3defce2
5
5
  SHA512:
6
- metadata.gz: b8d062c28996f29d6424577b3514baa14510b546d3d914abd8d3d12ad2c626cef82a4dd6a7251b2d05fd3fa1c593e2d86862d3dac1b91c7e6757e9b7d7eaf9d7
7
- data.tar.gz: 73feb7558cec7e7dc0b78469951c79a0313e0df86d7c85a677963a499c633b2e0d0877783f57ac2b141bb612cf0de8f9474eb5ccf5c8e7d5d2465d22ae16b73f
6
+ metadata.gz: 61eae7be6115674cc66044e007293430f68dcd6d0f445e9d8fbad664a84fbe43c4b608ed3f106d61b20c5c85ea91499278d2ec4edd00429e4286222cf35c570d
7
+ data.tar.gz: aa4cc70bce5d401511d500c7ab31f03724c23444607e594e895c7bac867f0c0ba4e97032ff93197e50ef9df11145bf3447bfdbe013f70cf0fc226331c744c983
@@ -1,3 +1,40 @@
1
+ <a name="v1.55.7"></a>
2
+ ### v1.55.7 (2020-11-25)
3
+
4
+ #### Bug Fixes
5
+
6
+ * add consumer name to the selection description (#229) ([5127036](/../../commit/5127036))
7
+
8
+ <a name="v1.55.6"></a>
9
+ ### v1.55.6 (2020-11-06)
10
+
11
+ #### Bug Fixes
12
+
13
+ * require rspec now that pact-support does not depend on it ([5b5c27c](/../../commit/5b5c27c))
14
+
15
+ <a name="v1.55.5"></a>
16
+ ### v1.55.5 (2020-10-12)
17
+
18
+ #### Bug Fixes
19
+
20
+ * **security**
21
+ * hide personal access token given in uri (#225) ([f6db12d](/../../commit/f6db12d))
22
+
23
+ <a name="v1.55.4"></a>
24
+ ### v1.55.4 (2020-10-09)
25
+
26
+ #### Bug Fixes
27
+
28
+ * add back missing output describing the interactions filter ([1a2d7c1](/../../commit/1a2d7c1))
29
+
30
+ <a name="v1.55.3"></a>
31
+ ### v1.55.3 (2020-09-28)
32
+
33
+ #### Bug Fixes
34
+
35
+ * correct logic for determining if all interactions for a pact have been verified ([c4f968e](/../../commit/c4f968e))
36
+ * de-duplicate re-run commands ([0813498](/../../commit/0813498))
37
+
1
38
  <a name="v1.55.2"></a>
2
39
  ### v1.55.2 (2020-09-26)
3
40
 
@@ -27,6 +27,7 @@ module Pact
27
27
  # With RSpec3, if the pact_helper loads a library that adds its own formatter before we set one,
28
28
  # we will get a ProgressFormatter too, and get little dots sprinkled throughout our output.
29
29
  # Load a NilFormatter here to prevent that.
30
+ require 'rspec'
30
31
  require 'pact/rspec'
31
32
  ::RSpec.configuration.add_formatter Pact::RSpec.formatter_class.const_get('NilFormatter')
32
33
  end
@@ -2,14 +2,14 @@ module Pact
2
2
  module PactBroker
3
3
  module PactSelectionDescription
4
4
  def pact_selection_description(provider, consumer_version_selectors, options, broker_base_url)
5
- latest = consumer_version_selectors.any? ? "" : "latest "
6
5
  message = "Fetching pacts for #{provider} from #{broker_base_url} with the selection criteria: "
7
6
  if consumer_version_selectors.any?
8
7
  desc = consumer_version_selectors.collect do |selector|
9
8
  all_or_latest = !selector[:latest] ? "all for tag" : "latest for tag"
9
+ consumer = selector[:consumer] ? "of consumer #{selector[:consumer]}" : nil
10
10
  fallback = selector[:fallback] || selector[:fallbackTag]
11
11
  name = fallback ? "#{selector[:tag]} (or #{fallback} if not found)" : selector[:tag]
12
- "#{all_or_latest} #{name}"
12
+ [all_or_latest, name, consumer].compact.join(" ")
13
13
  end.join(", ")
14
14
  if options[:include_wip_pacts_since]
15
15
  desc = "#{desc}, work in progress pacts created after #{options[:include_wip_pacts_since]}"
@@ -1,6 +1,7 @@
1
1
  require 'pact/consumer_contract/pact_file'
2
2
  require 'pact/hal/http_client'
3
3
  require 'pact/hal/entity'
4
+ require 'pact/consumer_contract'
4
5
 
5
6
  module Pact
6
7
  module Provider
@@ -24,6 +25,10 @@ module Pact
24
25
  uri.metadata[:pending]
25
26
  end
26
27
 
28
+ def consumer_contract
29
+ @consumer_contract ||= Pact::ConsumerContract.from_json(pact_json)
30
+ end
31
+
27
32
  def hal_entity
28
33
  http_client_keys = [:username, :password, :token]
29
34
  http_client_options = uri.options.reject{ |k, _| !http_client_keys.include?(k) }
@@ -17,7 +17,7 @@ module Pact
17
17
  end
18
18
 
19
19
  def basic_auth?
20
- !!username
20
+ !!username && !!password
21
21
  end
22
22
 
23
23
  def username
@@ -29,12 +29,23 @@ module Pact
29
29
  end
30
30
 
31
31
  def to_s
32
- if basic_auth? && uri.start_with?('http://', 'https://')
32
+ if basic_auth? && http_or_https_uri?
33
33
  URI(@uri).tap { |x| x.userinfo="#{username}:*****"}.to_s
34
+ elsif personal_access_token? && http_or_https_uri?
35
+ URI(@uri).tap { |x| x.userinfo="*****"}.to_s
34
36
  else
35
37
  uri
36
38
  end
37
39
  end
40
+
41
+ private def personal_access_token?
42
+ !!username && !password
43
+ end
44
+
45
+ private def http_or_https_uri?
46
+ uri.start_with?('http://', 'https://')
47
+ end
48
+
38
49
  end
39
50
  end
40
51
  end
@@ -26,8 +26,10 @@ module Pact
26
26
  Pact.configuration.output_stream.puts "INFO: Reading pact at #{pact_uri}"
27
27
  consumer_contract = Pact::ConsumerContract.from_json(pact_json)
28
28
  suffix = pact_uri.metadata[:pending] ? " [PENDING]": ""
29
+ example_group_description = "Verifying a pact between #{consumer_contract.consumer.name} and #{consumer_contract.provider.name}#{suffix}"
30
+ example_group_metadata = { pactfile_uri: pact_uri, pact_criteria: options[:criteria] }
29
31
 
30
- ::RSpec.describe "Verifying a pact between #{consumer_contract.consumer.name} and #{consumer_contract.provider.name}#{suffix}", pactfile_uri: pact_uri do
32
+ ::RSpec.describe example_group_description, example_group_metadata do
31
33
  honour_consumer_contract consumer_contract, options.merge(
32
34
  pact_json: pact_json,
33
35
  pact_uri: pact_uri,
@@ -90,8 +92,7 @@ module Pact
90
92
  pact_uri: options[:pact_uri],
91
93
  pact_source: options[:pact_source],
92
94
  pact_ignore_failures: options[:pact_source].pending? || options[:ignore_failures],
93
- pact_consumer_contract: options[:consumer_contract],
94
- pact_criteria: options[:criteria]
95
+ pact_consumer_contract: options[:consumer_contract]
95
96
  }
96
97
 
97
98
  describe description_for(interaction), metadata do
@@ -25,6 +25,7 @@ module Pact
25
25
  C = ::Term::ANSIColor
26
26
 
27
27
  def example_group_started(notification)
28
+ # This is the metadata on the top level "Verifying a pact between X and Y" describe block
28
29
  if @group_level == 0
29
30
  Pact.configuration.output_stream.puts
30
31
  pact_uri = notification.group.metadata[:pactfile_uri]
@@ -128,7 +129,7 @@ module Pact
128
129
  def interaction_rerun_commands examples
129
130
  examples.collect do |example|
130
131
  interaction_rerun_command_for example
131
- end.compact
132
+ end.compact.uniq
132
133
  end
133
134
 
134
135
  def interaction_unique_key(example)
@@ -8,7 +8,7 @@ module Pact
8
8
  module RSpec
9
9
  module Matchers
10
10
  module RSpec2Delegator
11
- # For backwards compatiblity with rspec-2
11
+ # For backwards compatibility with rspec-2
12
12
  def method_missing(method, *args, &block)
13
13
  if method_name == :failure_message_for_should
14
14
  failure_message method, *args, &block
@@ -28,7 +28,23 @@ module Pact
28
28
  end
29
29
 
30
30
  def publishable?
31
- executed_interactions_count == all_interactions_count && all_interactions_count > 0
31
+ if defined?(@publishable)
32
+ @publishable
33
+ else
34
+ @publishable = pact_source.consumer_contract.interactions.all? do | interaction |
35
+ examples_for_pact_uri.any?{ |e| example_is_for_interaction?(e, interaction) }
36
+ end && examples_for_pact_uri.count > 0
37
+ end
38
+ end
39
+
40
+ def example_is_for_interaction?(example, interaction)
41
+ # Use the Pact Broker id if supported
42
+ if interaction._id
43
+ example[:pact_interaction]._id == interaction._id
44
+ else
45
+ # fall back to object equality (based on the field values of the interaction)
46
+ example[:pact_interaction] == interaction
47
+ end
32
48
  end
33
49
 
34
50
  def examples_for_pact_uri
@@ -39,18 +55,6 @@ module Pact
39
55
  examples_for_pact_uri.count{ |e| e[:status] != 'passed' }
40
56
  end
41
57
 
42
- def executed_interactions_count
43
- examples_for_pact_uri
44
- .collect { |e| e[:pact_interaction].object_id }
45
- .uniq
46
- .count
47
- end
48
-
49
- def all_interactions_count
50
- interactions = (pact_source.pact_hash['interactions'] || pact_source.pact_hash['messages'])
51
- interactions ? interactions.count : 0
52
- end
53
-
54
58
  def test_results_hash_for_pact_uri
55
59
  {
56
60
  tests: examples_for_pact_uri.collect{ |e| clean_example(e) },
@@ -1,4 +1,4 @@
1
1
  # Remember to bump pact-provider-proxy when this changes major version
2
2
  module Pact
3
- VERSION = "1.55.2"
3
+ VERSION = "1.55.7"
4
4
  end
@@ -32,7 +32,7 @@ Gem::Specification.new do |gem|
32
32
  gem.add_runtime_dependency 'webrick', '~> 1.3'
33
33
  gem.add_runtime_dependency 'term-ansicolor', '~> 1.0'
34
34
 
35
- gem.add_runtime_dependency 'pact-support', '~> 1.9'
35
+ gem.add_runtime_dependency 'pact-support', '~> 1.15'
36
36
  gem.add_runtime_dependency 'pact-mock_service', '~> 3.0', '>= 3.3.1'
37
37
 
38
38
  gem.add_development_dependency 'rake', '~> 13.0'
@@ -43,6 +43,6 @@ Gem::Specification.new do |gem|
43
43
  gem.add_development_dependency 'faraday', '~> 0.13'
44
44
  gem.add_development_dependency 'conventional-changelog', '~> 1.3'
45
45
  gem.add_development_dependency 'bump', '~> 0.5'
46
- gem.add_development_dependency 'pact-message', '~> 0.6'
46
+ gem.add_development_dependency 'pact-message', '~> 0.8'
47
47
  gem.add_development_dependency 'rspec-its', '~> 1.3'
48
48
  end
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.55.2
4
+ version: 1.55.7
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-09-26 00:00:00.000000000 Z
15
+ date: 2020-11-25 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -102,14 +102,14 @@ dependencies:
102
102
  requirements:
103
103
  - - "~>"
104
104
  - !ruby/object:Gem::Version
105
- version: '1.9'
105
+ version: '1.15'
106
106
  type: :runtime
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - "~>"
111
111
  - !ruby/object:Gem::Version
112
- version: '1.9'
112
+ version: '1.15'
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: pact-mock_service
115
115
  requirement: !ruby/object:Gem::Requirement
@@ -248,14 +248,14 @@ dependencies:
248
248
  requirements:
249
249
  - - "~>"
250
250
  - !ruby/object:Gem::Version
251
- version: '0.6'
251
+ version: '0.8'
252
252
  type: :development
253
253
  prerelease: false
254
254
  version_requirements: !ruby/object:Gem::Requirement
255
255
  requirements:
256
256
  - - "~>"
257
257
  - !ruby/object:Gem::Version
258
- version: '0.6'
258
+ version: '0.8'
259
259
  - !ruby/object:Gem::Dependency
260
260
  name: rspec-its
261
261
  requirement: !ruby/object:Gem::Requirement