pact 1.28.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.
Files changed (53) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +408 -0
  3. data/lib/pact/cli/run_pact_verification.rb +26 -7
  4. data/lib/pact/cli/spec_criteria.rb +3 -0
  5. data/lib/pact/cli.rb +7 -1
  6. data/lib/pact/consumer/configuration/dsl.rb +0 -1
  7. data/lib/pact/consumer/configuration/mock_service.rb +9 -3
  8. data/lib/pact/consumer/consumer_contract_builder.rb +6 -2
  9. data/lib/pact/consumer/interaction_builder.rb +6 -0
  10. data/lib/pact/consumer/spec_hooks.rb +4 -4
  11. data/lib/pact/doc/sort_interactions.rb +2 -3
  12. data/lib/pact/hal/authorization_header_redactor.rb +32 -0
  13. data/lib/pact/hal/entity.rb +27 -5
  14. data/lib/pact/hal/http_client.rb +25 -7
  15. data/lib/pact/hal/link.rb +67 -20
  16. data/lib/pact/hal/non_json_entity.rb +28 -0
  17. data/lib/pact/pact_broker/fetch_pact_uris_for_verification.rb +93 -0
  18. data/lib/pact/pact_broker/fetch_pacts.rb +20 -18
  19. data/lib/pact/pact_broker/notices.rb +34 -0
  20. data/lib/pact/pact_broker/pact_selection_description.rb +24 -0
  21. data/lib/pact/pact_broker.rb +25 -0
  22. data/lib/pact/provider/configuration/dsl.rb +6 -1
  23. data/lib/pact/provider/configuration/message_provider_dsl.rb +59 -0
  24. data/lib/pact/provider/configuration/pact_verification_from_broker.rb +29 -4
  25. data/lib/pact/provider/configuration/service_provider_dsl.rb +1 -1
  26. data/lib/pact/provider/help/content.rb +4 -4
  27. data/lib/pact/provider/help/pact_diff.rb +10 -34
  28. data/lib/pact/provider/help/write.rb +6 -7
  29. data/lib/pact/provider/pact_helper_locator.rb +13 -11
  30. data/lib/pact/provider/pact_source.rb +10 -1
  31. data/lib/pact/provider/pact_spec_runner.rb +26 -13
  32. data/lib/pact/provider/pact_uri.rb +8 -6
  33. data/lib/pact/provider/request.rb +1 -1
  34. data/lib/pact/provider/rspec/formatter_rspec_3.rb +39 -8
  35. data/lib/pact/provider/rspec/json_formatter.rb +100 -0
  36. data/lib/pact/provider/rspec/pact_broker_formatter.rb +7 -17
  37. data/lib/pact/provider/rspec.rb +24 -11
  38. data/lib/pact/provider/state/provider_state.rb +6 -7
  39. data/lib/pact/provider/state/provider_state_manager.rb +10 -10
  40. data/lib/pact/provider/state/set_up.rb +1 -1
  41. data/lib/pact/provider/state/tear_down.rb +1 -1
  42. data/lib/pact/provider/test_methods.rb +22 -7
  43. data/lib/pact/provider/verification_results/create.rb +6 -0
  44. data/lib/pact/provider/verification_results/publish.rb +5 -8
  45. data/lib/pact/provider/verification_results/publish_all.rb +14 -1
  46. data/lib/pact/provider/verification_results/verification_result.rb +2 -5
  47. data/lib/pact/provider/world.rb +1 -1
  48. data/lib/pact/retry.rb +2 -0
  49. data/lib/pact/tasks/task_helper.rb +10 -4
  50. data/lib/pact/tasks/verification_task.rb +3 -1
  51. data/lib/pact/version.rb +1 -1
  52. data/pact.gemspec +19 -15
  53. metadata +75 -80
@@ -8,23 +8,14 @@ module Pact
8
8
  module RSpec
9
9
  class PactBrokerFormatter < ::RSpec::Core::Formatters::BaseFormatter
10
10
  Pact::RSpec.with_rspec_3 do
11
- ::RSpec::Core::Formatters.register self, :message, :dump_summary, :stop, :seed, :close
11
+ ::RSpec::Core::Formatters.register self, :stop, :close
12
12
  end
13
13
 
14
14
  attr_reader :output_hash
15
15
 
16
16
  def initialize(output)
17
17
  super
18
- @output_hash = {
19
- :version => ::RSpec::Core::Version::STRING
20
- }
21
- end
22
-
23
- def message(notification)
24
- (@output_hash[:messages] ||= []) << notification.message
25
- end
26
-
27
- def dump_summary(summary)
18
+ @output_hash = {}
28
19
  end
29
20
 
30
21
  def stop(notification)
@@ -33,11 +24,6 @@ module Pact
33
24
  .map { |example| format_example(example) }
34
25
  end
35
26
 
36
- def seed(notification)
37
- return unless notification.seed_used?
38
- @output_hash[:seed] = notification.seed
39
- end
40
-
41
27
  def close(_notification)
42
28
  Pact::Provider::VerificationResults::PublishAll.call(Pact.provider_world.pact_sources, output_hash)
43
29
  end
@@ -73,10 +59,14 @@ module Pact
73
59
  hash[:actualBody] = example.metadata[:pact_actual_body]
74
60
  end
75
61
 
62
+ if example.metadata[:pact_actual_contents]
63
+ hash[:actualContents] = example.metadata[:pact_actual_contents]
64
+ end
65
+
76
66
  if example.metadata[:pact_diff]
77
67
  hash[:differences] = Pact::Matchers::ExtractDiffMessages.call(example.metadata[:pact_diff])
78
68
  .to_a
79
- .collect{ | description | {description: description} }
69
+ .collect{ | description | { description: description } }
80
70
  end
81
71
  end
82
72
  end
@@ -17,15 +17,24 @@ module Pact
17
17
  end
18
18
 
19
19
  module ClassMethods
20
+ EMPTY_ARRAY = [].freeze
20
21
 
21
22
  include ::RSpec::Core::DSL
22
23
 
23
- def honour_pactfile pact_uri, pact_json, options
24
+ def honour_pactfile pact_source, pact_json, options
25
+ pact_uri = pact_source.uri
24
26
  Pact.configuration.output_stream.puts "INFO: Reading pact at #{pact_uri}"
25
- Pact.configuration.output_stream.puts "INFO: Filtering interactions by: #{options[:criteria]}" if options[:criteria] && options[:criteria].any?
27
+ if pact_uri.metadata[:notices]
28
+ pact_uri.metadata[:notices].before_verification_notices_text.each do | text |
29
+ Pact.configuration.output_stream.puts("DEBUG: #{text}")
30
+ end
31
+ end
32
+
33
+ Pact.configuration.output_stream.puts "DEBUG: Filtering interactions by: #{options[:criteria]}" if options[:criteria] && options[:criteria].any?
26
34
  consumer_contract = Pact::ConsumerContract.from_json(pact_json)
27
- ::RSpec.describe "Verifying a pact between #{consumer_contract.consumer.name} and #{consumer_contract.provider.name}", pactfile_uri: pact_uri do
28
- honour_consumer_contract consumer_contract, options.merge(pact_json: pact_json, pact_uri: pact_uri)
35
+ suffix = pact_uri.metadata[:pending] ? " [PENDING]": ""
36
+ ::RSpec.describe "Verifying a pact between #{consumer_contract.consumer.name} and #{consumer_contract.provider.name}#{suffix}", pactfile_uri: pact_uri do
37
+ honour_consumer_contract consumer_contract, options.merge(pact_json: pact_json, pact_uri: pact_uri, pact_source: pact_source, consumer_contract: consumer_contract)
29
38
  end
30
39
  end
31
40
 
@@ -72,7 +81,10 @@ module Pact
72
81
  pact: :verify,
73
82
  pact_interaction: interaction,
74
83
  pact_interaction_example_description: interaction_description_for_rerun_command(interaction),
75
- pact_uri: options[:pact_uri]
84
+ pact_uri: options[:pact_uri],
85
+ pact_source: options[:pact_source],
86
+ pact_ignore_failures: options[:pact_uri].metadata[:pending] || options[:ignore_failures],
87
+ pact_consumer_contract: options[:consumer_contract]
76
88
  }
77
89
 
78
90
  describe description_for(interaction), metadata do
@@ -82,15 +94,15 @@ module Pact
82
94
  before do | example |
83
95
  interaction_context.run_once :before do
84
96
  Pact.configuration.logger.info "Running example '#{Pact::RSpec.full_description(example)}'"
85
- set_up_provider_state interaction.provider_state, options[:consumer]
86
- replay_interaction interaction
97
+ set_up_provider_states interaction.provider_states, options[:consumer]
98
+ replay_interaction interaction, options[:request_customizer]
87
99
  interaction_context.last_response = last_response
88
100
  end
89
101
  end
90
102
 
91
103
  after do
92
104
  interaction_context.run_once :after do
93
- tear_down_provider_state interaction.provider_state, options[:consumer]
105
+ tear_down_provider_states interaction.provider_states, options[:consumer]
94
106
  end
95
107
  end
96
108
 
@@ -108,20 +120,21 @@ module Pact
108
120
  include Pact::RSpec::Matchers
109
121
  extend Pact::Matchers::Messages
110
122
 
111
- let(:expected_content) { expected_response.body[:contents].as_json }
123
+ let(:expected_contents) { expected_response.body[:contents].as_json }
112
124
  let(:response) { interaction_context.last_response }
113
125
  let(:differ) { Pact.configuration.body_differ_for_content_type diff_content_type }
114
126
  let(:diff_formatter) { Pact.configuration.diff_formatter_for_content_type diff_content_type }
115
127
  let(:diff_options) { { with: differ, diff_formatter: diff_formatter } }
116
128
  let(:diff_content_type) { 'application/json' }
117
129
  let(:response_body) { parse_body_from_response(response) }
118
- let(:actual_content) { response_body['contents'] }
130
+ let(:actual_contents) { response_body['contents'] }
119
131
 
120
132
  it "has matching content" do | example |
121
133
  if response.status != 200
122
134
  raise "An error was raised while verifying the message. The response body is: #{response.body}"
123
135
  end
124
- expect(actual_content).to match_term expected_content, diff_options, example
136
+ set_metadata(example, :pact_actual_contents, actual_contents)
137
+ expect(actual_contents).to match_term expected_contents, diff_options, example
125
138
  end
126
139
  end
127
140
 
@@ -116,17 +116,17 @@ module Pact
116
116
  @no_op_defined = true
117
117
  end
118
118
 
119
- def set_up
119
+ def set_up params = {}
120
120
  if @set_up_block
121
121
  include_provider_state_configured_modules
122
- instance_eval &@set_up_block
122
+ instance_exec params, &@set_up_block
123
123
  end
124
124
  end
125
125
 
126
- def tear_down
126
+ def tear_down params = {}
127
127
  if @tear_down_block
128
128
  include_provider_state_configured_modules
129
- instance_eval &@tear_down_block
129
+ instance_exec params, &@tear_down_block
130
130
  end
131
131
  end
132
132
 
@@ -168,14 +168,13 @@ module Pact
168
168
 
169
169
  class NoOpProviderState
170
170
 
171
- def self.set_up
171
+ def self.set_up params = {}
172
172
 
173
173
  end
174
174
 
175
- def self.tear_down
175
+ def self.tear_down params = {}
176
176
 
177
177
  end
178
-
179
178
  end
180
179
  end
181
180
  end
@@ -2,27 +2,28 @@ module Pact
2
2
  module Provider::State
3
3
  class ProviderStateManager
4
4
 
5
- attr_reader :provider_state_name, :consumer
5
+ attr_reader :provider_state_name, :params, :consumer
6
6
 
7
- def initialize provider_state_name, consumer
7
+ def initialize provider_state_name, params, consumer
8
8
  @provider_state_name = provider_state_name
9
+ @params = params
9
10
  @consumer = consumer
10
11
  end
11
12
 
12
13
  def set_up_provider_state
13
- get_global_base_provider_state.set_up
14
- get_consumer_base_provider_state.set_up
14
+ get_global_base_provider_state.set_up(params)
15
+ get_consumer_base_provider_state.set_up(params)
15
16
  if provider_state_name
16
- get_provider_state.set_up
17
+ get_provider_state.set_up(params)
17
18
  end
18
19
  end
19
20
 
20
21
  def tear_down_provider_state
21
22
  if provider_state_name
22
- get_provider_state.tear_down
23
+ get_provider_state.tear_down(params)
23
24
  end
24
- get_consumer_base_provider_state.tear_down
25
- get_global_base_provider_state.tear_down
25
+ get_consumer_base_provider_state.tear_down(params)
26
+ get_global_base_provider_state.tear_down(params)
26
27
  end
27
28
 
28
29
  def get_provider_state
@@ -36,7 +37,6 @@ module Pact
36
37
  def get_global_base_provider_state
37
38
  Pact.provider_world.provider_states.get_base
38
39
  end
39
-
40
40
  end
41
41
  end
42
- end
42
+ end
@@ -5,7 +5,7 @@ module Pact
5
5
  module State
6
6
  class SetUp
7
7
  def self.call provider_state_name, consumer, options = {}
8
- State::ProviderStateManager.new(provider_state_name, consumer).set_up_provider_state
8
+ State::ProviderStateManager.new(provider_state_name, options[:params], consumer).set_up_provider_state
9
9
  end
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ module Pact
5
5
  module State
6
6
  class TearDown
7
7
  def self.call provider_state_name, consumer, options = {}
8
- State::ProviderStateManager.new(provider_state_name, consumer).tear_down_provider_state
8
+ State::ProviderStateManager.new(provider_state_name, options[:params], consumer).tear_down_provider_state
9
9
  end
10
10
  end
11
11
  end
@@ -14,13 +14,18 @@ module Pact
14
14
  include Pact::Logging
15
15
  include Rack::Test::Methods
16
16
 
17
- def replay_interaction interaction
17
+ def replay_interaction interaction, request_customizer = nil
18
18
  request = Request::Replayable.new(interaction.request)
19
+ request = request_customizer.call(request, interaction) if request_customizer
19
20
  args = [request.path, request.body, request.headers]
20
21
 
21
22
  logger.info "Sending #{request.method.upcase} request to path: \"#{request.path}\" with headers: #{request.headers}, see debug logs for body"
22
23
  logger.debug "body :#{request.body}"
23
- 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
24
29
  logger.info "Received response with status: #{response.status}, headers: #{response.headers}, see debug logs for body"
25
30
  logger.debug "body: #{response.body}"
26
31
  end
@@ -28,18 +33,28 @@ module Pact
28
33
  def parse_body_from_response rack_response
29
34
  case rack_response.headers['Content-Type']
30
35
  when /json/
31
- JSON.load(rack_response.body)
36
+ # For https://github.com/pact-foundation/pact-net/issues/237
37
+ # Only required for the pact-ruby-standalone ¯\_(ツ)_/¯
38
+ JSON.load("[#{rack_response.body}]").first
32
39
  else
33
40
  rack_response.body
34
41
  end
35
42
  end
36
43
 
37
- def set_up_provider_state provider_state_name, consumer, options = {}
38
- Pact.configuration.provider_state_set_up.call(provider_state_name, consumer, options)
44
+ def set_up_provider_states provider_states, consumer, options = {}
45
+ # If there are no provider state, execute with an nil state to ensure global and base states are executed
46
+ Pact.configuration.provider_state_set_up.call(nil, consumer, options) if provider_states.nil? || provider_states.empty?
47
+ provider_states.each do | provider_state |
48
+ Pact.configuration.provider_state_set_up.call(provider_state.name, consumer, options.merge(params: provider_state.params))
49
+ end
39
50
  end
40
51
 
41
- def tear_down_provider_state provider_state_name, consumer, options = {}
42
- Pact.configuration.provider_state_tear_down.call(provider_state_name, consumer, options)
52
+ def tear_down_provider_states provider_states, consumer, options = {}
53
+ # If there are no provider state, execute with an nil state to ensure global and base states are executed
54
+ Pact.configuration.provider_state_tear_down.call(nil, consumer, options) if provider_states.nil? || provider_states.empty?
55
+ provider_states.reverse_each do | provider_state |
56
+ Pact.configuration.provider_state_tear_down.call(provider_state.name, consumer, options.merge(params: provider_state.params))
57
+ end
43
58
  end
44
59
 
45
60
  def set_metadata example, key, value
@@ -57,6 +57,12 @@ module Pact
57
57
  summary: {
58
58
  testCount: examples_for_pact_uri.size,
59
59
  failureCount: count_failures_for_pact_uri
60
+ },
61
+ metadata: {
62
+ warning: "These test results use a beta format. Do not rely on it, as it will definitely change.",
63
+ pactVerificationResultsSpecification: {
64
+ version: "1.0.0-beta.1"
65
+ }
60
66
  }
61
67
  }
62
68
  end
@@ -24,21 +24,18 @@ module Pact
24
24
  def initialize pact_source, verification_result
25
25
  @pact_source = pact_source
26
26
  @verification_result = verification_result
27
-
28
- http_client_options = {}
29
- if pact_source.uri.basic_auth?
30
- http_client_options[:username] = pact_source.uri.username
31
- http_client_options[:password] = pact_source.uri.password
32
- end
33
-
27
+ http_client_options = pact_source.uri.options.reject{ |k, v| ![:username, :password, :token].include?(k) }
34
28
  @http_client = Pact::Hal::HttpClient.new(http_client_options)
35
- @pact_entity = Pact::Hal::Entity.new(pact_source.pact_hash, http_client)
29
+ @pact_entity = Pact::Hal::Entity.new(pact_source.uri, pact_source.pact_hash, http_client)
36
30
  end
37
31
 
38
32
  def call
39
33
  if can_publish_verification_results?
40
34
  tag_versions_if_configured
41
35
  publish_verification_results
36
+ true
37
+ else
38
+ false
42
39
  end
43
40
  end
44
41
 
@@ -17,7 +17,12 @@ module Pact
17
17
 
18
18
  def call
19
19
  verification_results.collect do | (pact_source, verification_result) |
20
- Publish.call(pact_source, verification_result)
20
+ published = false
21
+ begin
22
+ published = Publish.call(pact_source, verification_result)
23
+ ensure
24
+ print_after_verification_notices(pact_source, verification_result, published)
25
+ end
21
26
  end
22
27
  end
23
28
 
@@ -29,6 +34,14 @@ module Pact
29
34
  end
30
35
  end
31
36
 
37
+ def print_after_verification_notices(pact_source, verification_result, published)
38
+ if pact_source.uri.metadata[:notices]
39
+ pact_source.uri.metadata[:notices].after_verification_notices_text(verification_result.success, published).each do | text |
40
+ Pact.configuration.output_stream.puts "DEBUG: #{text}"
41
+ end
42
+ end
43
+ end
44
+
32
45
  attr_reader :pact_sources, :test_results_hash
33
46
  end
34
47
  end
@@ -4,6 +4,7 @@ module Pact
4
4
  module Provider
5
5
  module VerificationResults
6
6
  class VerificationResult
7
+ attr_reader :success, :provider_application_version, :test_results_hash
7
8
 
8
9
  def initialize publishable, success, provider_application_version, test_results_hash
9
10
  @publishable = publishable
@@ -24,17 +25,13 @@ module Pact
24
25
  {
25
26
  success: success,
26
27
  providerApplicationVersion: provider_application_version,
27
- #testResults: test_results_hash # not yet
28
+ testResults: test_results_hash
28
29
  }.to_json(options)
29
30
  end
30
31
 
31
32
  def to_s
32
33
  "[success: #{success}, providerApplicationVersion: #{provider_application_version}]"
33
34
  end
34
-
35
- private
36
-
37
- attr_reader :success, :provider_application_version, :test_results_hash
38
35
  end
39
36
  end
40
37
  end
@@ -43,7 +43,7 @@ module Pact
43
43
  end
44
44
 
45
45
  def pact_uris_from_pact_uri_sources
46
- pact_uri_sources.collect{| pact_uri_source| pact_uri_source.call }.flatten
46
+ pact_uri_sources.collect(&:call).flatten
47
47
  end
48
48
  end
49
49
  end
data/lib/pact/retry.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'pact/errors'
2
+
1
3
  module Pact
2
4
  class Retry
3
5
  class RescuableError
@@ -7,11 +7,12 @@ 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
 
13
- def execute_pact_verify pact_uri = nil, pact_helper = nil, rspec_opts = nil
14
- execute_cmd verify_command(pact_helper || Pact::Provider::PactHelperLocater.pact_helper_path, pact_uri, rspec_opts)
14
+ def execute_pact_verify pact_uri = nil, pact_helper = nil, rspec_opts = nil, verification_opts = {}
15
+ execute_cmd verify_command(pact_helper || Pact::Provider::PactHelperLocater.pact_helper_path, pact_uri, rspec_opts, verification_opts)
15
16
  end
16
17
 
17
18
  def handle_verification_failure
@@ -19,7 +20,7 @@ module Pact
19
20
  abort if exit_status != 0
20
21
  end
21
22
 
22
- def verify_command pact_helper, pact_uri, rspec_opts
23
+ def verify_command pact_helper, pact_uri, rspec_opts, verification_opts
23
24
  command_parts = []
24
25
  # Clear SPEC_OPTS, otherwise we can get extra formatters, creating duplicate output eg. CI Reporting.
25
26
  # Allow deliberate configuration using rspec_opts in VerificationTask.
@@ -28,11 +29,14 @@ module Pact
28
29
  command_parts << "-S pact verify"
29
30
  command_parts << "--pact-helper" << Shellwords.escape(pact_helper.end_with?(".rb") ? pact_helper : pact_helper + ".rb")
30
31
  (command_parts << "--pact-uri" << pact_uri) if pact_uri
32
+ command_parts << "--ignore-failures" if verification_opts[:ignore_failures]
31
33
  command_parts << "--pact-broker-username" << ENV['PACT_BROKER_USERNAME'] if ENV['PACT_BROKER_USERNAME']
32
34
  command_parts << "--pact-broker-password" << ENV['PACT_BROKER_PASSWORD'] if ENV['PACT_BROKER_PASSWORD']
33
35
  command_parts << "--backtrace" if ENV['BACKTRACE'] == 'true'
34
36
  command_parts << "--description #{Shellwords.escape(ENV['PACT_DESCRIPTION'])}" if ENV['PACT_DESCRIPTION']
35
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']
36
40
  command_parts.flatten.join(" ")
37
41
  end
38
42
 
@@ -40,7 +44,9 @@ module Pact
40
44
  Pact.configuration.output_stream.puts command
41
45
  temporarily_set_env_var 'PACT_EXECUTING_LANGUAGE', 'ruby' do
42
46
  temporarily_set_env_var 'PACT_INTERACTION_RERUN_COMMAND', PACT_INTERACTION_RERUN_COMMAND do
43
- 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
44
50
  end
45
51
  end
46
52
  end
@@ -30,9 +30,11 @@ module Pact
30
30
 
31
31
  attr_reader :pact_spec_configs
32
32
  attr_accessor :rspec_opts
33
+ attr_accessor :ignore_failures
33
34
 
34
35
  def initialize(name)
35
36
  @rspec_opts = nil
37
+ @ignore_failures = false
36
38
  @pact_spec_configs = []
37
39
  @name = name
38
40
  yield self
@@ -74,7 +76,7 @@ module Pact
74
76
  require 'pact/tasks/task_helper'
75
77
 
76
78
  exit_statuses = pact_spec_configs.collect do | config |
77
- Pact::TaskHelper.execute_pact_verify config[:uri], config[:pact_helper], rspec_opts
79
+ Pact::TaskHelper.execute_pact_verify config[:uri], config[:pact_helper], rspec_opts, { ignore_failures: ignore_failures }
78
80
  end
79
81
 
80
82
  Pact::TaskHelper.handle_verification_failure do
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.28.0"
3
+ VERSION = "1.53.0"
4
4
  end
data/pact.gemspec CHANGED
@@ -1,5 +1,4 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'pact/version'
5
4
 
@@ -15,30 +14,35 @@ Gem::Specification.new do |gem|
15
14
  gem.required_ruby_version = '>= 2.0'
16
15
 
17
16
  gem.files = `git ls-files bin lib pact.gemspec CHANGELOG.md LICENSE.txt`.split($/)
18
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
19
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
19
  gem.require_paths = ["lib"]
21
20
  gem.license = 'MIT'
22
21
 
23
- gem.add_runtime_dependency 'randexp', '~> 0.1.7'
24
- gem.add_runtime_dependency 'rspec', '>=2.14'
25
- gem.add_runtime_dependency 'rack-test', '~> 0.6', '>= 0.6.3'
26
- gem.add_runtime_dependency 'thor'
27
- gem.add_runtime_dependency 'json','> 1.8.5'
28
- gem.add_runtime_dependency 'webrick'
22
+ gem.metadata = {
23
+ 'changelog_uri' => 'https://github.com/pact-foundation/pact-ruby/blob/master/CHANGELOG.md',
24
+ 'source_code_uri' => 'https://github.com/pact-foundation/pact-ruby',
25
+ 'bug_tracker_uri' => 'https://github.com/pact-foundation/pact-ruby/issues',
26
+ 'documentation_uri' => 'https://github.com/pact-foundation/pact-ruby/blob/master/README.md'
27
+ }
28
+
29
+ gem.add_runtime_dependency 'rspec', '~> 3.0'
30
+ gem.add_runtime_dependency 'rack-test', '>= 0.6.3', '< 2.0.0'
31
+ gem.add_runtime_dependency 'thor', '>= 0.20', '< 2.0'
32
+ gem.add_runtime_dependency 'webrick', '~> 1.3'
29
33
  gem.add_runtime_dependency 'term-ansicolor', '~> 1.0'
30
34
 
31
- gem.add_runtime_dependency 'pact-support', '~> 1.4'
32
- gem.add_runtime_dependency 'pact-mock_service', '~> 2.0'
35
+ gem.add_runtime_dependency 'pact-support', '~> 1.9'
36
+ gem.add_runtime_dependency 'pact-mock_service', '~> 3.0', '>= 3.3.1'
33
37
 
34
- gem.add_development_dependency 'rake', '~> 10.0.3'
38
+ gem.add_development_dependency 'rake', '~> 13.0'
35
39
  gem.add_development_dependency 'webmock', '~> 3.0'
36
- gem.add_development_dependency 'pry-byebug'
37
40
  gem.add_development_dependency 'fakefs', '0.5' # 0.6.0 blows up
38
41
  gem.add_development_dependency 'hashie', '~> 2.0'
39
- gem.add_development_dependency 'activesupport'
42
+ gem.add_development_dependency 'activesupport', '~> 5.2'
40
43
  gem.add_development_dependency 'faraday', '~> 0.13'
41
- gem.add_development_dependency 'appraisal', '~> 2.2'
42
44
  gem.add_development_dependency 'conventional-changelog', '~> 1.3'
43
45
  gem.add_development_dependency 'bump', '~> 0.5'
46
+ gem.add_development_dependency 'pact-message', '~> 0.6'
47
+ gem.add_development_dependency 'rspec-its', '~> 1.3'
44
48
  end