pact 1.50.0 → 1.53.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72dbb710ec5471bb551465a8f55342f32cc057cb2a6d36a7f1b4ec613e90fb19
4
- data.tar.gz: b0c3329c670d4704517df5eeb79b4cbb8d874c2a52151851009a211d3ab89d36
3
+ metadata.gz: 36cdbcc7291013248a5b691e8dec77f7153fd3c5c75d664e5da651943a8673dc
4
+ data.tar.gz: 0a75d19524d85f5623f6f8f9b042b1e481f551a5784cb2c48e86633f2d3d7329
5
5
  SHA512:
6
- metadata.gz: 8a4fed394938fb5ad9489f79df8b06589d5982cc289cf45fd0c8a5056a23b875b48be9efb3b082e34477935ffbc7b7416a1de5daa9183bf9c2dbd20ba548f503
7
- data.tar.gz: b8b501317bb1e1446d1776c7c3d9e5674632475cae4cbd4a5e38f726c374463a23000f95760e432c48cc3cee46fd74dbff17dae6226d5f614f4972f4938a2df2
6
+ metadata.gz: faa46bb073cdacca555022ee518d15e13182f286f1b6d75f309f7f5d6d6692674c046ced1d3b8598d10772b7dc25d3157aa556d6ac47453753dc90607ed8575b
7
+ data.tar.gz: 360a99577f6925e21ab6ce0949bca79a3309c1a16e7dbd21ae72fe20b7c46a87eca0f422d810061d2adc594141b76ca4be831eeb8859aff29eca00fe9227f78e
@@ -1,3 +1,43 @@
1
+ <a name="v1.53.0"></a>
2
+ ### v1.53.0 (2020-09-11)
3
+
4
+ #### Features
5
+
6
+ * add support for the enable_pending flag ([16866f4](/../../commit/16866f4))
7
+
8
+ <a name="v1.52.0"></a>
9
+ ### v1.52.0 (2020-09-10)
10
+
11
+ #### Features
12
+
13
+ * support webdav http methods ([fa1d712](/../../commit/fa1d712))
14
+
15
+ <a name="v1.51.1"></a>
16
+ ### v1.51.1 (2020-08-12)
17
+
18
+ #### Bug Fixes
19
+
20
+ * update thor dependency (#218) ([bf3ce69](/../../commit/bf3ce69))
21
+ * bump rake dependency per CVE-2020-8130 (#219) ([09feaa6](/../../commit/09feaa6))
22
+
23
+ <a name="v1.51.0"></a>
24
+ ### v1.51.0 (2020-06-24)
25
+
26
+
27
+ #### Features
28
+
29
+ * allow individual interactions to be re-run by setting PACT_BROKER_INTERACTION_ID ([a586d80](/../../commit/a586d80))
30
+
31
+
32
+ <a name="v1.50.1"></a>
33
+ ### v1.50.1 (2020-06-15)
34
+
35
+
36
+ #### Bug Fixes
37
+
38
+ * fix integration with pact-message-ruby (#216) ([d2da13e](/../../commit/d2da13e))
39
+
40
+
1
41
  <a name="v1.50.0"></a>
2
42
  ### v1.50.0 (2020-04-25)
3
43
 
@@ -4,6 +4,9 @@ require 'pact/provider/configuration'
4
4
 
5
5
  module Pact
6
6
  class CLI < Thor
7
+ def self.exit_on_failure? # Thor 1.0 deprecation guard
8
+ false
9
+ end
7
10
 
8
11
  desc 'verify', "Verify a pact"
9
12
  method_option :pact_helper, aliases: "-h", desc: "Pact helper file", :required => true
@@ -18,6 +21,8 @@ module Pact
18
21
  default: Pact.configuration.interactions_replay_order
19
22
  method_option :description, aliases: "-d", desc: "Interaction description filter"
20
23
  method_option :provider_state, aliases: "-s", desc: "Provider state filter"
24
+ method_option :interaction_index, type: :numeric, desc: "Index filter"
25
+ method_option :pact_broker_interaction_id, desc: "Pact Broker interaction ID filter"
21
26
  method_option :format, aliases: "-f", banner: "FORMATTER", desc: "RSpec formatter. Defaults to custom Pact formatter. [j]son may also be used."
22
27
  method_option :out, aliases: "-o", banner: "FILE", desc: "Write output to a file instead of $stdout."
23
28
 
@@ -6,8 +6,11 @@ module Pact
6
6
  criteria = {}
7
7
 
8
8
  criteria[:description] = Regexp.new(options[:description]) if options[:description]
9
+ criteria[:_id] = options[:pact_broker_interaction_id] if options[:pact_broker_interaction_id]
10
+ criteria[:index] = options[:interaction_index] if options[:interaction_index]
9
11
 
10
12
  provider_state = options[:provider_state]
13
+
11
14
  if provider_state
12
15
  if provider_state.length == 0
13
16
  criteria[:provider_state] = nil #Allow PACT_PROVIDER_STATE="" to mean no provider state
@@ -22,7 +22,7 @@ module Pact
22
22
  def initialize(provider, consumer_version_selectors, provider_version_tags, broker_base_url, http_client_options, options = {})
23
23
  @provider = provider
24
24
  @consumer_version_selectors = consumer_version_selectors || []
25
- @provider_version_tags = provider_version_tags || []
25
+ @provider_version_tags = [*provider_version_tags]
26
26
  @http_client_options = http_client_options
27
27
  @broker_base_url = broker_base_url
28
28
  @http_client = Pact::Hal::HttpClient.new(http_client_options)
@@ -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
@@ -14,12 +14,13 @@ module Pact
14
14
  # in parent scope, it will clash with these ones,
15
15
  # so put an underscore in front of the name to be safer.
16
16
 
17
- attr_accessor :_provider_name, :_pact_broker_base_url, :_consumer_version_tags, :_provider_version_tags, :_basic_auth_options, :_verbose
17
+ attr_accessor :_provider_name, :_pact_broker_base_url, :_consumer_version_tags, :_provider_version_tags, :_basic_auth_options, :_enable_pending, :_verbose
18
18
 
19
19
  def initialize(provider_name, provider_version_tags)
20
20
  @_provider_name = provider_name
21
21
  @_provider_version_tags = provider_version_tags
22
22
  @_consumer_version_tags = []
23
+ @_enable_pending = false
23
24
  @_verbose = false
24
25
  end
25
26
 
@@ -33,6 +34,10 @@ module Pact
33
34
  self._consumer_version_tags = *consumer_version_tags
34
35
  end
35
36
 
37
+ def enable_pending enable_pending
38
+ self._enable_pending = enable_pending
39
+ end
40
+
36
41
  def verbose verbose
37
42
  self._verbose = verbose
38
43
  end
@@ -51,7 +56,8 @@ module Pact
51
56
  consumer_version_selectors,
52
57
  _provider_version_tags,
53
58
  _pact_broker_base_url,
54
- _basic_auth_options.merge(verbose: _verbose)
59
+ _basic_auth_options.merge(verbose: _verbose),
60
+ { include_pending_status: _enable_pending }
55
61
  )
56
62
 
57
63
  Pact.provider_world.add_pact_uri_source fetch_pacts
@@ -93,17 +93,32 @@ module Pact
93
93
 
94
94
  def interaction_rerun_command_for example
95
95
  example_description = example.metadata[:pact_interaction_example_description]
96
- if ENV['PACT_INTERACTION_RERUN_COMMAND']
96
+
97
+ _id = example.metadata[:pact_interaction]._id
98
+ index = example.metadata[:pact_interaction].index
99
+ provider_state = example.metadata[:pact_interaction].provider_state
100
+ description = example.metadata[:pact_interaction].description
101
+ pactfile_uri = example.metadata[:pactfile_uri]
102
+
103
+ if _id && ENV['PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER']
104
+ cmd = String.new(ENV['PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER'])
105
+ cmd.gsub!("<PACT_URI>", example.metadata[:pactfile_uri].to_s)
106
+ cmd.gsub!("<PACT_BROKER_INTERACTION_ID>", "#{_id}")
107
+ colorizer.wrap("#{cmd} ", ::RSpec.configuration.failure_color) + colorizer.wrap("# #{example_description}", ::RSpec.configuration.detail_color)
108
+ elsif ENV['PACT_INTERACTION_RERUN_COMMAND']
97
109
  cmd = String.new(ENV['PACT_INTERACTION_RERUN_COMMAND'])
98
- provider_state = example.metadata[:pact_interaction].provider_state
99
- description = example.metadata[:pact_interaction].description
100
- pactfile_uri = example.metadata[:pactfile_uri]
101
110
  cmd.gsub!("<PACT_URI>", pactfile_uri.to_s)
102
111
  cmd.gsub!("<PACT_DESCRIPTION>", description)
103
112
  cmd.gsub!("<PACT_PROVIDER_STATE>", "#{provider_state}")
113
+ cmd.gsub!("<PACT_INTERACTION_INDEX>", "#{index}")
104
114
  colorizer.wrap("#{cmd} ", ::RSpec.configuration.failure_color) + colorizer.wrap("# #{example_description}", ::RSpec.configuration.detail_color)
105
115
  else
106
- colorizer.wrap("* #{example_description}", ::RSpec.configuration.failure_color)
116
+ message = if _id
117
+ "* #{example_description} (to re-run just this interaction, set environment variable PACT_BROKER_INTERACTION_ID=\"#{_id}\")"
118
+ else
119
+ "* #{example_description} (to re-run just this interaction, set environment variables PACT_DESCRIPTION=\"#{description}\" PACT_PROVIDER_STATE=\"#{provider_state}\")"
120
+ end
121
+ colorizer.wrap(message, ::RSpec.configuration.failure_color)
107
122
  end
108
123
  end
109
124
 
@@ -21,7 +21,11 @@ module Pact
21
21
 
22
22
  logger.info "Sending #{request.method.upcase} request to path: \"#{request.path}\" with headers: #{request.headers}, see debug logs for body"
23
23
  logger.debug "body :#{request.body}"
24
- response = self.send(request.method.downcase, *args)
24
+ response = if self.respond_to?(:custom_request)
25
+ self.custom_request(request.method.upcase, *args)
26
+ else
27
+ self.send(request.method.downcase, *args)
28
+ end
25
29
  logger.info "Received response with status: #{response.status}, headers: #{response.headers}, see debug logs for body"
26
30
  logger.debug "body: #{response.body}"
27
31
  end
@@ -7,6 +7,7 @@ module Pact
7
7
  module TaskHelper
8
8
 
9
9
  PACT_INTERACTION_RERUN_COMMAND = "bundle exec rake pact:verify:at[<PACT_URI>] PACT_DESCRIPTION=\"<PACT_DESCRIPTION>\" PACT_PROVIDER_STATE=\"<PACT_PROVIDER_STATE>\""
10
+ PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER = "bundle exec rake pact:verify:at[<PACT_URI>] PACT_BROKER_INTERACTION_ID=\"<PACT_BROKER_INTERACTION_ID>\""
10
11
 
11
12
  extend self
12
13
 
@@ -34,6 +35,8 @@ module Pact
34
35
  command_parts << "--backtrace" if ENV['BACKTRACE'] == 'true'
35
36
  command_parts << "--description #{Shellwords.escape(ENV['PACT_DESCRIPTION'])}" if ENV['PACT_DESCRIPTION']
36
37
  command_parts << "--provider-state #{Shellwords.escape(ENV['PACT_PROVIDER_STATE'])}" if ENV['PACT_PROVIDER_STATE']
38
+ command_parts << "--pact-broker-interaction-id #{Shellwords.escape(ENV['PACT_BROKER_INTERACTION_ID'])}" if ENV['PACT_BROKER_INTERACTION_ID']
39
+ command_parts << "--interaction-index #{Shellwords.escape(ENV['PACT_INTERACTION_INDEX'])}" if ENV['PACT_INTERACTION_INDEX']
37
40
  command_parts.flatten.join(" ")
38
41
  end
39
42
 
@@ -41,7 +44,9 @@ module Pact
41
44
  Pact.configuration.output_stream.puts command
42
45
  temporarily_set_env_var 'PACT_EXECUTING_LANGUAGE', 'ruby' do
43
46
  temporarily_set_env_var 'PACT_INTERACTION_RERUN_COMMAND', PACT_INTERACTION_RERUN_COMMAND do
44
- exit_status = system(command) ? 0 : 1
47
+ temporarily_set_env_var 'PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER', PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER do
48
+ exit_status = system(command) ? 0 : 1
49
+ end
45
50
  end
46
51
  end
47
52
  end
@@ -1,4 +1,4 @@
1
1
  # Remember to bump pact-provider-proxy when this changes major version
2
2
  module Pact
3
- VERSION = "1.50.0"
3
+ VERSION = "1.53.0"
4
4
  end
@@ -28,14 +28,14 @@ Gem::Specification.new do |gem|
28
28
 
29
29
  gem.add_runtime_dependency 'rspec', '~> 3.0'
30
30
  gem.add_runtime_dependency 'rack-test', '>= 0.6.3', '< 2.0.0'
31
- gem.add_runtime_dependency 'thor', '~> 0.20'
31
+ gem.add_runtime_dependency 'thor', '>= 0.20', '< 2.0'
32
32
  gem.add_runtime_dependency 'webrick', '~> 1.3'
33
33
  gem.add_runtime_dependency 'term-ansicolor', '~> 1.0'
34
34
 
35
35
  gem.add_runtime_dependency 'pact-support', '~> 1.9'
36
36
  gem.add_runtime_dependency 'pact-mock_service', '~> 3.0', '>= 3.3.1'
37
37
 
38
- gem.add_development_dependency 'rake', '~> 10.0'
38
+ gem.add_development_dependency 'rake', '~> 13.0'
39
39
  gem.add_development_dependency 'webmock', '~> 3.0'
40
40
  gem.add_development_dependency 'fakefs', '0.5' # 0.6.0 blows up
41
41
  gem.add_development_dependency 'hashie', '~> 2.0'
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.50.0
4
+ version: 1.53.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-06-01 00:00:00.000000000 Z
15
+ date: 2020-09-11 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -52,16 +52,22 @@ dependencies:
52
52
  name: thor
53
53
  requirement: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - "~>"
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0.20'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '2.0'
58
61
  type: :runtime
59
62
  prerelease: false
60
63
  version_requirements: !ruby/object:Gem::Requirement
61
64
  requirements:
62
- - - "~>"
65
+ - - ">="
63
66
  - !ruby/object:Gem::Version
64
67
  version: '0.20'
68
+ - - "<"
69
+ - !ruby/object:Gem::Version
70
+ version: '2.0'
65
71
  - !ruby/object:Gem::Dependency
66
72
  name: webrick
67
73
  requirement: !ruby/object:Gem::Requirement
@@ -130,14 +136,14 @@ dependencies:
130
136
  requirements:
131
137
  - - "~>"
132
138
  - !ruby/object:Gem::Version
133
- version: '10.0'
139
+ version: '13.0'
134
140
  type: :development
135
141
  prerelease: false
136
142
  version_requirements: !ruby/object:Gem::Requirement
137
143
  requirements:
138
144
  - - "~>"
139
145
  - !ruby/object:Gem::Version
140
- version: '10.0'
146
+ version: '13.0'
141
147
  - !ruby/object:Gem::Dependency
142
148
  name: webmock
143
149
  requirement: !ruby/object:Gem::Requirement
@@ -397,8 +403,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
397
403
  - !ruby/object:Gem::Version
398
404
  version: '0'
399
405
  requirements: []
400
- rubyforge_project:
401
- rubygems_version: 2.7.7
406
+ rubygems_version: 3.1.4
402
407
  signing_key:
403
408
  specification_version: 4
404
409
  summary: Enables consumer driven contract testing, providing a mock service and DSL