pact 1.62.0 → 1.63.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: 7b4004f1a6eed7b4222d8f6f4bd72eb568c75fd198ab77ee663b6aab918ea907
4
- data.tar.gz: f6cc541f1416275a0cea5b0819d20f58e6b27d8ca10e8f708b0d44d382b88461
3
+ metadata.gz: 3bbef2d45df174d528bf23ecd3c5b380196789c842d49b32dd7c49478aca0942
4
+ data.tar.gz: ef0bdd2ea78d03ab7db7eec95c5b5e293495ce5aab33d614daca1ffe4215229b
5
5
  SHA512:
6
- metadata.gz: 31ce201c07203749e19cb6ca6d1088ef69f1119686119519ab5e15faddda38f80f2846b782efb2e7cb4c3e26bb9df529e45fcc1350df2be63819fbfde50c54e5
7
- data.tar.gz: 3fa2538f3f8472759eafcd12b8ef829141f343e5cdab8c83ba27bd4f4f1ca0eee1e960fb2467333b17da30a29c8bc849427178c5dc7566e2c94d948cd109a96e
6
+ metadata.gz: 30e6ab38f2b4475474af538a149ba504462a36438f9b2cd2a4ccf148c2081ee92c973b3bb0d61d07edf19389869e631b6bc7011d4a758b54f752baa341eec715
7
+ data.tar.gz: abc1767938dcc4e417b3d76798c742f7e4bccbd850cd19cd3034d9ad9e28502c063c5b3272ac75cfd98c008dd5e3786e7a8708fb3f8b3332bb933c6a6b8c1acb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ <a name="v1.63.0"></a>
2
+ ### v1.63.0 (2022-09-28)
3
+
4
+ #### Features
5
+
6
+ * relax rack-test dependency to allow version 2 (#270) ([a619deb](/../../commit/a619deb))
7
+ * only print metrics warning once per thread ([91da38f](/../../commit/91da38f))
8
+ * provide configuration for build url to be published in verification results (#252) ([ce1c9bc](/../../commit/ce1c9bc))
9
+
10
+ #### Bug Fixes
11
+
12
+ * example/animal-service/Gemfile to reduce vulnerabilities (#263) ([8f3b732](/../../commit/8f3b732))
13
+ * Fixup ruby warnings (#262) ([3640593](/../../commit/3640593))
14
+
1
15
  <a name="v1.62.0"></a>
2
16
  ### v1.62.0 (2022-02-21)
3
17
 
@@ -46,7 +46,7 @@ module Pact
46
46
  end
47
47
 
48
48
  def honours_pacts_from_pact_broker &block
49
- create_pact_verification_from_broker &block
49
+ create_pact_verification_from_broker(&block)
50
50
  end
51
51
 
52
52
  def builder &block
@@ -4,14 +4,15 @@ module Pact
4
4
  class ServiceProviderConfig
5
5
 
6
6
  attr_accessor :application_version
7
- attr_reader :branch
7
+ attr_reader :branch, :build_url
8
8
 
9
- def initialize application_version, branch, tags, publish_verification_results, &app_block
9
+ def initialize application_version, branch, tags, publish_verification_results, build_url, &app_block
10
10
  @application_version = application_version
11
11
  @branch = branch
12
12
  @tags = [*tags]
13
13
  @publish_verification_results = publish_verification_results
14
14
  @app_block = app_block
15
+ @build_url = build_url
15
16
  end
16
17
 
17
18
  def app
@@ -15,7 +15,7 @@ module Pact
15
15
 
16
16
  extend Pact::DSL
17
17
 
18
- attr_accessor :name, :app_block, :application_version, :branch, :tags, :publish_verification_results
18
+ attr_accessor :name, :app_block, :application_version, :branch, :tags, :publish_verification_results, :build_url
19
19
 
20
20
  CONFIG_RU_APP = lambda {
21
21
  unless File.exist? Pact.configuration.config_ru_path
@@ -48,6 +48,10 @@ module Pact
48
48
  self.branch = branch
49
49
  end
50
50
 
51
+ def build_url build_url
52
+ self.build_url = build_url
53
+ end
54
+
51
55
  def publish_verification_results publish_verification_results
52
56
  self.publish_verification_results = publish_verification_results
53
57
  Pact::RSpec.with_rspec_2 do
@@ -60,7 +64,7 @@ module Pact
60
64
  end
61
65
 
62
66
  def honours_pacts_from_pact_broker &block
63
- create_pact_verification_from_broker &block
67
+ create_pact_verification_from_broker(&block)
64
68
  end
65
69
  end
66
70
 
@@ -89,7 +93,7 @@ module Pact
89
93
  end
90
94
 
91
95
  def create_service_provider
92
- Pact.configuration.provider = ServiceProviderConfig.new(application_version, branch, tags, publish_verification_results, &@app_block)
96
+ Pact.configuration.provider = ServiceProviderConfig.new(application_version, branch, tags, publish_verification_results, build_url, &@app_block)
93
97
  end
94
98
  end
95
99
  end
@@ -3,7 +3,7 @@ module Pact
3
3
  class PactURI
4
4
  attr_reader :uri, :options, :metadata
5
5
 
6
- def initialize (uri, options = nil, metadata = nil)
6
+ def initialize(uri, options = nil, metadata = nil)
7
7
  @uri = uri
8
8
  @options = options || {}
9
9
  @metadata = metadata || {} # make sure it's not nil if nil is passed in
@@ -12,11 +12,11 @@ module Pact
12
12
  end
13
13
 
14
14
  def set_up &block
15
- ProviderStates.base_provider_state.register.register_set_up &block
15
+ ProviderStates.base_provider_state.register.register_set_up(&block)
16
16
  end
17
17
 
18
18
  def tear_down &block
19
- ProviderStates.base_provider_state.register_tear_down &block
19
+ ProviderStates.base_provider_state.register_tear_down(&block)
20
20
  end
21
21
 
22
22
  def provider_states_for name, &block
@@ -60,7 +60,7 @@ module Pact
60
60
  end
61
61
 
62
62
  def self.namespaced_name name, options = {}
63
- fullname = options[:for] ? "#{options[:for]}.#{name}" : name
63
+ options[:for] ? "#{options[:for]}.#{name}" : name
64
64
  end
65
65
  end
66
66
 
@@ -81,11 +81,11 @@ module Pact
81
81
 
82
82
  dsl do
83
83
  def set_up &block
84
- self.register_set_up &block
84
+ self.register_set_up(&block)
85
85
  end
86
86
 
87
87
  def tear_down &block
88
- self.register_tear_down &block
88
+ self.register_tear_down(&block)
89
89
  end
90
90
 
91
91
  def no_op
@@ -14,7 +14,13 @@ module Pact
14
14
  end
15
15
 
16
16
  def call
17
- VerificationResult.new(publishable?, !any_failures?, Pact.configuration.provider.application_version, test_results_hash_for_pact_uri)
17
+ VerificationResult.new(
18
+ publishable?,
19
+ !any_failures?,
20
+ Pact.configuration.provider.application_version,
21
+ test_results_hash_for_pact_uri,
22
+ Pact.configuration.provider.build_url
23
+ )
18
24
  end
19
25
 
20
26
  private
@@ -6,11 +6,12 @@ module Pact
6
6
  class VerificationResult
7
7
  attr_reader :success, :provider_application_version, :test_results_hash
8
8
 
9
- def initialize publishable, success, provider_application_version, test_results_hash
9
+ def initialize publishable, success, provider_application_version, test_results_hash, build_url
10
10
  @publishable = publishable
11
11
  @success = success
12
12
  @provider_application_version = provider_application_version
13
13
  @test_results_hash = test_results_hash
14
+ @build_url = build_url
14
15
  end
15
16
 
16
17
  def publishable?
@@ -25,7 +26,8 @@ module Pact
25
26
  {
26
27
  success: success,
27
28
  providerApplicationVersion: provider_application_version,
28
- testResults: test_results_hash
29
+ testResults: test_results_hash,
30
+ buildUrl: @build_url
29
31
  }.to_json(options)
30
32
  end
31
33
 
@@ -9,13 +9,17 @@ module Pact
9
9
  class Metrics
10
10
 
11
11
  def self.report_metric(event, category, action, value = 1)
12
+ do_once_per_thread(:pact_metrics_message_shown) do
13
+ if track_events?
14
+ Pact.configuration.output_stream.puts "pact WARN: Please note: we are tracking events anonymously to gather important usage statistics like Pact-Ruby version
15
+ and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment
16
+ variable to 'true'."
17
+ end
18
+ end
19
+
12
20
  in_thread do
13
21
  begin
14
22
  if track_events?
15
- Pact.configuration.output_stream.puts "WARN: Please note: we are tracking events anonymously to gather important usage statistics like Pact-Ruby version
16
- and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment
17
- variable to 'true'."
18
-
19
23
  uri = URI('https://www.google-analytics.com/collect')
20
24
  req = Net::HTTP::Post.new(uri)
21
25
  req.set_form_data(create_tracking_event(event, category, action, value))
@@ -31,6 +35,7 @@ module Pact
31
35
  end
32
36
 
33
37
  private
38
+
34
39
  def self.handle_error e
35
40
  if ENV['PACT_METRICS_DEBUG'] == 'true'
36
41
  Pact.configuration.output_stream.puts("DEBUG: #{e.inspect}\n" + e.backtrace.join("\n"))
@@ -43,6 +48,16 @@ module Pact
43
48
  end
44
49
  end
45
50
 
51
+ # not super safe to use the thread, but it's good enough for this usecase
52
+ def self.do_once_per_thread(key)
53
+ result = nil
54
+ if !Thread.current[key]
55
+ result = yield
56
+ end
57
+ Thread.current[key] = true
58
+ result
59
+ end
60
+
46
61
  def self.create_tracking_event(event, category, action, value)
47
62
  {
48
63
  "v" => 1,
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.62.0"
3
+ VERSION = "1.63.0"
4
4
  end
data/pact.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |gem|
27
27
  }
28
28
 
29
29
  gem.add_runtime_dependency 'rspec', '~> 3.0'
30
- gem.add_runtime_dependency 'rack-test', '>= 0.6.3', '< 2.0.0'
30
+ gem.add_runtime_dependency 'rack-test', '>= 0.6.3', '< 3.0.0'
31
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'
@@ -39,8 +39,8 @@ Gem::Specification.new do |gem|
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'
42
- gem.add_development_dependency 'activesupport', '~> 5.2'
43
- gem.add_development_dependency 'faraday', '~> 0.13'
42
+ gem.add_development_dependency 'faraday', '~>1.0', '<3.0'
43
+ gem.add_development_dependency 'faraday-multipart', '~> 1.0'
44
44
  gem.add_development_dependency 'conventional-changelog', '~> 1.3'
45
45
  gem.add_development_dependency 'bump', '~> 0.5'
46
46
  gem.add_development_dependency 'pact-message', '~> 0.8'
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.62.0
4
+ version: 1.63.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: 2022-02-21 00:00:00.000000000 Z
15
+ date: 2022-09-29 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -37,7 +37,7 @@ dependencies:
37
37
  version: 0.6.3
38
38
  - - "<"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.0.0
40
+ version: 3.0.0
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
@@ -47,7 +47,7 @@ dependencies:
47
47
  version: 0.6.3
48
48
  - - "<"
49
49
  - !ruby/object:Gem::Version
50
- version: 2.0.0
50
+ version: 3.0.0
51
51
  - !ruby/object:Gem::Dependency
52
52
  name: thor
53
53
  requirement: !ruby/object:Gem::Requirement
@@ -193,33 +193,39 @@ dependencies:
193
193
  - !ruby/object:Gem::Version
194
194
  version: '2.0'
195
195
  - !ruby/object:Gem::Dependency
196
- name: activesupport
196
+ name: faraday
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '5.2'
201
+ version: '1.0'
202
+ - - "<"
203
+ - !ruby/object:Gem::Version
204
+ version: '3.0'
202
205
  type: :development
203
206
  prerelease: false
204
207
  version_requirements: !ruby/object:Gem::Requirement
205
208
  requirements:
206
209
  - - "~>"
207
210
  - !ruby/object:Gem::Version
208
- version: '5.2'
211
+ version: '1.0'
212
+ - - "<"
213
+ - !ruby/object:Gem::Version
214
+ version: '3.0'
209
215
  - !ruby/object:Gem::Dependency
210
- name: faraday
216
+ name: faraday-multipart
211
217
  requirement: !ruby/object:Gem::Requirement
212
218
  requirements:
213
219
  - - "~>"
214
220
  - !ruby/object:Gem::Version
215
- version: '0.13'
221
+ version: '1.0'
216
222
  type: :development
217
223
  prerelease: false
218
224
  version_requirements: !ruby/object:Gem::Requirement
219
225
  requirements:
220
226
  - - "~>"
221
227
  - !ruby/object:Gem::Version
222
- version: '0.13'
228
+ version: '1.0'
223
229
  - !ruby/object:Gem::Dependency
224
230
  name: conventional-changelog
225
231
  requirement: !ruby/object:Gem::Requirement
@@ -413,7 +419,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
413
419
  - !ruby/object:Gem::Version
414
420
  version: '0'
415
421
  requirements: []
416
- rubygems_version: 3.3.7
422
+ rubygems_version: 3.3.22
417
423
  signing_key:
418
424
  specification_version: 4
419
425
  summary: Enables consumer driven contract testing, providing a mock service and DSL