pact 1.49.0 → 1.50.1

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: d23bb31e12922ffa6334faa9105770afc780d97310296dd48f120613e12cee63
4
- data.tar.gz: 89178f9552aabbf8099e65f3a10864303f53370b7ea76f841be6401d5667a66d
3
+ metadata.gz: 5b098430ba170a2290f1ae9c18b8d94ea7c2e968f5e8f3bd48c4e34155b4ea0d
4
+ data.tar.gz: 3b5f51717c2ba8934df7bf0fdbe9d68c74096e0058eeeae4f75804becd8366f3
5
5
  SHA512:
6
- metadata.gz: 0a1f2a19a89eacda8db9a85b08d538821bf8ff25986ea6e8d5df4b84ea798bd41dd9136b6a0f894b3a513bf538055b734d7335d585279653822c81e3bfb49fb0
7
- data.tar.gz: e9b962314733660dd23127eab1076abda1391000de6d9f0f647fbdb5353cc37c79c6c308be6e04c16d9b1e5e341a38ea531f6e6fa7174852edbcb5f4c9dfc46e
6
+ metadata.gz: '0049d4e11c748ebf653da1a754168d82198c73975cd30d16a67a4bcd837490740a30271b16a012612d19100b0a1c7139b5945e5f29686930407436a0acb47584'
7
+ data.tar.gz: 8e2e895e155d37650d5d677f062c9a4d391132beae3884144978cd41438bfa4c979caa33fc2a2623013b23cdd1c67e403d5506b84ed32def9c22be5e5a97f568
@@ -1,3 +1,49 @@
1
+ <a name="v1.50.1"></a>
2
+ ### v1.50.1 (2020-06-15)
3
+
4
+
5
+ #### Bug Fixes
6
+
7
+ * fix integration with pact-message-ruby (#216) ([d2da13e](/../../commit/d2da13e))
8
+
9
+
10
+ <a name="v1.50.0"></a>
11
+ ### v1.50.0 (2020-04-25)
12
+
13
+
14
+ #### Features
15
+
16
+ * Set expected interactions on mock service but without writing them to pact file (#210) ([14f5327](/../../commit/14f5327))
17
+
18
+
19
+ <a name="v1.49.3"></a>
20
+ ### v1.49.3 (2020-04-22)
21
+
22
+
23
+ #### Bug Fixes
24
+
25
+ * pact selection verification options logging ([9ff59f4](/../../commit/9ff59f4))
26
+
27
+
28
+ <a name="v1.49.2"></a>
29
+ ### v1.49.2 (2020-04-08)
30
+
31
+
32
+ #### Bug Fixes
33
+
34
+ * json parser error for top level JSON values ([dafbc35](/../../commit/dafbc35))
35
+
36
+
37
+ <a name="v1.49.1"></a>
38
+ ### v1.49.1 (2020-03-21)
39
+
40
+
41
+ #### Bug Fixes
42
+
43
+ * ensure diff is included in the json output ([0bd9753](/../../commit/0bd9753))
44
+ * 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))
45
+
46
+
1
47
  <a name="v1.49.0"></a>
2
48
  ### v1.49.0 (2020-02-18)
3
49
 
@@ -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
@@ -22,6 +22,33 @@ module Pact
22
22
  end
23
23
 
24
24
  dsl do
25
+ def app &block
26
+ self.app_block = block
27
+ end
28
+
29
+ def app_version application_version
30
+ self.application_version = application_version
31
+ end
32
+
33
+ def app_version_tags tags
34
+ self.tags = tags
35
+ end
36
+
37
+ def publish_verification_results publish_verification_results
38
+ self.publish_verification_results = publish_verification_results
39
+ Pact::RSpec.with_rspec_2 do
40
+ Pact.configuration.error_stream.puts "WARN: Publishing of verification results is currently not supported with rspec 2. If you would like this functionality, please feel free to submit a PR!"
41
+ end
42
+ end
43
+
44
+ def honours_pact_with consumer_name, options = {}, &block
45
+ create_pact_verification consumer_name, options, &block
46
+ end
47
+
48
+ def honours_pacts_from_pact_broker &block
49
+ create_pact_verification_from_broker &block
50
+ end
51
+
25
52
  def builder &block
26
53
  self.app_block = lambda { RackToMessageAdapter.new(block) }
27
54
  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.49.0"
3
+ VERSION = "1.50.1"
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.49.0
4
+ version: 1.50.1
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-17 00:00:00.000000000 Z
15
+ date: 2020-06-15 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