pact 1.48.0 → 1.50.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: bf71975a44b67d9faeb43a80011d0ead09414a0effc2ae080036ebd44e0d8c2d
4
- data.tar.gz: 2161386666d724d2cebf7c1dda996880072c89046f3296f1bc1cffd178b0f259
3
+ metadata.gz: 72dbb710ec5471bb551465a8f55342f32cc057cb2a6d36a7f1b4ec613e90fb19
4
+ data.tar.gz: b0c3329c670d4704517df5eeb79b4cbb8d874c2a52151851009a211d3ab89d36
5
5
  SHA512:
6
- metadata.gz: a753e3b4f884b640707600f948c83e5f4a99bf8d9d3c5250f28aa9b6f11b5aed3154aa9459bad25dc17e96be1ace9b25944b46a69076a5d2734ab18a1711f90e
7
- data.tar.gz: a6dc4d42755cde3d2c94e3a0a1bb5c6405db7c4397744a0800bb1fea9d5764365ef60d47e474c4b3c037029531762ddcbd0da6940e931b15b0fe4650a6902ef1
6
+ metadata.gz: 8a4fed394938fb5ad9489f79df8b06589d5982cc289cf45fd0c8a5056a23b875b48be9efb3b082e34477935ffbc7b7416a1de5daa9183bf9c2dbd20ba548f503
7
+ data.tar.gz: b8b501317bb1e1446d1776c7c3d9e5674632475cae4cbd4a5e38f726c374463a23000f95760e432c48cc3cee46fd74dbff17dae6226d5f614f4972f4938a2df2
@@ -1,3 +1,49 @@
1
+ <a name="v1.50.0"></a>
2
+ ### v1.50.0 (2020-04-25)
3
+
4
+
5
+ #### Features
6
+
7
+ * Set expected interactions on mock service but without writing them to pact file (#210) ([14f5327](/../../commit/14f5327))
8
+
9
+
10
+ <a name="v1.49.3"></a>
11
+ ### v1.49.3 (2020-04-22)
12
+
13
+
14
+ #### Bug Fixes
15
+
16
+ * pact selection verification options logging ([9ff59f4](/../../commit/9ff59f4))
17
+
18
+
19
+ <a name="v1.49.2"></a>
20
+ ### v1.49.2 (2020-04-08)
21
+
22
+
23
+ #### Bug Fixes
24
+
25
+ * json parser error for top level JSON values ([dafbc35](/../../commit/dafbc35))
26
+
27
+
28
+ <a name="v1.49.1"></a>
29
+ ### v1.49.1 (2020-03-21)
30
+
31
+
32
+ #### Bug Fixes
33
+
34
+ * ensure diff is included in the json output ([0bd9753](/../../commit/0bd9753))
35
+ * ensure the presence of basic auth credentials does not cause an error when displaying the path of a pact on the local filesystem ([f6a0b4d](/../../commit/f6a0b4d))
36
+
37
+
38
+ <a name="v1.49.0"></a>
39
+ ### v1.49.0 (2020-02-18)
40
+
41
+
42
+ #### Features
43
+
44
+ * use environment variables PACT_BROKER_USERNAME and PACT_BROKER_PASSWORD when verifying a pact by URL, if the environment variables are present ([308f25d](/../../commit/308f25d))
45
+
46
+
1
47
  <a name="v1.48.0"></a>
2
48
  ### v1.48.0 (2020-02-13)
3
49
 
@@ -56,9 +56,11 @@ module Pact
56
56
 
57
57
  def run_with_pact_url_string
58
58
  pact_repository_uri_options = {}
59
+ pact_repository_uri_options[:username] = ENV['PACT_BROKER_USERNAME'] if ENV['PACT_BROKER_USERNAME']
60
+ pact_repository_uri_options[:password] = ENV['PACT_BROKER_PASSWORD'] if ENV['PACT_BROKER_PASSWORD']
61
+ pact_repository_uri_options[:token] = ENV['PACT_BROKER_TOKEN']
59
62
  pact_repository_uri_options[:username] = options[:pact_broker_username] if options[:pact_broker_username]
60
63
  pact_repository_uri_options[:password] = options[:pact_broker_password] if options[:pact_broker_password]
61
- pact_repository_uri_options[:token] = ENV['PACT_BROKER_TOKEN']
62
64
  pact_uri = ::Pact::Provider::PactURI.new(options[:pact_uri], pact_repository_uri_options)
63
65
  Pact::Provider::PactSpecRunner.new([pact_uri], pact_spec_options).run
64
66
  end
@@ -25,6 +25,10 @@ module Pact
25
25
  @mock_service_base_url = "http://#{attributes[:host]}:#{attributes[:port]}"
26
26
  end
27
27
 
28
+ def without_writing_to_pact
29
+ interaction_builder.without_writing_to_pact
30
+ end
31
+
28
32
  def given(provider_state)
29
33
  interaction_builder.given(provider_state)
30
34
  end
@@ -13,6 +13,12 @@ module Pact
13
13
  @callback = block
14
14
  end
15
15
 
16
+ def without_writing_to_pact
17
+ interaction.metadata ||= {}
18
+ interaction.metadata[:write_to_pact] = false
19
+ self
20
+ end
21
+
16
22
  def upon_receiving description
17
23
  @interaction.description = description
18
24
  self
@@ -4,10 +4,12 @@ require 'pact/provider/pact_uri'
4
4
  require 'pact/errors'
5
5
  require 'pact/pact_broker/fetch_pacts'
6
6
  require 'pact/pact_broker/notices'
7
+ require 'pact/pact_broker/pact_selection_description'
7
8
 
8
9
  module Pact
9
10
  module PactBroker
10
11
  class FetchPactURIsForVerification
12
+ include PactSelectionDescription
11
13
  attr_reader :provider, :consumer_version_selectors, :provider_version_tags, :broker_base_url, :http_client_options, :http_client, :options
12
14
 
13
15
  PACTS_FOR_VERIFICATION_RELATION = 'beta:provider-pacts-for-verification'.freeze
@@ -84,18 +86,7 @@ module Pact
84
86
  end
85
87
 
86
88
  def log_message
87
- latest = consumer_version_selectors.any? ? "" : "latest "
88
- message = "INFO: Fetching pacts for #{provider} from #{broker_base_url} with the selection criteria: "
89
- if consumer_version_selectors.any?
90
- desc = consumer_version_selectors.collect do |selector|
91
- all_or_latest = selector[:all] ? "all for tag" : "latest for tag"
92
- # TODO support fallback
93
- name = selector[:fallback] ? "#{selector[:tag]} (or #{selector[:fallback]} if not found)" : selector[:tag]
94
- "#{all_or_latest} #{name}"
95
- end.join(", ")
96
- message << ": #{desc}"
97
- end
98
- Pact.configuration.output_stream.puts message
89
+ Pact.configuration.output_stream.puts "INFO: #{pact_selection_description(provider, consumer_version_selectors, options, broker_base_url)}"
99
90
  end
100
91
  end
101
92
  end
@@ -0,0 +1,24 @@
1
+ module Pact
2
+ module PactBroker
3
+ module PactSelectionDescription
4
+ def pact_selection_description(provider, consumer_version_selectors, options, broker_base_url)
5
+ latest = consumer_version_selectors.any? ? "" : "latest "
6
+ message = "Fetching pacts for #{provider} from #{broker_base_url} with the selection criteria: "
7
+ if consumer_version_selectors.any?
8
+ desc = consumer_version_selectors.collect do |selector|
9
+ all_or_latest = !selector[:latest] ? "all for tag" : "latest for tag"
10
+ # TODO support fallback
11
+ fallback = selector[:fallback] || selector[:fallbackTag]
12
+ name = fallback ? "#{selector[:tag]} (or #{fallback} if not found)" : selector[:tag]
13
+ "#{all_or_latest} #{name}"
14
+ end.join(", ")
15
+ if options[:include_wip_pacts_since]
16
+ desc = "#{desc}, work in progress pacts created after #{options[:include_wip_pacts_since]}"
17
+ end
18
+ message << "#{desc}"
19
+ end
20
+ message
21
+ end
22
+ end
23
+ end
24
+ end
@@ -29,10 +29,10 @@ module Pact
29
29
  end
30
30
 
31
31
  def to_s
32
- if(basic_auth?)
32
+ if basic_auth? && uri.start_with?('http://', 'https://')
33
33
  URI(@uri).tap { |x| x.userinfo="#{username}:*****"}.to_s
34
34
  else
35
- @uri
35
+ uri
36
36
  end
37
37
  end
38
38
  end
@@ -30,13 +30,15 @@ module Pact
30
30
  output_hash[:examples] = notification.examples.map do |example|
31
31
  format_example(example).tap do |hash|
32
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)
33
+ if e
35
34
  hash[:exception] = {
36
- :class => e.class.name,
37
- :message => e.message,
38
- :backtrace => e.backtrace,
35
+ class: e.class.name,
36
+ message: e.message,
39
37
  }
38
+ # No point providing a backtrace for a mismatch, too much noise
39
+ if !e.is_a?(::RSpec::Expectations::ExpectationNotMetError)
40
+ hash[:exception][:backtrace]
41
+ end
40
42
  end
41
43
  end
42
44
  end
@@ -29,7 +29,9 @@ module Pact
29
29
  def parse_body_from_response rack_response
30
30
  case rack_response.headers['Content-Type']
31
31
  when /json/
32
- JSON.load(rack_response.body)
32
+ # For https://github.com/pact-foundation/pact-net/issues/237
33
+ # Only required for the pact-ruby-standalone ¯\_(ツ)_/¯
34
+ JSON.load("[#{rack_response.body}]").first
33
35
  else
34
36
  rack_response.body
35
37
  end
@@ -1,4 +1,4 @@
1
1
  # Remember to bump pact-provider-proxy when this changes major version
2
2
  module Pact
3
- VERSION = "1.48.0"
3
+ VERSION = "1.50.0"
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.48.0
4
+ version: 1.50.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: 2020-02-13 00:00:00.000000000 Z
15
+ date: 2020-06-01 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -319,6 +319,7 @@ files:
319
319
  - lib/pact/pact_broker/fetch_pact_uris_for_verification.rb
320
320
  - lib/pact/pact_broker/fetch_pacts.rb
321
321
  - lib/pact/pact_broker/notices.rb
322
+ - lib/pact/pact_broker/pact_selection_description.rb
322
323
  - lib/pact/project_root.rb
323
324
  - lib/pact/provider.rb
324
325
  - lib/pact/provider/configuration.rb