pact 1.41.2 → 1.48.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 (37) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +133 -0
  3. data/lib/pact/cli/run_pact_verification.rb +20 -6
  4. data/lib/pact/consumer/configuration/dsl.rb +0 -1
  5. data/lib/pact/consumer/spec_hooks.rb +2 -2
  6. data/lib/pact/doc/sort_interactions.rb +2 -3
  7. data/lib/pact/hal/http_client.rb +11 -5
  8. data/lib/pact/hal/link.rb +50 -13
  9. data/lib/pact/hal/non_json_entity.rb +28 -0
  10. data/lib/pact/pact_broker/fetch_pact_uris_for_verification.rb +102 -0
  11. data/lib/pact/pact_broker/notices.rb +34 -0
  12. data/lib/pact/pact_broker.rb +10 -4
  13. data/lib/pact/provider/configuration/dsl.rb +6 -1
  14. data/lib/pact/provider/configuration/message_provider_dsl.rb +32 -0
  15. data/lib/pact/provider/configuration/pact_verification_from_broker.rb +22 -4
  16. data/lib/pact/provider/configuration/service_provider_dsl.rb +1 -1
  17. data/lib/pact/provider/help/content.rb +4 -4
  18. data/lib/pact/provider/help/pact_diff.rb +10 -34
  19. data/lib/pact/provider/help/write.rb +6 -7
  20. data/lib/pact/provider/pact_helper_locator.rb +0 -1
  21. data/lib/pact/provider/pact_source.rb +10 -1
  22. data/lib/pact/provider/pact_spec_runner.rb +24 -16
  23. data/lib/pact/provider/pact_uri.rb +6 -4
  24. data/lib/pact/provider/request.rb +1 -1
  25. data/lib/pact/provider/rspec/formatter_rspec_3.rb +1 -1
  26. data/lib/pact/provider/rspec/json_formatter.rb +98 -0
  27. data/lib/pact/provider/rspec/pact_broker_formatter.rb +1 -1
  28. data/lib/pact/provider/rspec.rb +17 -7
  29. data/lib/pact/provider/test_methods.rb +1 -1
  30. data/lib/pact/provider/verification_results/publish.rb +3 -0
  31. data/lib/pact/provider/verification_results/publish_all.rb +14 -1
  32. data/lib/pact/provider/verification_results/verification_result.rb +1 -4
  33. data/lib/pact/provider/world.rb +1 -1
  34. data/lib/pact/version.rb +1 -1
  35. data/pact.gemspec +11 -13
  36. metadata +55 -58
  37. data/lib/pact/pact_broker/fetch_pending_pacts.rb +0 -58
@@ -1,6 +1,6 @@
1
1
  require 'pact/shared/dsl'
2
2
  require 'pact/provider/world'
3
- require 'pact/pact_broker/fetch_pacts'
3
+ require 'pact/pact_broker/fetch_pact_uris_for_verification'
4
4
  require 'pact/errors'
5
5
 
6
6
  module Pact
@@ -14,10 +14,11 @@ 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, :_basic_auth_options, :_verbose
17
+ attr_accessor :_provider_name, :_pact_broker_base_url, :_consumer_version_tags, :_provider_version_tags, :_basic_auth_options, :_verbose
18
18
 
19
- def initialize(provider_name)
19
+ def initialize(provider_name, provider_version_tags)
20
20
  @_provider_name = provider_name
21
+ @_provider_version_tags = provider_version_tags
21
22
  @_consumer_version_tags = []
22
23
  @_verbose = false
23
24
  end
@@ -45,10 +46,27 @@ module Pact
45
46
  private
46
47
 
47
48
  def create_pact_verification
48
- fetch_pacts = Pact::PactBroker::FetchPacts.new(_provider_name, _consumer_version_tags, _pact_broker_base_url, _basic_auth_options.merge(verbose: _verbose))
49
+ fetch_pacts = Pact::PactBroker::FetchPactURIsForVerification.new(
50
+ _provider_name,
51
+ consumer_version_selectors,
52
+ _provider_version_tags,
53
+ _pact_broker_base_url,
54
+ _basic_auth_options.merge(verbose: _verbose)
55
+ )
56
+
49
57
  Pact.provider_world.add_pact_uri_source fetch_pacts
50
58
  end
51
59
 
60
+ def consumer_version_selectors
61
+ # TODO support "all"
62
+ _consumer_version_tags.collect do | tag |
63
+ {
64
+ tag: tag,
65
+ latest: true
66
+ }
67
+ end
68
+ end
69
+
52
70
  def validate
53
71
  raise Pact::Error.new("Please provide a pact_broker_base_url from which to retrieve the pacts") unless _pact_broker_base_url
54
72
  end
@@ -65,7 +65,7 @@ module Pact
65
65
  end
66
66
 
67
67
  def create_pact_verification_from_broker(&block)
68
- PactVerificationFromBroker.build(name, &block)
68
+ PactVerificationFromBroker.build(name, tags, &block)
69
69
  end
70
70
 
71
71
  def finalize
@@ -5,8 +5,8 @@ module Pact
5
5
  module Help
6
6
  class Content
7
7
 
8
- def initialize pact_jsons
9
- @pact_jsons = pact_jsons
8
+ def initialize pact_sources
9
+ @pact_sources = pact_sources
10
10
  end
11
11
 
12
12
  def text
@@ -15,7 +15,7 @@ module Pact
15
15
 
16
16
  private
17
17
 
18
- attr_reader :pact_jsons
18
+ attr_reader :pact_sources
19
19
 
20
20
  def help_text
21
21
  temp_dir = Pact.configuration.tmp_dir
@@ -28,7 +28,7 @@ module Pact
28
28
  end
29
29
 
30
30
  def pact_diffs
31
- pact_jsons.collect do | pact_json |
31
+ pact_sources.collect do | pact_json |
32
32
  PactDiff.call(pact_json)
33
33
  end.compact.join("\n")
34
34
  end
@@ -1,26 +1,24 @@
1
+ require 'pact/hal/entity'
2
+
1
3
  module Pact
2
4
  module Provider
3
5
  module Help
4
-
5
6
  class PactDiff
6
-
7
7
  class PrintPactDiffError < StandardError; end
8
8
 
9
- attr_reader :pact_json, :output
9
+ attr_reader :pact_source, :output
10
10
 
11
- def initialize pact_json
12
- @pact_json = pact_json
11
+ def initialize pact_source
12
+ @pact_source = pact_source
13
13
  end
14
14
 
15
- def self.call pact_json
16
- new(pact_json).call
15
+ def self.call pact_source
16
+ new(pact_source).call
17
17
  end
18
18
 
19
19
  def call
20
20
  begin
21
- if diff_rel && diff_url
22
- header + "\n" + get_diff
23
- end
21
+ header + "\n" + get_diff
24
22
  rescue PrintPactDiffError => e
25
23
  return e.message
26
24
  end
@@ -32,35 +30,13 @@ module Pact
32
30
  "The following changes have been made since the previous distinct version of this pact, and may be responsible for verification failure:\n"
33
31
  end
34
32
 
35
- def pact_hash
36
- @pact_hash ||= json_load(pact_json)
37
- end
38
-
39
- def links
40
- pact_hash['_links'] || pact_hash['links']
41
- end
42
-
43
- def diff_rel
44
- return nil unless links
45
- key = links.keys.find { | key | key =~ /diff/ && key =~ /distinct/ && key =~ /previous/}
46
- key ? links[key] : nil
47
- end
48
-
49
- def diff_url
50
- diff_rel['href']
51
- end
52
-
53
33
  def get_diff
54
34
  begin
55
- open(diff_url) { | file | file.read }
35
+ pact_source.hal_entity._link!("pb:diff-previous-distinct").get!(nil, "Accept" => "text/plain").body
56
36
  rescue StandardError => e
57
- raise PrintPactDiffError.new("Tried to retrieve diff with previous pact from #{diff_url}, but received response code #{e}.")
37
+ raise PrintPactDiffError.new("Tried to retrieve diff with previous pact, but received error #{e.class} #{e.message}.")
58
38
  end
59
39
  end
60
-
61
- def json_load json
62
- JSON.load(json, nil, { max_nesting: 50 })
63
- end
64
40
  end
65
41
  end
66
42
  end
@@ -9,12 +9,12 @@ module Pact
9
9
 
10
10
  HELP_FILE_NAME = 'help.md'
11
11
 
12
- def self.call pact_jsons, reports_dir = Pact.configuration.reports_dir
13
- new(pact_jsons, reports_dir).call
12
+ def self.call pact_sources, reports_dir = Pact.configuration.reports_dir
13
+ new(pact_sources, reports_dir).call
14
14
  end
15
15
 
16
- def initialize pact_jsons, reports_dir
17
- @pact_jsons = pact_jsons
16
+ def initialize pact_sources, reports_dir
17
+ @pact_sources = pact_sources
18
18
  @reports_dir = File.expand_path(reports_dir)
19
19
  end
20
20
 
@@ -25,7 +25,7 @@ module Pact
25
25
 
26
26
  private
27
27
 
28
- attr_reader :reports_dir, :pact_jsons
28
+ attr_reader :reports_dir, :pact_sources
29
29
 
30
30
  def clean_reports_dir
31
31
  raise "Cleaning report dir #{reports_dir} would delete project!" if reports_dir_contains_pwd
@@ -46,9 +46,8 @@ module Pact
46
46
  end
47
47
 
48
48
  def help_text
49
- Content.new(pact_jsons).text
49
+ Content.new(pact_sources).text
50
50
  end
51
-
52
51
  end
53
52
  end
54
53
  end
@@ -22,4 +22,3 @@ module Pact
22
22
  end
23
23
  end
24
24
  end
25
-
@@ -1,10 +1,12 @@
1
1
  require 'pact/consumer_contract/pact_file'
2
+ require 'pact/hal/http_client'
3
+ require 'pact/hal/entity'
2
4
 
3
5
  module Pact
4
6
  module Provider
5
7
  class PactSource
6
8
 
7
- attr_reader :uri
9
+ attr_reader :uri # PactURI class
8
10
 
9
11
  def initialize uri
10
12
  @uri = uri
@@ -17,6 +19,13 @@ module Pact
17
19
  def pact_hash
18
20
  @pact_hash ||= JSON.load(pact_json, nil, { max_nesting: 50 })
19
21
  end
22
+
23
+ def hal_entity
24
+ http_client_keys = [:username, :password, :token]
25
+ http_client_options = uri.options.reject{ |k, _| !http_client_keys.include?(k) }
26
+ http_client = Pact::Hal::HttpClient.new(http_client_options)
27
+ Pact::Hal::Entity.new(uri, pact_hash, http_client)
28
+ end
20
29
  end
21
30
  end
22
31
  end
@@ -9,9 +9,8 @@ require 'pact/provider/pact_source'
9
9
  require 'pact/provider/help/write'
10
10
  require 'pact/provider/verification_results/publish_all'
11
11
  require 'pact/provider/rspec/pact_broker_formatter'
12
-
13
- require_relative 'rspec'
14
-
12
+ require 'pact/provider/rspec/json_formatter'
13
+ require 'pact/provider/rspec'
15
14
 
16
15
  module Pact
17
16
  module Provider
@@ -80,7 +79,7 @@ module Pact
80
79
  executing_with_ruby = executing_with_ruby?
81
80
 
82
81
  config.after(:suite) do | suite |
83
- Pact::Provider::Help::Write.call(jsons) if executing_with_ruby
82
+ Pact::Provider::Help::Write.call(Pact.provider_world.pact_sources) if executing_with_ruby
84
83
  end
85
84
  end
86
85
 
@@ -91,7 +90,7 @@ module Pact
91
90
  ::RSpec::Core::CommandLine.new(NoConfigurationOptions.new)
92
91
  .run(::RSpec.configuration.output_stream, ::RSpec.configuration.error_stream)
93
92
  end
94
- options[:ignore_failures] ? 0 : exit_code
93
+ pending_mode? ? 0 : exit_code
95
94
  end
96
95
 
97
96
  def rspec_runner_options
@@ -118,12 +117,12 @@ module Pact
118
117
 
119
118
  def initialize_specs
120
119
  pact_sources.each do | pact_source |
121
- options = {
122
- criteria: @options[:criteria],
123
- ignore_failures: @options[:ignore_failures],
124
- request_customizer: @options[:request_customizer]
120
+ spec_options = {
121
+ criteria: options[:criteria],
122
+ ignore_failures: options[:ignore_failures],
123
+ request_customizer: options[:request_customizer]
125
124
  }
126
- honour_pactfile pact_source.uri, ordered_pact_json(pact_source.pact_json), options
125
+ honour_pactfile pact_source, ordered_pact_json(pact_source.pact_json), spec_options
127
126
  end
128
127
  end
129
128
 
@@ -134,11 +133,12 @@ module Pact
134
133
 
135
134
  output = options[:out] || Pact.configuration.output_stream
136
135
  if options[:format]
137
- ::RSpec.configuration.add_formatter options[:format], output
138
- if !options[:out]
139
- # Don't want to mess up the JSON parsing with messages to stdout, so send it to stderr
140
- Pact.configuration.output_stream = Pact.configuration.error_stream
141
- end
136
+ formatter = options[:format] == 'json' ? Pact::Provider::RSpec::JsonFormatter : options[:format]
137
+ # Send formatted output to $stdout for parsing, unless a file is specified
138
+ output = options[:out] || $stdout
139
+ ::RSpec.configuration.add_formatter formatter, output
140
+ # Don't want to mess up the JSON parsing with INFO and DEBUG messages to stdout, so send it to stderr
141
+ Pact.configuration.output_stream = Pact.configuration.error_stream if !options[:out]
142
142
  else
143
143
  # Sometimes the formatter set in the cli.rb get set with an output of StringIO.. don't know why
144
144
  formatter_class = Pact::RSpec.formatter_class
@@ -148,7 +148,7 @@ module Pact
148
148
 
149
149
  ::RSpec.configuration.full_backtrace = @options[:full_backtrace]
150
150
 
151
- ::RSpec.configuration.failure_color = :yellow if @options[:ignore_failures]
151
+ ::RSpec.configuration.failure_color = :yellow if pending_mode?
152
152
  end
153
153
 
154
154
  def ordered_pact_json(pact_json)
@@ -159,12 +159,20 @@ module Pact
159
159
  consumer_contract.to_json
160
160
  end
161
161
 
162
+ def all_pacts_pending?
163
+ pact_urls.all?{ | pact_url| pact_url.metadata[:pending] }
164
+ end
165
+
162
166
  def class_exists? name
163
167
  Kernel.const_get name
164
168
  rescue NameError
165
169
  false
166
170
  end
167
171
 
172
+ def pending_mode?
173
+ (all_pacts_pending? || options[:ignore_failures])
174
+ end
175
+
168
176
  def executing_with_ruby?
169
177
  ENV['PACT_EXECUTING_LANGUAGE'] == 'ruby'
170
178
  end
@@ -1,17 +1,19 @@
1
1
  module Pact
2
2
  module Provider
3
3
  class PactURI
4
- attr_reader :uri, :options
4
+ attr_reader :uri, :options, :metadata
5
5
 
6
- def initialize (uri, options={})
6
+ def initialize (uri, options = nil, metadata = nil)
7
7
  @uri = uri
8
- @options = options
8
+ @options = options || {}
9
+ @metadata = metadata || {} # make sure it's not nil if nil is passed in
9
10
  end
10
11
 
11
12
  def == other
12
13
  other.is_a?(PactURI) &&
13
14
  uri == other.uri &&
14
- options == other.options
15
+ options == other.options &&
16
+ metadata == other.metadata
15
17
  end
16
18
 
17
19
  def basic_auth?
@@ -54,7 +54,7 @@ module Pact
54
54
  end
55
55
 
56
56
  def rack_request_header_for header
57
- with_http_prefix(header.to_s.upcase).gsub('-', '_')
57
+ with_http_prefix(header.to_s.upcase).tr('-', '_')
58
58
  end
59
59
 
60
60
  def rack_request_value_for value
@@ -6,13 +6,13 @@ require 'pact/provider/help/prompt_text'
6
6
  module Pact
7
7
  module Provider
8
8
  module RSpec
9
-
10
9
  class Formatter < ::RSpec::Core::Formatters::DocumentationFormatter
11
10
 
12
11
  class NilFormatter < ::RSpec::Core::Formatters::BaseFormatter
13
12
  Pact::RSpec.with_rspec_3 do
14
13
  ::RSpec::Core::Formatters.register self, :start, :example_group_started, :close
15
14
  end
15
+
16
16
  def dump_summary(summary)
17
17
  end
18
18
  end
@@ -0,0 +1,98 @@
1
+ require 'rspec/core/formatters/json_formatter'
2
+
3
+ module Pact
4
+ module Provider
5
+ module RSpec
6
+ class JsonFormatter < ::RSpec::Core::Formatters::JsonFormatter
7
+ ::RSpec::Core::Formatters.register self, :message, :dump_summary, :dump_profile, :stop, :seed, :close
8
+
9
+ def dump_summary(summary)
10
+ super(create_custom_summary(summary))
11
+ output_hash[:summary][:pacts] = pacts(summary)
12
+ end
13
+
14
+ def format_example(example)
15
+ {
16
+ :id => example.id,
17
+ :interaction_index => example.metadata[:pact_interaction].index,
18
+ :description => example.description,
19
+ :full_description => example.full_description,
20
+ :status => calculate_status(example),
21
+ :file_path => example.metadata[:file_path],
22
+ :line_number => example.metadata[:line_number],
23
+ :run_time => example.execution_result.run_time,
24
+ :mismatches => extract_differences(example),
25
+ :pact_url => example.metadata[:pact_uri].uri
26
+ }
27
+ end
28
+
29
+ def stop(notification)
30
+ output_hash[:examples] = notification.examples.map do |example|
31
+ format_example(example).tap do |hash|
32
+ e = example.exception
33
+ # No point providing a backtrace for a mismatch, too much noise
34
+ if e && ! e.is_a?(::RSpec::Expectations::ExpectationNotMetError)
35
+ hash[:exception] = {
36
+ :class => e.class.name,
37
+ :message => e.message,
38
+ :backtrace => e.backtrace,
39
+ }
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ def calculate_status(example)
46
+ if example.execution_result.status == :failed && example.metadata[:pact_ignore_failures]
47
+ 'pending'
48
+ else
49
+ example.execution_result.status.to_s
50
+ end
51
+ end
52
+
53
+ # There will most likely be only one pact associated with this RSpec execution, because
54
+ # the most likely user of this formatter is the Go implementation that parses the JSON
55
+ # and builds Go tests from them.
56
+ # If the JSON formatter is used by someone else and they have multiple pacts, all the notices
57
+ # for the pacts will be mushed together in one collection, so it will be hard to know which notice
58
+ # belongs to which pact.
59
+ def pacts(summary)
60
+ unique_pact_metadatas(summary).collect do | example_metadata |
61
+ pact_uri = example_metadata[:pact_uri]
62
+ notices = (pact_uri.metadata[:notices] && pact_uri.metadata[:notices].before_verification_notices) || []
63
+ {
64
+ notices: notices,
65
+ url: pact_uri.uri,
66
+ consumer_name: example_metadata[:pact_consumer_contract].consumer.name,
67
+ provider_name: example_metadata[:pact_consumer_contract].provider.name,
68
+ short_description: pact_uri.metadata[:short_description]
69
+ }
70
+ end
71
+ end
72
+
73
+ def unique_pact_metadatas(summary)
74
+ summary.examples.collect(&:metadata).group_by{ | metadata | metadata[:pact_uri].uri }.values.collect(&:first)
75
+ end
76
+
77
+ def create_custom_summary(summary)
78
+ ::RSpec::Core::Notifications::SummaryNotification.new(
79
+ summary.duration,
80
+ summary.examples,
81
+ summary.examples.select{ | example | example.execution_result.status == :failed && !example.metadata[:pact_ignore_failures] },
82
+ summary.examples.select{ | example | example.execution_result.status == :failed && example.metadata[:pact_ignore_failures] },
83
+ summary.load_time,
84
+ summary.errors_outside_of_examples_count
85
+ )
86
+ end
87
+
88
+ def extract_differences(example)
89
+ if example.metadata[:pact_diff]
90
+ Pact::Matchers::ExtractDiffMessages.call(example.metadata[:pact_diff]).to_a
91
+ else
92
+ []
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -66,7 +66,7 @@ module Pact
66
66
  if example.metadata[:pact_diff]
67
67
  hash[:differences] = Pact::Matchers::ExtractDiffMessages.call(example.metadata[:pact_diff])
68
68
  .to_a
69
- .collect{ | description | {description: description} }
69
+ .collect{ | description | { description: description } }
70
70
  end
71
71
  end
72
72
  end
@@ -17,16 +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
- pact_description = options[:ignore_failures] ? "Pending pact" : "pact"
25
- Pact.configuration.output_stream.puts "INFO: Reading #{pact_description} at #{pact_uri}"
26
- Pact.configuration.output_stream.puts "INFO: Filtering interactions by: #{options[:criteria]}" if options[:criteria] && options[:criteria].any?
24
+ def honour_pactfile pact_source, pact_json, options
25
+ pact_uri = pact_source.uri
26
+ Pact.configuration.output_stream.puts "INFO: Reading pact at #{pact_uri}"
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?
27
34
  consumer_contract = Pact::ConsumerContract.from_json(pact_json)
28
- ::RSpec.describe "Verifying a #{pact_description} between #{consumer_contract.consumer.name} and #{consumer_contract.provider.name}", pactfile_uri: pact_uri do
29
- 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)
30
38
  end
31
39
  end
32
40
 
@@ -74,7 +82,9 @@ module Pact
74
82
  pact_interaction: interaction,
75
83
  pact_interaction_example_description: interaction_description_for_rerun_command(interaction),
76
84
  pact_uri: options[:pact_uri],
77
- pact_ignore_failures: options[:ignore_failures]
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]
78
88
  }
79
89
 
80
90
  describe description_for(interaction), metadata do
@@ -46,7 +46,7 @@ module Pact
46
46
  def tear_down_provider_states provider_states, consumer, options = {}
47
47
  # If there are no provider state, execute with an nil state to ensure global and base states are executed
48
48
  Pact.configuration.provider_state_tear_down.call(nil, consumer, options) if provider_states.nil? || provider_states.empty?
49
- provider_states.reverse.each do | provider_state |
49
+ provider_states.reverse_each do | provider_state |
50
50
  Pact.configuration.provider_state_tear_down.call(provider_state.name, consumer, options.merge(params: provider_state.params))
51
51
  end
52
52
  end
@@ -33,6 +33,9 @@ module Pact
33
33
  if can_publish_verification_results?
34
34
  tag_versions_if_configured
35
35
  publish_verification_results
36
+ true
37
+ else
38
+ false
36
39
  end
37
40
  end
38
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
@@ -31,10 +32,6 @@ module Pact
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/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.41.2"
3
+ VERSION = "1.48.0"
4
4
  end