pact 1.49.3 → 1.52.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: b4977d1d79d691b6825034ac05aaf84261ced3e7ebdad2b000e28fc0307a8864
4
- data.tar.gz: a0685cfb4a9e2af1e64b0e0885170e86bcbc8564b6d99f42e3bc6df0408f9d3b
3
+ metadata.gz: 9cfa158c1bfe5e29903a33e219b080a26a5fe89983197703f4b41776c5c9308d
4
+ data.tar.gz: 03d4a346421f6aefee8cc1e17c1466233f795ab12d4824c8a0643230e80a914a
5
5
  SHA512:
6
- metadata.gz: 599bd994c3d9abe122ec925c2717b28acf68761fc6dcde7138251c5ba98a35765ad018f3ebb11e4c0c76231e941d6173b475948904bf465b82da96dad22abce0
7
- data.tar.gz: 497bc3626ba25a40dc65791967754f3fb2ccc1fb7d3dd7e89989fd31e982141ca664272d3cc2a5db4db2639fcd04773a7c0603a175638b6bcaef04fa9b8c2871
6
+ metadata.gz: bb71d3477f275efd899a8fd0bf6fac7bf840d2ea39c1e550e38e78b5f7e6479872e8833d005e893d5c7084eea42ce9aac94039ec7aa9edd8acdfcf3cc4a4a9f6
7
+ data.tar.gz: 28bf0a523d3024cd06b48a71a85bef70471679f9c78951b3c04391c91be7f948458b3acde5dbe060ff6e58ead6a1949f5965f51f944b5815dbeb578968959400
@@ -1,3 +1,45 @@
1
+ <a name="v1.52.0"></a>
2
+ ### v1.52.0 (2020-09-10)
3
+
4
+ #### Features
5
+
6
+ * support webdav http methods ([fa1d712](/../../commit/fa1d712))
7
+
8
+ <a name="v1.51.1"></a>
9
+ ### v1.51.1 (2020-08-12)
10
+
11
+ #### Bug Fixes
12
+
13
+ * update thor dependency (#218) ([bf3ce69](/../../commit/bf3ce69))
14
+ * bump rake dependency per CVE-2020-8130 (#219) ([09feaa6](/../../commit/09feaa6))
15
+
16
+ <a name="v1.51.0"></a>
17
+ ### v1.51.0 (2020-06-24)
18
+
19
+
20
+ #### Features
21
+
22
+ * allow individual interactions to be re-run by setting PACT_BROKER_INTERACTION_ID ([a586d80](/../../commit/a586d80))
23
+
24
+
25
+ <a name="v1.50.1"></a>
26
+ ### v1.50.1 (2020-06-15)
27
+
28
+
29
+ #### Bug Fixes
30
+
31
+ * fix integration with pact-message-ruby (#216) ([d2da13e](/../../commit/d2da13e))
32
+
33
+
34
+ <a name="v1.50.0"></a>
35
+ ### v1.50.0 (2020-04-25)
36
+
37
+
38
+ #### Features
39
+
40
+ * Set expected interactions on mock service but without writing them to pact file (#210) ([14f5327](/../../commit/14f5327))
41
+
42
+
1
43
  <a name="v1.49.3"></a>
2
44
  ### v1.49.3 (2020-04-22)
3
45
 
@@ -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
@@ -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
@@ -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
@@ -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.49.3"
3
+ VERSION = "1.52.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.49.3
4
+ version: 1.52.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-04-22 00:00:00.000000000 Z
15
+ date: 2020-09-10 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