pact-mock_service 3.6.1 → 3.9.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: ade883b71cfce9d1a04b2bc298b16c1642add7c2f99036e30cfc89ea233cf175
4
- data.tar.gz: 88877d1b503a1e2e979728fe574be6e830d73d43478ffcf28db89b66e933b23a
3
+ metadata.gz: 27e87ccc6396fefe1efbf08fdec3565431f999d0baece2f465f3c60c93af5887
4
+ data.tar.gz: c6b4c99af70294e44082cec35e1b94e7626cf2a90f491804294120bcde2c6ae6
5
5
  SHA512:
6
- metadata.gz: dcc334183c2b5a48c0e9c7327e5237ffb3d39fd855dbfcc4fd2fbf702c664e3e9360b045e9a978dd3bfa5ab029a631c44dfa25c5cc40c7428fe0a77c61ec9ac2
7
- data.tar.gz: e5f927ec62a5b336581d3323f844e976e00436117ee4e6899dfaadb98c6b97e87d432e3e147d0d47f49ec7f12681625249c4589a4a0fc4f239dc46cc2341e965
6
+ metadata.gz: 84a2589c7758219995e685dcb817b839540a502b38364795a81579245dc3b9f3baf3517e06705580c29a714493be009618c5c7ab2d356b389db0d20d46061f84
7
+ data.tar.gz: 2c0261cd92e97aadda278032f0098912f9d088e835dac58912fa96ad028613c01d1f423378d5b9cbde7c6d20b772e70ab93a997c5b5b7203974248f97f734d0e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,39 @@
1
+ <a name="v3.9.1"></a>
2
+ ### v3.9.1 (2021-06-03)
3
+
4
+ #### Bug Fixes
5
+
6
+ * check for nil body rather than falsey body when determining how to render mocked response Fixes: https://github.com/pact-foundation/pact-mock_service/issues/99 ([d26e520](/../../commit/d26e520))
7
+
8
+ <a name="v3.9.0"></a>
9
+ ### v3.9.0 (2021-05-17)
10
+
11
+ #### Features
12
+
13
+ * pass host into WEBrick options to allow configuration (#128) ([ec234a4](/../../commit/ec234a4))
14
+
15
+ <a name="v3.8.0"></a>
16
+ ### v3.8.0 (2021-02-25)
17
+
18
+ #### Features
19
+
20
+ * include interaction diffs in verification response ([6306693](/../../commit/6306693))
21
+
22
+ <a name="v3.7.0"></a>
23
+ ### v3.7.0 (2020-11-13)
24
+
25
+ #### Features
26
+
27
+ * use Pact::Query.parse_string to parse query string ([6cd0733](/../../commit/6cd0733))
28
+ * do not require files until command is executing ([ad54d0b](/../../commit/ad54d0b))
29
+
30
+ <a name="v3.6.2"></a>
31
+ ### v3.6.2 (2020-08-10)
32
+
33
+ #### Bug Fixes
34
+
35
+ * update thor dependency (#124) ([54b3f85](/../../commit/54b3f85))
36
+
1
37
  <a name="v3.6.1"></a>
2
38
  ### v3.6.1 (2020-04-22)
3
39
 
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  # Pact Mock and Stub Service
3
3
 
4
- [![Build Status](https://travis-ci.org/pact-foundation/pact-mock_service.svg?branch=master)](https://travis-ci.org/pact-foundation/pact-mock_service)
4
+ [![Build Status](https://travis-ci.com/pact-foundation/pact-mock_service.svg?branch=master)](https://travis-ci.com/pact-foundation/pact-mock_service)
5
5
 
6
6
  This codebase provides the HTTP mock and stub service used by implementations of [Pact][pact]. It is packaged as a gem, and as a standalone executable for Mac OSX and Linux and Windows.
7
7
 
@@ -1,4 +1,6 @@
1
1
  require 'cgi/core'
2
+ require 'pact/consumer_contract/query'
3
+
2
4
  module Pact
3
5
  module Consumer
4
6
 
@@ -11,7 +13,7 @@ module Pact
11
13
  }
12
14
 
13
15
  def params_hash env
14
- CGI::parse env["QUERY_STRING"]
16
+ Pact::Query.parse_string(env["QUERY_STRING"])
15
17
  end
16
18
 
17
19
  def request_as_hash_from env
@@ -83,7 +83,7 @@ module Pact
83
83
  end
84
84
 
85
85
  def webrick_opts
86
- opts = { Port: port.nil? ? 0 : port, AccessLog: [], Logger: WEBrick::Log::new(nil, 0) }
86
+ opts = { Host: host.nil? ? 'localhost' : host, Port: port.nil? ? 0 : port, AccessLog: [], Logger: WEBrick::Log::new(nil, 0) }
87
87
  opts.merge!({
88
88
  :SSLCertificate => OpenSSL::X509::Certificate.new(File.open(options[:sslcert]).read) }) if options[:sslcert]
89
89
  opts.merge!({
@@ -1,14 +1,11 @@
1
1
  require 'thor'
2
- require 'webrick/https'
3
- require 'rack/handler/webrick'
4
- require 'fileutils'
5
- require 'pact/mock_service/server/wait_for_server_up'
6
- require 'pact/mock_service/cli/pidfile'
7
- require 'socket'
8
2
 
9
3
  module Pact
10
4
  module MockService
11
5
  class CLI < Thor
6
+ def self.exit_on_failure? # Thor 1.0 deprecation guard
7
+ false
8
+ end
12
9
 
13
10
  PACT_FILE_WRITE_MODE_DESC = "`overwrite` or `merge`. Use `merge` when running multiple mock service instances in parallel for the same consumer/provider pair." +
14
11
  " Ensure the pact file is deleted before running tests when using this option so that interactions deleted from the code are not maintained in the file."
@@ -30,6 +27,7 @@ module Pact
30
27
  method_option :monkeypatch, hide: true
31
28
 
32
29
  def service
30
+ require_common_dependencies
33
31
  require 'pact/mock_service/run'
34
32
  Run.(options)
35
33
  end
@@ -48,6 +46,7 @@ module Pact
48
46
  method_option :sslkey, desc: "Specify the path to the SSL key to use when running the service over HTTPS"
49
47
 
50
48
  def control
49
+ require_common_dependencies
51
50
  require 'pact/mock_service/control_server/run'
52
51
  ControlServer::Run.(options)
53
52
  end
@@ -70,6 +69,7 @@ module Pact
70
69
  method_option :monkeypatch, hide: true
71
70
 
72
71
  def start
72
+ require_common_dependencies
73
73
  start_server(mock_service_pidfile) do
74
74
  service
75
75
  end
@@ -80,6 +80,7 @@ module Pact
80
80
  method_option :pid_dir, desc: "PID dir, defaults to tmp/pids", default: "tmp/pids"
81
81
 
82
82
  def stop
83
+ require_common_dependencies
83
84
  mock_service_pidfile.kill_process
84
85
  end
85
86
 
@@ -100,6 +101,7 @@ module Pact
100
101
  method_option :sslkey, desc: "Specify the path to the SSL key to use when running the service over HTTPS"
101
102
 
102
103
  def restart
104
+ require_common_dependencies
103
105
  restart_server(mock_service_pidfile) do
104
106
  service
105
107
  end
@@ -120,6 +122,7 @@ module Pact
120
122
  method_option :pact_dir, aliases: "-d", desc: "Directory to which the pacts will be written", default: "."
121
123
 
122
124
  def control_start
125
+ require_common_dependencies
123
126
  start_server(control_server_pidfile) do
124
127
  control
125
128
  end
@@ -130,6 +133,7 @@ module Pact
130
133
  method_option :pid_dir, desc: "PID dir, defaults to tmp/pids", default: "tmp/pids"
131
134
 
132
135
  def control_stop
136
+ require_common_dependencies
133
137
  control_server_pidfile.kill_process
134
138
  end
135
139
 
@@ -148,6 +152,7 @@ module Pact
148
152
  method_option :sslkey, desc: "Specify the path to the SSL key to use when running the service over HTTPS"
149
153
 
150
154
  def control_restart
155
+ require_common_dependencies
151
156
  restart_server(control_server_pidfile) do
152
157
  control
153
158
  end
@@ -164,6 +169,15 @@ module Pact
164
169
 
165
170
  no_commands do
166
171
 
172
+ def require_common_dependencies
173
+ require 'webrick/https'
174
+ require 'rack/handler/webrick'
175
+ require 'fileutils'
176
+ require 'pact/mock_service/server/wait_for_server_up'
177
+ require 'pact/mock_service/cli/pidfile'
178
+ require 'socket'
179
+ end
180
+
167
181
  def control_server_pidfile
168
182
  Pidfile.new(pid_dir: options[:pid_dir], name: control_pidfile_name)
169
183
  end
@@ -11,6 +11,9 @@ module Pact
11
11
  # `script --help` to display the help for the default task instead of the command list
12
12
  #
13
13
  class CustomThor < ::Thor
14
+ def self.exit_on_failure? # Thor 1.0 deprecation guard
15
+ false
16
+ end
14
17
 
15
18
  no_commands do
16
19
  def self.start given_args = ARGV, config = {}
@@ -3,9 +3,11 @@ require 'fileutils'
3
3
  module Pact
4
4
  module MockService
5
5
  class CLI < Thor
6
+ def self.exit_on_failure? # Thor 1.0 deprecation guard
7
+ false
8
+ end
6
9
 
7
10
  class Pidfile
8
-
9
11
  attr_accessor :pid_dir, :name, :pid
10
12
 
11
13
  def initialize options
@@ -38,6 +38,10 @@ module Pact
38
38
  expected_interactions - actual_interactions.matched_interactions - @actual_interactions.interaction_mismatches.collect(&:candidate_interactions).flatten
39
39
  end
40
40
 
41
+ def interaction_mismatches
42
+ actual_interactions.interaction_mismatches
43
+ end
44
+
41
45
  private
42
46
 
43
47
  attr_reader :expected_interactions, :actual_interactions
@@ -182,7 +182,7 @@ module Pact
182
182
  end
183
183
 
184
184
  def self.render_body body
185
- return '' unless body
185
+ return '' if body.nil?
186
186
  body.kind_of?(String) ? body.force_encoding('utf-8') : body.to_json
187
187
  end
188
188
  end
@@ -52,7 +52,7 @@ module Pact
52
52
  def to_s
53
53
  titles_and_summaries.collect do | title, summaries |
54
54
  "#{title}:\n\t#{summaries.join("\n\t")}\n\n" if summaries.any?
55
- end.compact.join
55
+ end.compact.join + verification.interaction_mismatches.collect(&:to_s).join("\n\n") + "\n"
56
56
 
57
57
  end
58
58
 
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module MockService
3
- VERSION = "3.6.1"
3
+ VERSION = "3.9.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact-mock_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.1
4
+ version: 3.9.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-04-21 00:00:00.000000000 Z
15
+ date: 2021-06-03 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rack
@@ -60,16 +60,22 @@ dependencies:
60
60
  name: thor
61
61
  requirement: !ruby/object:Gem::Requirement
62
62
  requirements:
63
- - - "~>"
63
+ - - ">="
64
64
  - !ruby/object:Gem::Version
65
65
  version: '0.19'
66
+ - - "<"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
66
69
  type: :runtime
67
70
  prerelease: false
68
71
  version_requirements: !ruby/object:Gem::Requirement
69
72
  requirements:
70
- - - "~>"
73
+ - - ">="
71
74
  - !ruby/object:Gem::Version
72
75
  version: '0.19'
76
+ - - "<"
77
+ - !ruby/object:Gem::Version
78
+ version: '2.0'
73
79
  - !ruby/object:Gem::Dependency
74
80
  name: json
75
81
  requirement: !ruby/object:Gem::Requirement
@@ -118,20 +124,20 @@ dependencies:
118
124
  requirements:
119
125
  - - "~>"
120
126
  - !ruby/object:Gem::Version
121
- version: '1.12'
127
+ version: '1.16'
122
128
  - - ">="
123
129
  - !ruby/object:Gem::Version
124
- version: 1.12.0
130
+ version: 1.16.4
125
131
  type: :runtime
126
132
  prerelease: false
127
133
  version_requirements: !ruby/object:Gem::Requirement
128
134
  requirements:
129
135
  - - "~>"
130
136
  - !ruby/object:Gem::Version
131
- version: '1.12'
137
+ version: '1.16'
132
138
  - - ">="
133
139
  - !ruby/object:Gem::Version
134
- version: 1.12.0
140
+ version: 1.16.4
135
141
  - !ruby/object:Gem::Dependency
136
142
  name: filelock
137
143
  requirement: !ruby/object:Gem::Requirement
@@ -166,14 +172,20 @@ dependencies:
166
172
  requirements:
167
173
  - - "~>"
168
174
  - !ruby/object:Gem::Version
169
- version: 10.0.3
175
+ version: '13.0'
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: 13.0.1
170
179
  type: :development
171
180
  prerelease: false
172
181
  version_requirements: !ruby/object:Gem::Requirement
173
182
  requirements:
174
183
  - - "~>"
175
184
  - !ruby/object:Gem::Version
176
- version: 10.0.3
185
+ version: '13.0'
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: 13.0.1
177
189
  - !ruby/object:Gem::Dependency
178
190
  name: webmock
179
191
  requirement: !ruby/object:Gem::Requirement
@@ -399,8 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
399
411
  - !ruby/object:Gem::Version
400
412
  version: '0'
401
413
  requirements: []
402
- rubyforge_project:
403
- rubygems_version: 2.7.7
414
+ rubygems_version: 3.2.19
404
415
  signing_key:
405
416
  specification_version: 4
406
417
  summary: Provides a mock service for use with Pact