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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/pact/provider/pact_source.rb +4 -0
- data/lib/pact/provider/pact_spec_runner.rb +8 -11
- data/lib/pact/provider/rspec.rb +1 -1
- data/lib/pact/provider/rspec/calculate_exit_code.rb +18 -0
- data/lib/pact/provider/rspec/formatter_rspec_3.rb +6 -8
- data/lib/pact/provider/verification_results/publish.rb +1 -1
- data/lib/pact/provider/world.rb +1 -1
- data/lib/pact/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5bc7edfd2afca203239799e173f2245076887f4d38df625bbaec1ddfc655fda
|
4
|
+
data.tar.gz: c71945880bf5878c9e712b67f5b87262b7f72444b1628c12dc8eaec725022653
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8d062c28996f29d6424577b3514baa14510b546d3d914abd8d3d12ad2c626cef82a4dd6a7251b2d05fd3fa1c593e2d86862d3dac1b91c7e6757e9b7d7eaf9d7
|
7
|
+
data.tar.gz: 73feb7558cec7e7dc0b78469951c79a0313e0df86d7c85a677963a499c633b2e0d0877783f57ac2b141bb612cf0de8f9474eb5ccf5c8e7d5d2465d22ae16b73f
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
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
|
data/lib/pact/provider/rspec.rb
CHANGED
@@ -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[:
|
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
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
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
|
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
|
data/lib/pact/provider/world.rb
CHANGED
data/lib/pact/version.rb
CHANGED
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.
|
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
|