pact 1.16.1 → 1.17.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
  SHA1:
3
- metadata.gz: 267331deb30dc707b5eca6e97ba5287216788c28
4
- data.tar.gz: d5ec90edb6af928a1769e7792912233ce1b23734
3
+ metadata.gz: 6bcfd873247f92041435d45719162ebb805c9548
4
+ data.tar.gz: 2d2ed5e94d7d4e147e1930cce0429b9b67bfd7fc
5
5
  SHA512:
6
- metadata.gz: ba3e1ea5c2063da723cab8b0122ecda20594c6289f27ade1e20eb820e5bc77c7929ad6fcb020fc16d4da7fa8971fe254868ccf9e72d08c117ea8a07f6d33ba6e
7
- data.tar.gz: 484c68ed162a8b02453083fecc37931b6d81ea268c3658aa9b3fc3a61d011c90fb42477fb4670e85670dcfff5c03eb83caa3d29b3ca7447e37da7150a227e86e
6
+ metadata.gz: d650e4a9c69cf3796df7d4f1c42ed0ef81346615d0f3db11a1de7df8332dc63823799fb767dab313e87b0f00fa61d16b8e53b37f135fb32f3ff0502a0d7480d6
7
+ data.tar.gz: 773488afc5c1473fde3b3f7a5a33d6452258e4822965ce6fe3130b62eecdd36a31643a14bda1026206ce0277cc45e54a6a50a80ad8a0dd4fdea8d26c994097bc
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@ Do this to generate your change history
2
2
 
3
3
  git log --pretty=format:' * %h - %s (%an, %ad)'
4
4
 
5
+ <a name="v1.17.0"></a>
6
+ ## 1.17.0 (2017-10-27)
7
+
8
+ * 4ae8417 - feat: allow json formatter to be configured for pact verify (Beth Skurrie, Fri Oct 27 16:08:41 2017 +1100)
9
+
5
10
  <a name="v1.16.1"></a>
6
11
  ## 1.16.1 (2017-10-18)
7
12
 
data/lib/pact/cli.rb CHANGED
@@ -16,6 +16,7 @@ module Pact
16
16
  default: Pact.configuration.interactions_replay_order
17
17
  method_option :description, aliases: "-d", desc: "Interaction description filter"
18
18
  method_option :provider_state, aliases: "-s", desc: "Provider state filter"
19
+ method_option :format, aliases: "-f", banner: "FORMATTER", desc: "RSpec formatter. Defaults to custom Pact formatter. [j]son may also be used."
19
20
 
20
21
  def verify
21
22
  require 'pact/cli/run_pact_verification'
@@ -27,8 +27,9 @@ module Pact
27
27
  def initialize_rspec
28
28
  # With RSpec3, if the pact_helper loads a library that adds its own formatter before we set one,
29
29
  # we will get a ProgressFormatter too, and get little dots sprinkled throughout our output.
30
+ # Load a NilFormatter here to prevent that.
30
31
  require 'pact/rspec'
31
- ::RSpec.configuration.add_formatter Pact::RSpec.formatter_class
32
+ ::RSpec.configuration.add_formatter Pact::RSpec.formatter_class.const_get('NilFormatter')
32
33
  end
33
34
 
34
35
  def setup_load_path
@@ -69,7 +70,8 @@ module Pact
69
70
  def pact_spec_options
70
71
  {
71
72
  full_backtrace: options[:backtrace],
72
- criteria: SpecCriteria.call(options)
73
+ criteria: SpecCriteria.call(options),
74
+ format: options[:format]
73
75
  }
74
76
  end
75
77
 
@@ -40,7 +40,7 @@ module Pact
40
40
  def publish_verification_results publish_verification_results
41
41
  self.publish_verification_results = publish_verification_results
42
42
  Pact::RSpec.with_rspec_2 do
43
- puts "WARNING: Publishing of verification results is currently not supported with rspec 2. If you would like this functionality, please feel free to submit a PR!"
43
+ 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!"
44
44
  end
45
45
  end
46
46
 
@@ -20,7 +20,6 @@ module Pact
20
20
 
21
21
  attr_reader :pact_urls
22
22
  attr_reader :options
23
- attr_reader :output
24
23
 
25
24
  def initialize pact_urls, options = {}
26
25
  @pact_urls = pact_urls
@@ -62,10 +61,16 @@ module Pact
62
61
  config.output_stream = Pact.configuration.output_stream
63
62
  end
64
63
 
65
- # Sometimes the formatter set in the cli.rb get set with an output of StringIO.. don't know why
66
- formatter_class = Pact::RSpec.formatter_class
67
- pact_formatter = ::RSpec.configuration.formatters.find {|f| f.class == formatter_class && f.output == ::RSpec.configuration.output_stream}
68
- ::RSpec.configuration.add_formatter formatter_class unless pact_formatter
64
+ if options[:format]
65
+ ::RSpec.configuration.add_formatter options[:format]
66
+ # Don't want to mess up the JSON parsing with messages to stdout, so send it to stderr
67
+ Pact.configuration.output_stream = Pact.configuration.error_stream
68
+ else
69
+ # Sometimes the formatter set in the cli.rb get set with an output of StringIO.. don't know why
70
+ formatter_class = Pact::RSpec.formatter_class
71
+ pact_formatter = ::RSpec.configuration.formatters.find {|f| f.class == formatter_class && f.output == ::RSpec.configuration.output_stream}
72
+ ::RSpec.configuration.add_formatter formatter_class unless pact_formatter
73
+ end
69
74
  ::RSpec.configuration.full_backtrace = @options[:full_backtrace]
70
75
 
71
76
  config.before(:suite) do
@@ -21,9 +21,8 @@ module Pact
21
21
  include ::RSpec::Core::DSL
22
22
 
23
23
  def honour_pactfile pact_uri, pact_json, options
24
- #TODO change puts to use output stream
25
- puts "Reading pact at #{pact_uri}"
26
- puts "Filtering interactions by: #{options[:criteria]}" if options[:criteria] && options[:criteria].any?
24
+ Pact.configuration.output_stream.puts "INFO: Reading pact at #{pact_uri}"
25
+ Pact.configuration.output_stream.puts "INFO: Filtering interactions by: #{options[:criteria]}" if options[:criteria] && options[:criteria].any?
27
26
  consumer_contract = Pact::ConsumerContract.from_json(pact_json)
28
27
  ::RSpec.describe "Verifying a pact between #{consumer_contract.consumer.name} and #{consumer_contract.provider.name}", pactfile_uri: pact_uri do
29
28
  honour_consumer_contract consumer_contract, options.merge(pact_json: pact_json)
@@ -8,6 +8,11 @@ module Pact
8
8
  module RSpec
9
9
  class Formatter2 < ::RSpec::Core::Formatters::DocumentationFormatter
10
10
 
11
+ class NilFormatter < ::RSpec::Core::Formatters::DocumentationFormatter
12
+ def dump_commands_to_rerun_failed_examples
13
+ end
14
+ end
15
+
11
16
  C = ::Term::ANSIColor
12
17
 
13
18
  def dump_commands_to_rerun_failed_examples
@@ -6,8 +6,17 @@ require 'pact/provider/help/prompt_text'
6
6
  module Pact
7
7
  module Provider
8
8
  module RSpec
9
+
9
10
  class Formatter < ::RSpec::Core::Formatters::DocumentationFormatter
10
11
 
12
+ class NilFormatter < ::RSpec::Core::Formatters::BaseFormatter
13
+ Pact::RSpec.with_rspec_3 do
14
+ ::RSpec::Core::Formatters.register self, :start, :example_group_started, :close
15
+ end
16
+ def dump_summary(summary)
17
+ end
18
+ end
19
+
11
20
  Pact::RSpec.with_rspec_3 do
12
21
  ::RSpec::Core::Formatters.register self, :example_group_started, :example_group_finished,
13
22
  :example_passed, :example_pending, :example_failed
@@ -23,7 +23,7 @@ module Pact
23
23
  if publication_url
24
24
  publish
25
25
  else
26
- puts "WARNING: Cannot publish verification for #{consumer_name} as there is no link named pb:publish-verification-results in the pact JSON. If you are using a pact broker, please upgrade to version 2.0.0 or later."
26
+ Pact.configuration.error_stream.puts "WARN: Cannot publish verification for #{consumer_name} as there is no link named pb:publish-verification-results in the pact JSON. If you are using a pact broker, please upgrade to version 2.0.0 or later."
27
27
  end
28
28
  end
29
29
  end
@@ -64,7 +64,7 @@ module Pact
64
64
  request.basic_auth pact_source.uri.username, pact_source.uri.password
65
65
  debug_uri = URI(uri.to_s).tap { |x| x.userinfo="#{pact_source.uri.username}:*****"}
66
66
  end
67
- puts "Publishing verification result #{verification_result.to_json} to #{debug_uri}"
67
+ Pact.configuration.output_stream.puts "INFO: Publishing verification result #{verification_result.to_json} to #{debug_uri}"
68
68
  request
69
69
  end
70
70
 
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.16.1"
3
+ VERSION = "1.17.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.16.1
4
+ version: 1.17.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: 2017-10-17 00:00:00.000000000 Z
15
+ date: 2017-10-27 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: randexp