pact 1.55.1 → 1.55.2

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: 45d7bf4200800cfb20da16b3ef95edc19597badec66d4a4fd716e4229a8a2923
4
- data.tar.gz: cdca3dd4e2401c5f5d0a8994c2dc3cecf47317e6ba0714acac8cc7cab819d9b7
3
+ metadata.gz: b5bc7edfd2afca203239799e173f2245076887f4d38df625bbaec1ddfc655fda
4
+ data.tar.gz: c71945880bf5878c9e712b67f5b87262b7f72444b1628c12dc8eaec725022653
5
5
  SHA512:
6
- metadata.gz: e3d19e95dd00a6252a0e45611b36b8a53c360eb99d5611f0a116de45362a675ba3ed0752619bda3b09b91a1fa0c27a9cf10f714aced846c29ef6c1138fbbb097
7
- data.tar.gz: 5e4d07194b139e690e2fe87d70e23141621b4f438295aa6fff2d0f132d1d8ffe9ab148691bc998b7bbf486067d0885082de538cc6ec06876f77f1476f5730bd4
6
+ metadata.gz: b8d062c28996f29d6424577b3514baa14510b546d3d914abd8d3d12ad2c626cef82a4dd6a7251b2d05fd3fa1c593e2d86862d3dac1b91c7e6757e9b7d7eaf9d7
7
+ data.tar.gz: 73feb7558cec7e7dc0b78469951c79a0313e0df86d7c85a677963a499c633b2e0d0877783f57ac2b141bb612cf0de8f9474eb5ccf5c8e7d5d2465d22ae16b73f
@@ -1,3 +1,10 @@
1
+ <a name="v1.55.2"></a>
2
+ ### v1.55.2 (2020-09-26)
3
+
4
+ #### Bug Fixes
5
+
6
+ * correctly calculate exit code when a mix of pending and non pending pacts are verified ([533faa1](/../../commit/533faa1))
7
+
1
8
  <a name="v1.55.1"></a>
2
9
  ### v1.55.1 (2020-09-26)
3
10
 
@@ -20,6 +20,10 @@ module Pact
20
20
  @pact_hash ||= JSON.load(pact_json, nil, { max_nesting: 50 })
21
21
  end
22
22
 
23
+ def pending?
24
+ uri.metadata[:pending]
25
+ end
26
+
23
27
  def hal_entity
24
28
  http_client_keys = [:username, :password, :token]
25
29
  http_client_options = uri.options.reject{ |k, _| !http_client_keys.include?(k) }
@@ -11,6 +11,7 @@ require 'pact/provider/verification_results/publish_all'
11
11
  require 'pact/provider/rspec/pact_broker_formatter'
12
12
  require 'pact/provider/rspec/json_formatter'
13
13
  require 'pact/provider/rspec'
14
+ require 'pact/provider/rspec/calculate_exit_code'
14
15
 
15
16
  module Pact
16
17
  module Provider
@@ -79,6 +80,7 @@ module Pact
79
80
  executing_with_ruby = executing_with_ruby?
80
81
 
81
82
  config.after(:suite) do | suite |
83
+ Pact.provider_world.failed_examples = suite.reporter.failed_examples
82
84
  Pact::Provider::Help::Write.call(Pact.provider_world.pact_sources) if executing_with_ruby
83
85
  end
84
86
  end
@@ -90,7 +92,12 @@ module Pact
90
92
  ::RSpec::Core::CommandLine.new(NoConfigurationOptions.new)
91
93
  .run(::RSpec.configuration.output_stream, ::RSpec.configuration.error_stream)
92
94
  end
93
- pending_mode? ? 0 : exit_code
95
+
96
+ if options[:ignore_failures]
97
+ 0
98
+ else
99
+ Pact::Provider::RSpec::CalculateExitCode.call(pact_sources, Pact.provider_world.failed_examples)
100
+ end
94
101
  end
95
102
 
96
103
  def rspec_runner_options
@@ -147,8 +154,6 @@ module Pact
147
154
  end
148
155
 
149
156
  ::RSpec.configuration.full_backtrace = @options[:full_backtrace]
150
-
151
- ::RSpec.configuration.failure_color = :yellow if pending_mode?
152
157
  end
153
158
 
154
159
  def ordered_pact_json(pact_json)
@@ -159,20 +164,12 @@ module Pact
159
164
  consumer_contract.to_json
160
165
  end
161
166
 
162
- def all_pacts_pending?
163
- pact_urls.all?{ | pact_url| pact_url.metadata[:pending] }
164
- end
165
-
166
167
  def class_exists? name
167
168
  Kernel.const_get name
168
169
  rescue NameError
169
170
  false
170
171
  end
171
172
 
172
- def pending_mode?
173
- (all_pacts_pending? || options[:ignore_failures])
174
- end
175
-
176
173
  def executing_with_ruby?
177
174
  ENV['PACT_EXECUTING_LANGUAGE'] == 'ruby'
178
175
  end
@@ -89,7 +89,7 @@ module Pact
89
89
  pact_interaction_example_description: interaction_description_for_rerun_command(interaction),
90
90
  pact_uri: options[:pact_uri],
91
91
  pact_source: options[:pact_source],
92
- pact_ignore_failures: options[:pact_uri].metadata[:pending] || options[:ignore_failures],
92
+ pact_ignore_failures: options[:pact_source].pending? || options[:ignore_failures],
93
93
  pact_consumer_contract: options[:consumer_contract],
94
94
  pact_criteria: options[:criteria]
95
95
  }
@@ -0,0 +1,18 @@
1
+ module Pact
2
+ module Provider
3
+ module RSpec
4
+ module CalculateExitCode
5
+ def self.call(pact_sources, failed_examples)
6
+ any_non_pending_failures = pact_sources.any? do |pact_source|
7
+ if pact_source.pending?
8
+ nil
9
+ else
10
+ failed_examples.select { |e| e.metadata[:pact_source] == pact_source }.any?
11
+ end
12
+ end
13
+ any_non_pending_failures ? 1 : 0
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -65,10 +65,6 @@ module Pact
65
65
  pending_interaction_examples(summary).size
66
66
  end
67
67
 
68
- def ignore_failures?(summary)
69
- summary.failed_examples.any?{ |e| e.metadata[:pact_ignore_failures] }
70
- end
71
-
72
68
  def failure_title summary
73
69
  ::RSpec::Core::Formatters::Helpers.pluralize(failed_interactions_count(summary), "failure")
74
70
  end
@@ -96,12 +92,14 @@ module Pact
96
92
  interaction_rerun_commands(pending_interaction_examples(summary)).each do | message |
97
93
  output.puts(message)
98
94
  end
95
+ set_rspec_failure_color(:red)
99
96
  end
100
97
 
101
- set_rspec_failure_color(:red)
102
- output.puts("\nFailed interactions:\n\n")
103
- interaction_rerun_commands(failed_interaction_examples(summary)).each do | message |
104
- output.puts(message)
98
+ if failed_interactions_count(summary) > 0
99
+ output.puts("\nFailed interactions:\n\n")
100
+ interaction_rerun_commands(failed_interaction_examples(summary)).each do | message |
101
+ output.puts(message)
102
+ end
105
103
  end
106
104
  end
107
105
 
@@ -81,7 +81,7 @@ module Pact
81
81
  Pact.configuration.output_stream.puts "INFO: Tagging version #{provider_application_version} of #{provider_name} as #{tag.inspect}"
82
82
  tag_entity = tag_link.expand(version: provider_application_version, tag: tag).put
83
83
  unless tag_entity.success?
84
- raise PublicationError.new("Error returned from tagging request #{tag_entity.response.code} #{tag_entity.response.body}")
84
+ raise PublicationError.new("Error returned from tagging request: status=#{tag_entity.response.code} body=#{tag_entity.response.body}")
85
85
  end
86
86
  end
87
87
  end
@@ -14,7 +14,7 @@ module Pact
14
14
  module Provider
15
15
  class World
16
16
 
17
- attr_accessor :pact_sources
17
+ attr_accessor :pact_sources, :failed_examples
18
18
 
19
19
  def provider_states
20
20
  @provider_states_proxy ||= Pact::Provider::State::ProviderStateProxy.new
@@ -1,4 +1,4 @@
1
1
  # Remember to bump pact-provider-proxy when this changes major version
2
2
  module Pact
3
- VERSION = "1.55.1"
3
+ VERSION = "1.55.2"
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.55.1
4
+ version: 1.55.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Fraser
@@ -352,6 +352,7 @@ files:
352
352
  - lib/pact/provider/request.rb
353
353
  - lib/pact/provider/rspec.rb
354
354
  - lib/pact/provider/rspec/backtrace_formatter.rb
355
+ - lib/pact/provider/rspec/calculate_exit_code.rb
355
356
  - lib/pact/provider/rspec/custom_options_file
356
357
  - lib/pact/provider/rspec/formatter_rspec_2.rb
357
358
  - lib/pact/provider/rspec/formatter_rspec_3.rb