pact-mock_service 3.12.3 → 4.0.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 +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +4 -4
- data/lib/pact/consumer/mock_service/rack_request_helper.rb +0 -1
- data/lib/pact/consumer_contract/consumer_contract_decorator.rb +2 -2
- data/lib/pact/consumer_contract/consumer_contract_writer.rb +2 -2
- data/lib/pact/mock_service/app_manager.rb +3 -3
- data/lib/pact/mock_service/interactions/interaction_mismatch.rb +1 -1
- data/lib/pact/mock_service/request_handlers/interaction_replay.rb +1 -1
- data/lib/pact/mock_service/version.rb +1 -1
- data/lib/pact/support/metrics.rb +2 -2
- metadata +65 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 67dbe04dd1b8d3a85cdd74f776bdad09f4628c63fedb108a86994595946d5b66
|
|
4
|
+
data.tar.gz: 9784e4495cb661096154b576dad4508d27707ecb06a4960cd062003d7fa4b52d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e50f82f5d3728519536a5f7bee2a4586c145664a49df370838913f38de30483fdeee90f856afbaaff756e6977cddcf759abf34a62627e158b27ea252ec50a380
|
|
7
|
+
data.tar.gz: 5cb6cc0293ae95609842a052a0df29f73d12ff2d0a27dda2720fefa65ce4cbce289039caf0dff1d658cd78489572c6468c41b48ffc17ed53d15ff1ef6e2496d5
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -16,7 +16,7 @@ The mock service provides the following endpoints:
|
|
|
16
16
|
|
|
17
17
|
All requests to the "administration" endpoints listed above must contain the header `X-Pact-Mock-Service: true` to allow the mock service to know whether the request is an administration request or a request from the actual consumer code.
|
|
18
18
|
|
|
19
|
-
As the Pact mock service can be used as a standalone executable and administered via HTTP, it can be used for testing with any language. All that is required is a library in the native language to create the HTTP calls listed above. Check out [docs.pact.io](https://docs.pact.io) for a list of implemented languages. If you are interested in creating bindings in a new language, have a chat to one of us on the [pact
|
|
19
|
+
As the Pact mock service can be used as a standalone executable and administered via HTTP, it can be used for testing with any language. All that is required is a library in the native language to create the HTTP calls listed above. Check out [docs.pact.io](https://docs.pact.io) for a list of implemented languages. If you are interested in creating bindings in a new language, have a chat to one of us on the [pact slack group][slack].
|
|
20
20
|
|
|
21
21
|
## Installation
|
|
22
22
|
|
|
@@ -98,7 +98,7 @@ Read the wiki page on [CORS][cors].
|
|
|
98
98
|
|
|
99
99
|
The pact-stub-service allows you to reuse interactions that have been generated in previous tests. The typical situation would be to generate your pact file using unit tests, and then use the pact stub service for your higher level integration/ui tests. To help reduce the number of interactions that need verifying, you will want to use flexible matching on both requests and responses.
|
|
100
100
|
|
|
101
|
-
Unlike the mock service, which has a Ruby DSL for managing its lifecycle, the mock service can currently only be started from the command line, so you will need to start/background/kill the process yourself. If this is causing problems, please raise it in the pact
|
|
101
|
+
Unlike the mock service, which has a Ruby DSL for managing its lifecycle, the mock service can currently only be started from the command line, so you will need to start/background/kill the process yourself. If this is causing problems, please raise it in the pact slack group and we can discuss potential enhancements.
|
|
102
102
|
|
|
103
103
|
```
|
|
104
104
|
Usage:
|
|
@@ -119,7 +119,7 @@ Description:
|
|
|
119
119
|
Include any basic auth details in the URL using the format https://USERNAME:PASSWORD@URI.
|
|
120
120
|
Where multiple matching interactions are found, the interactions will be sorted by
|
|
121
121
|
response status, and the first one will be returned. This may lead to some non-deterministic
|
|
122
|
-
behaviour. If you are having problems with this, please raise it on the pact
|
|
122
|
+
behaviour. If you are having problems with this, please raise it on the pact slack group,
|
|
123
123
|
and we can discuss some potential enhancements.
|
|
124
124
|
Note that only versions 1 and 2 of the pact specification are currently fully supported.
|
|
125
125
|
Pacts using the v3 format may be used, however, any matching features added in v4 will
|
|
@@ -132,6 +132,6 @@ See [CONTRIBUTING.md](/CONTRIBUTING.md)
|
|
|
132
132
|
|
|
133
133
|
[pact]: https://github.com/pact-foundation/pact-ruby
|
|
134
134
|
[executables]: https://github.com/pact-foundation/pact-ruby-standalone/releases
|
|
135
|
-
[
|
|
135
|
+
[slack]: https://slack.pact.io
|
|
136
136
|
[wiki]: https://github.com/pact-foundation/pact-mock_service/wiki
|
|
137
137
|
[cors]: https://github.com/pact-foundation/pact-mock_service/wiki/Using-the-mock-service-with-CORS
|
|
@@ -32,9 +32,9 @@ module Pact
|
|
|
32
32
|
|
|
33
33
|
def sorted_interactions
|
|
34
34
|
# Default order: chronological
|
|
35
|
-
return consumer_contract.writable_interactions if Pact.configuration.pactfile_write_order == :chronological
|
|
35
|
+
return consumer_contract.writable_interactions if Pact::Support.configuration.pactfile_write_order == :chronological
|
|
36
36
|
# We are supporting only chronological or alphabetical order
|
|
37
|
-
raise NotImplementedError if Pact.configuration.pactfile_write_order != :alphabetical
|
|
37
|
+
raise NotImplementedError if Pact::Support.configuration.pactfile_write_order != :alphabetical
|
|
38
38
|
|
|
39
39
|
consumer_contract.writable_interactions.sort{|a, b| sortable_id(a) <=> sortable_id(b)}
|
|
40
40
|
end
|
|
@@ -25,8 +25,8 @@ module Pact
|
|
|
25
25
|
@interactions = consumer_contract_details.fetch(:interactions)
|
|
26
26
|
@pact_specification_version = (consumer_contract_details[:pact_specification_version] || DEFAULT_PACT_SPECIFICATION_VERSION).to_s
|
|
27
27
|
@consumer_contract_decorator_class = consumer_contract_details[:consumer_contract_decorator_class] || Pact::ConsumerContractDecorator
|
|
28
|
-
@error_stream = consumer_contract_details[:error_stream] || Pact.configuration.error_stream
|
|
29
|
-
@output_stream = consumer_contract_details[:output_stream] || Pact.configuration.output_stream
|
|
28
|
+
@error_stream = consumer_contract_details[:error_stream] || Pact::Support.configuration.error_stream
|
|
29
|
+
@output_stream = consumer_contract_details[:output_stream] || Pact::Support.configuration.output_stream
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def consumer_contract
|
|
@@ -80,18 +80,18 @@ module Pact
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
def pact_dir
|
|
83
|
-
Pact.configuration.pact_dir
|
|
83
|
+
Pact::Support.configuration.pact_dir
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
def create_log_file(service_name)
|
|
87
|
-
FileUtils::mkdir_p(Pact.configuration.log_dir)
|
|
87
|
+
FileUtils::mkdir_p(Pact::Support.configuration.log_dir)
|
|
88
88
|
log = File.open(log_file_path(service_name), 'w')
|
|
89
89
|
log.sync = true
|
|
90
90
|
log
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def log_file_path(service_name)
|
|
94
|
-
File.join(Pact.configuration.log_dir, "#{log_file_name(service_name)}.log")
|
|
94
|
+
File.join(Pact::Support.configuration.log_dir, "#{log_file_name(service_name)}.log")
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
def log_file_name(service_name)
|
|
@@ -61,7 +61,7 @@ module Pact
|
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def diff_formatter
|
|
64
|
-
Pact.configuration.diff_formatter_for_content_type(candidate_interaction.request.content_type)
|
|
64
|
+
Pact::Support.configuration.diff_formatter_for_content_type(candidate_interaction.request.content_type)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def diff
|
data/lib/pact/support/metrics.rb
CHANGED
|
@@ -11,7 +11,7 @@ module Pact
|
|
|
11
11
|
def self.report_metric(event, category, action, value = 1)
|
|
12
12
|
do_once_per_thread(:pact_metrics_message_shown) do
|
|
13
13
|
if track_events?
|
|
14
|
-
Pact.configuration.output_stream.puts "mock WARN: Please note: we are tracking events anonymously to gather important usage statistics like Pact-Ruby version and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment variable to 'true'."
|
|
14
|
+
Pact::Support.configuration.output_stream.puts "mock WARN: Please note: we are tracking events anonymously to gather important usage statistics like Pact-Ruby version and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment variable to 'true'."
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -36,7 +36,7 @@ module Pact
|
|
|
36
36
|
|
|
37
37
|
def self.handle_error e
|
|
38
38
|
if ENV['PACT_METRICS_DEBUG'] == 'true'
|
|
39
|
-
Pact.configuration.output_stream.puts("DEBUG: #{e.inspect}\n" + e.backtrace.join("\n"))
|
|
39
|
+
Pact::Support.configuration.output_stream.puts("DEBUG: #{e.inspect}\n" + e.backtrace.join("\n"))
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
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:
|
|
4
|
+
version: 4.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Fraser
|
|
@@ -9,10 +9,9 @@ authors:
|
|
|
9
9
|
- Brent Snook
|
|
10
10
|
- Ronald Holshausen
|
|
11
11
|
- Beth Skurrie
|
|
12
|
-
autorequire:
|
|
13
12
|
bindir: bin
|
|
14
13
|
cert_chain: []
|
|
15
|
-
date:
|
|
14
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
16
15
|
dependencies:
|
|
17
16
|
- !ruby/object:Gem::Dependency
|
|
18
17
|
name: rack
|
|
@@ -128,22 +127,50 @@ dependencies:
|
|
|
128
127
|
name: pact-support
|
|
129
128
|
requirement: !ruby/object:Gem::Requirement
|
|
130
129
|
requirements:
|
|
131
|
-
- - "
|
|
130
|
+
- - ">="
|
|
131
|
+
- !ruby/object:Gem::Version
|
|
132
|
+
version: '2.0'
|
|
133
|
+
- - "<"
|
|
132
134
|
- !ruby/object:Gem::Version
|
|
133
|
-
version: '
|
|
135
|
+
version: '3'
|
|
136
|
+
type: :runtime
|
|
137
|
+
prerelease: false
|
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
139
|
+
requirements:
|
|
134
140
|
- - ">="
|
|
135
141
|
- !ruby/object:Gem::Version
|
|
136
|
-
version:
|
|
142
|
+
version: '2.0'
|
|
143
|
+
- - "<"
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '3'
|
|
146
|
+
- !ruby/object:Gem::Dependency
|
|
147
|
+
name: logger
|
|
148
|
+
requirement: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - "<"
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '2.0'
|
|
137
153
|
type: :runtime
|
|
138
154
|
prerelease: false
|
|
139
155
|
version_requirements: !ruby/object:Gem::Requirement
|
|
140
156
|
requirements:
|
|
141
|
-
- - "
|
|
157
|
+
- - "<"
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '2.0'
|
|
160
|
+
- !ruby/object:Gem::Dependency
|
|
161
|
+
name: cgi
|
|
162
|
+
requirement: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - ">="
|
|
142
165
|
- !ruby/object:Gem::Version
|
|
143
|
-
version: '
|
|
166
|
+
version: '0'
|
|
167
|
+
type: :runtime
|
|
168
|
+
prerelease: false
|
|
169
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
170
|
+
requirements:
|
|
144
171
|
- - ">="
|
|
145
172
|
- !ruby/object:Gem::Version
|
|
146
|
-
version:
|
|
173
|
+
version: '0'
|
|
147
174
|
- !ruby/object:Gem::Dependency
|
|
148
175
|
name: rack-test
|
|
149
176
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -226,6 +253,34 @@ dependencies:
|
|
|
226
253
|
- - "~>"
|
|
227
254
|
- !ruby/object:Gem::Version
|
|
228
255
|
version: '2.4'
|
|
256
|
+
- !ruby/object:Gem::Dependency
|
|
257
|
+
name: irb
|
|
258
|
+
requirement: !ruby/object:Gem::Requirement
|
|
259
|
+
requirements:
|
|
260
|
+
- - ">="
|
|
261
|
+
- !ruby/object:Gem::Version
|
|
262
|
+
version: '0'
|
|
263
|
+
type: :development
|
|
264
|
+
prerelease: false
|
|
265
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
266
|
+
requirements:
|
|
267
|
+
- - ">="
|
|
268
|
+
- !ruby/object:Gem::Version
|
|
269
|
+
version: '0'
|
|
270
|
+
- !ruby/object:Gem::Dependency
|
|
271
|
+
name: fiddle
|
|
272
|
+
requirement: !ruby/object:Gem::Requirement
|
|
273
|
+
requirements:
|
|
274
|
+
- - ">="
|
|
275
|
+
- !ruby/object:Gem::Version
|
|
276
|
+
version: '0'
|
|
277
|
+
type: :development
|
|
278
|
+
prerelease: false
|
|
279
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
280
|
+
requirements:
|
|
281
|
+
- - ">="
|
|
282
|
+
- !ruby/object:Gem::Version
|
|
283
|
+
version: '0'
|
|
229
284
|
- !ruby/object:Gem::Dependency
|
|
230
285
|
name: hashie
|
|
231
286
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -310,7 +365,6 @@ dependencies:
|
|
|
310
365
|
- - "~>"
|
|
311
366
|
- !ruby/object:Gem::Version
|
|
312
367
|
version: '0.5'
|
|
313
|
-
description:
|
|
314
368
|
email:
|
|
315
369
|
- james.fraser@alumni.swinburne.edu
|
|
316
370
|
- sergei.matheson@gmail.com
|
|
@@ -396,7 +450,6 @@ homepage: https://github.com/bethesque/pact-mock_service
|
|
|
396
450
|
licenses:
|
|
397
451
|
- MIT
|
|
398
452
|
metadata: {}
|
|
399
|
-
post_install_message:
|
|
400
453
|
rdoc_options: []
|
|
401
454
|
require_paths:
|
|
402
455
|
- lib
|
|
@@ -411,8 +464,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
411
464
|
- !ruby/object:Gem::Version
|
|
412
465
|
version: '0'
|
|
413
466
|
requirements: []
|
|
414
|
-
rubygems_version:
|
|
415
|
-
signing_key:
|
|
467
|
+
rubygems_version: 4.0.21
|
|
416
468
|
specification_version: 4
|
|
417
469
|
summary: Provides a mock service for use with Pact
|
|
418
470
|
test_files: []
|