pact 1.22.0 → 1.23.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98e5eb1496b65c594ed13101b2fc458979b0dcc3
4
- data.tar.gz: '091e47ad1474581a0d6d5fa47c6feded20b10d9a'
3
+ metadata.gz: 2f08c3f242d549648001e7294df45094bf80bdfe
4
+ data.tar.gz: 84c7976f630dcaee652d7c10eb8d6a2bcd9c64a4
5
5
  SHA512:
6
- metadata.gz: 4b222248d8f3d7fc8b5dc5631945b1e44ae1ecb8175d5caea1efda1d57a2073d7e87cc874a52128ce750246170bf141fcb40dcfffb95d00e0f49fc65c1fb9e89
7
- data.tar.gz: e65bd27bd345906792632cfa52a19d4c300e9bdfc3249229849d8ce04a36ff921d69feea8ba86272bbeac1f24bcce861ef213780b5c081d1f83c9e6627ba0e88
6
+ metadata.gz: d844246c78be90a05be79a69901b9d57c27d5f31b6ea4b2ef79160e2b9524b7e56788ba3b5308815e0108dec02c1f977be528af6f69f1f4c3c5debfda60277fa
7
+ data.tar.gz: 508f3d6b351a05dc480122ddca8c4ea86fc7c4169d58e309649ae0e39a07bf7e8ac0960d8bbd12c381cba25bf8fdd4ed5ad2642b2286210af97ce8033e4beff2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ <a name="v1.23.0"></a>
2
+ ### v1.23.0 (2018-04-16)
3
+
4
+
5
+ #### Features
6
+
7
+ * allow --out FILE to be specified for the output from pact verify ([ca19aa8](/../../commit/ca19aa8))
8
+
9
+
10
+ #### Bug Fixes
11
+
12
+ * URL escape file paths in index of generated markdown ([6af19d5](/../../commit/6af19d5))
13
+
14
+
15
+ <a name="v1.22.2"></a>
16
+ ### v1.22.2 (2018-03-24)
17
+
18
+
19
+ #### Bug Fixes
20
+
21
+ * message pact verification code ([1bfa8f3](/../../commit/1bfa8f3))
22
+
23
+
1
24
  <a name="v1.22.0"></a>
2
25
  ### v1.22.0 (2018-03-16)
3
26
 
@@ -14,7 +14,6 @@ module Pact
14
14
  new(options).call
15
15
  end
16
16
 
17
-
18
17
  def call
19
18
  initialize_rspec
20
19
  setup_load_path
@@ -71,10 +70,10 @@ module Pact
71
70
  {
72
71
  full_backtrace: options[:backtrace],
73
72
  criteria: SpecCriteria.call(options),
74
- format: options[:format]
73
+ format: options[:format],
74
+ out: options[:out]
75
75
  }
76
76
  end
77
-
78
77
  end
79
78
  end
80
79
  end
data/lib/pact/cli.rb CHANGED
@@ -17,6 +17,7 @@ module Pact
17
17
  method_option :description, aliases: "-d", desc: "Interaction description filter"
18
18
  method_option :provider_state, aliases: "-s", desc: "Provider state filter"
19
19
  method_option :format, aliases: "-f", banner: "FORMATTER", desc: "RSpec formatter. Defaults to custom Pact formatter. [j]son may also be used."
20
+ method_option :out, aliases: "-o", banner: "FILE", desc: "Write output to a file instead of $stdout."
20
21
 
21
22
  def verify
22
23
  require 'pact/cli/run_pact_verification'
@@ -1,3 +1,5 @@
1
+ require 'erb'
2
+
1
3
  module Pact
2
4
  module Doc
3
5
  module Markdown
@@ -32,7 +34,7 @@ module Pact
32
34
  end
33
35
 
34
36
  def item title, file_name
35
- "* [#{title}](#{file_name})"
37
+ "* [#{title}](#{ERB::Util.url_encode(file_name)})"
36
38
  end
37
39
 
38
40
  end
@@ -62,21 +62,7 @@ module Pact
62
62
  config.output_stream = Pact.configuration.output_stream
63
63
  end
64
64
 
65
- Pact::RSpec.with_rspec_3 do
66
- ::RSpec.configuration.add_formatter Pact::Provider::RSpec::PactBrokerFormatter, StringIO.new
67
- end
68
-
69
- if options[:format]
70
- ::RSpec.configuration.add_formatter options[:format]
71
- # Don't want to mess up the JSON parsing with messages to stdout, so send it to stderr
72
- Pact.configuration.output_stream = Pact.configuration.error_stream
73
- else
74
- # Sometimes the formatter set in the cli.rb get set with an output of StringIO.. don't know why
75
- formatter_class = Pact::RSpec.formatter_class
76
- pact_formatter = ::RSpec.configuration.formatters.find {|f| f.class == formatter_class && f.output == ::RSpec.configuration.output_stream}
77
- ::RSpec.configuration.add_formatter formatter_class unless pact_formatter
78
- end
79
- ::RSpec.configuration.full_backtrace = @options[:full_backtrace]
65
+ configure_output
80
66
 
81
67
  config.before(:suite) do
82
68
  # Preload app before suite so the classes loaded in memory are consistent for
@@ -138,6 +124,28 @@ module Pact
138
124
  end
139
125
  end
140
126
 
127
+ def configure_output
128
+ Pact::RSpec.with_rspec_3 do
129
+ ::RSpec.configuration.add_formatter Pact::Provider::RSpec::PactBrokerFormatter, StringIO.new
130
+ end
131
+
132
+ output = options[:out] || Pact.configuration.output_stream
133
+ if options[:format]
134
+ ::RSpec.configuration.add_formatter options[:format], output
135
+ if !options[:out]
136
+ # Don't want to mess up the JSON parsing with messages to stdout, so send it to stderr
137
+ Pact.configuration.output_stream = Pact.configuration.error_stream
138
+ end
139
+ else
140
+ # Sometimes the formatter set in the cli.rb get set with an output of StringIO.. don't know why
141
+ formatter_class = Pact::RSpec.formatter_class
142
+ pact_formatter = ::RSpec.configuration.formatters.find {|f| f.class == formatter_class && f.output == ::RSpec.configuration.output_stream}
143
+ ::RSpec.configuration.add_formatter(formatter_class, output) unless pact_formatter
144
+ end
145
+
146
+ ::RSpec.configuration.full_backtrace = @options[:full_backtrace]
147
+ end
148
+
141
149
  def ordered_pact_json(pact_json)
142
150
  return pact_json if Pact.configuration.interactions_replay_order == :recorded
143
151
 
@@ -108,7 +108,7 @@ module Pact
108
108
  include Pact::RSpec::Matchers
109
109
  extend Pact::Matchers::Messages
110
110
 
111
- let(:expected_content) { expected_response.body[:content] }
111
+ let(:expected_content) { expected_response.body[:content].as_json }
112
112
  let(:response) { interaction_context.last_response }
113
113
  let(:differ) { Pact.configuration.body_differ_for_content_type diff_content_type }
114
114
  let(:diff_formatter) { Pact.configuration.diff_formatter_for_content_type diff_content_type }
@@ -117,11 +117,11 @@ module Pact
117
117
  let(:response_body) { parse_body_from_response(response) }
118
118
  let(:actual_content) { response_body['content'] }
119
119
 
120
- it "has matching content" do
120
+ it "has matching content" do | example |
121
121
  if response.status != 200
122
122
  raise "An error was raised while verifying the message. The response body is: #{response.body}"
123
123
  end
124
- expect(actual_content).to match_term expected_content, diff_options
124
+ expect(actual_content).to match_term expected_content, diff_options, example
125
125
  end
126
126
  end
127
127
 
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.22.0"
3
+ VERSION = "1.23.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.22.0
4
+ version: 1.23.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: 2018-03-23 00:00:00.000000000 Z
15
+ date: 2018-04-15 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: randexp