pact 1.64.0 → 1.65.0

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
  SHA256:
3
- metadata.gz: 174a9376cd442f1edd545cd006e1b15f07804077bb91060678e224d1717c6a5b
4
- data.tar.gz: 4b5d1a84949fbad2dedeb1233626ef649ac4352840a204ea20c6496d3c0c0493
3
+ metadata.gz: 24b61e9c910570243bd6054ebc23bf968f5bd20a308ab887184d0860c2b2018d
4
+ data.tar.gz: 62ba67e2a1ff00b591da39accfe05010d2836f5aa386df0129aa9df786b89156
5
5
  SHA512:
6
- metadata.gz: 957b95b85b59906f1a59bb23fe2b85674c1574171a0880a508df9c6413bc7fe3f2b54fc3fe766eab3fdd8f18e68eaabf4efda43da50df01c66ebe2e9a0f19111
7
- data.tar.gz: 6a34522651d931773d8ee92565ffd5173fd3f2cd99ba1211d25985da499b62d993a5b62b87257afb11a759cf691aa7702efe9e1773d11165794980d1301138e1
6
+ metadata.gz: b473ff4c78e3310449e8cae9a78bc379c36d20c6b646d3d587d83652598e32cae6f12ec50ad84623a1349655bbb841f7dc79aa8c0784dc79b53306f006ddc990
7
+ data.tar.gz: 91464395e4565d96df5025b998caa1e42a9ba71d9a72bfa0220dad95745bf3cc7d911f22171a1957d01a40a06c7042b9d53d49f75206ef757457227db5931260
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ <a name="v1.65.0"></a>
2
+ ### v1.65.0 (2024-08-06)
3
+
4
+ #### Features
5
+
6
+ * support app_version_branch in MessageProviderDSL ([1653128](/../../commit/1653128))
7
+ * allow setting fail_if_no_pacts_found in honours_pacts_from_pact_broker ([f0f142e](/../../commit/f0f142e))
8
+
9
+ #### Bug Fixes
10
+
11
+ * handle case in no_pacts_found - undefined method empty? for nil ([0145d2d](/../../commit/0145d2d))
12
+ * remove unused ConsumerContractBuilder contract_details accessor ([fb5488e](/../../commit/fb5488e))
13
+ * example/animal-service/Gemfile to reduce vulnerabilities ([2bbefe2](/../../commit/2bbefe2))
14
+ * example/zoo-app/Gemfile to reduce vulnerabilities ([e10f914](/../../commit/e10f914))
15
+ * example/animal-service/Gemfile to reduce vulnerabilities ([7560918](/../../commit/7560918))
16
+ * example/zoo-app/Gemfile to reduce vulnerabilities ([b4cbe85](/../../commit/b4cbe85))
17
+ * example/animal-service/Gemfile to reduce vulnerabilities ([4028087](/../../commit/4028087))
18
+ * ConsumerContractBuilder exposing incorrect field ([c805c3e](/../../commit/c805c3e))
19
+
20
+ * **test**
21
+ * alias Rack/Rackup WEBrick handler in x509 test for backwards compat ([cc77498](/../../commit/cc77498))
22
+
1
23
  <a name="v1.64.0"></a>
2
24
  ### v1.64.0 (2023-11-09)
3
25
 
@@ -72,7 +72,6 @@ module Pact
72
72
 
73
73
  def run_with_configured_pacts_from_pact_helper
74
74
  pact_urls = Pact.provider_world.pact_urls
75
- raise "Please configure a pact to verify" if pact_urls.empty?
76
75
  Pact::Provider::PactSpecRunner.new(pact_urls, pact_spec_options).run
77
76
  end
78
77
 
@@ -11,7 +11,7 @@ module Pact
11
11
 
12
12
  include Pact::Logging
13
13
 
14
- attr_reader :consumer_contract, :mock_service_base_url
14
+ attr_reader :mock_service_base_url
15
15
 
16
16
  def initialize(attributes)
17
17
  @interaction_builder = nil
@@ -39,15 +39,17 @@ module Pact
39
39
  end
40
40
 
41
41
  def call
42
- if index.can?(PACTS_FOR_VERIFICATION_RELATION) || index.can?(PACTS_FOR_VERIFICATION_RELATION_BETA)
43
- log_message
44
- pacts_for_verification
45
- else
46
- old_selectors = consumer_version_selectors.collect do | selector |
47
- { name: selector[:tag], all: !selector[:latest], fallback: selector[:fallbackTag]}
42
+ handling_no_pacts_found do
43
+ if index.can?(PACTS_FOR_VERIFICATION_RELATION) || index.can?(PACTS_FOR_VERIFICATION_RELATION_BETA)
44
+ log_message
45
+ pacts_for_verification
46
+ else
47
+ old_selectors = consumer_version_selectors.collect do | selector |
48
+ { name: selector[:tag], all: !selector[:latest], fallback: selector[:fallbackTag]}
49
+ end
50
+ # Fall back to old method of fetching pacts
51
+ FetchPacts.call(provider, old_selectors, broker_base_url, http_client_options)
48
52
  end
49
- # Fall back to old method of fetching pacts
50
- FetchPacts.call(provider, old_selectors, broker_base_url, http_client_options)
51
53
  end
52
54
  end
53
55
 
@@ -96,6 +98,15 @@ module Pact
96
98
  def log_message
97
99
  Pact.configuration.output_stream.puts "INFO: #{pact_selection_description(provider, consumer_version_selectors, options, broker_base_url)}"
98
100
  end
101
+
102
+ def handling_no_pacts_found
103
+ pacts_found = yield
104
+ raise "No pacts found to verify" if pacts_found.blank? && options[:fail_if_no_pacts_found] != false
105
+ if pacts_found.blank? && options[:fail_if_no_pacts_found] == false
106
+ Pact.configuration.output_stream.puts "WARN: No pacts found to verify & fail_if_no_pacts_found is set to false."
107
+ end
108
+ pacts_found
109
+ end
99
110
  end
100
111
  end
101
112
  end
@@ -34,6 +34,10 @@ module Pact
34
34
  self.tags = tags
35
35
  end
36
36
 
37
+ def app_version_branch branch
38
+ self.branch = branch
39
+ end
40
+
37
41
  def publish_verification_results publish_verification_results
38
42
  self.publish_verification_results = publish_verification_results
39
43
  Pact::RSpec.with_rspec_2 do
@@ -15,7 +15,7 @@ module Pact
15
15
  # in parent scope, it will clash with these ones,
16
16
  # so put an underscore in front of the name to be safer.
17
17
 
18
- attr_accessor :_provider_name, :_pact_broker_base_url, :_consumer_version_tags, :_provider_version_branch, :_provider_version_tags, :_basic_auth_options, :_enable_pending, :_include_wip_pacts_since, :_verbose, :_consumer_version_selectors
18
+ attr_accessor :_provider_name, :_pact_broker_base_url, :_consumer_version_tags, :_provider_version_branch, :_provider_version_tags, :_basic_auth_options, :_enable_pending, :_include_wip_pacts_since, :_verbose, :_consumer_version_selectors, :_fail_if_no_pacts_found
19
19
 
20
20
  def initialize(provider_name, provider_version_branch, provider_version_tags)
21
21
  @_provider_name = provider_name
@@ -26,6 +26,7 @@ module Pact
26
26
  @_enable_pending = false
27
27
  @_include_wip_pacts_since = nil
28
28
  @_verbose = false
29
+ @_fail_if_no_pacts_found = true # CLI defaults to false, unfortunately for consistency
29
30
  end
30
31
 
31
32
  dsl do
@@ -46,6 +47,11 @@ module Pact
46
47
  self._enable_pending = enable_pending
47
48
  end
48
49
 
50
+ # Underlying code defaults to true if not specified
51
+ def fail_if_no_pacts_found fail_if_no_pacts_found
52
+ self._fail_if_no_pacts_found = fail_if_no_pacts_found
53
+ end
54
+
49
55
  def include_wip_pacts_since since
50
56
  self._include_wip_pacts_since = if since.respond_to?(:xmlschema)
51
57
  since.xmlschema
@@ -74,7 +80,7 @@ module Pact
74
80
  _provider_version_tags,
75
81
  _pact_broker_base_url,
76
82
  _basic_auth_options.merge(verbose: _verbose),
77
- { include_pending_status: _enable_pending, include_wip_pacts_since: _include_wip_pacts_since }
83
+ { include_pending_status: _enable_pending, include_wip_pacts_since: _include_wip_pacts_since, fail_if_no_pacts_found: _fail_if_no_pacts_found }
78
84
  )
79
85
 
80
86
  Pact.provider_world.add_pact_uri_source fetch_pacts
data/lib/pact/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # Remember to bump pact-provider-proxy when this changes major version
2
2
  module Pact
3
- VERSION = "1.64.0"
3
+ VERSION = "1.65.0"
4
4
  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.64.0
4
+ version: 1.65.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: 2023-12-20 00:00:00.000000000 Z
15
+ date: 2024-08-07 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -419,7 +419,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
419
419
  - !ruby/object:Gem::Version
420
420
  version: '0'
421
421
  requirements: []
422
- rubygems_version: 3.5.1
422
+ rubygems_version: 3.5.17
423
423
  signing_key:
424
424
  specification_version: 4
425
425
  summary: Enables consumer driven contract testing, providing a mock service and DSL