hs-pact-mock_service 3.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +494 -0
  3. data/Gemfile +8 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +137 -0
  6. data/bin/pact-mock-service +3 -0
  7. data/bin/pact-stub-service +3 -0
  8. data/lib/pact/consumer/mock_service/cors_origin_header_middleware.rb +31 -0
  9. data/lib/pact/consumer/mock_service/error_handler.rb +31 -0
  10. data/lib/pact/consumer/mock_service/rack_request_helper.rb +65 -0
  11. data/lib/pact/consumer/mock_service/set_location.rb +28 -0
  12. data/lib/pact/consumer/server.rb +111 -0
  13. data/lib/pact/consumer_contract/consumer_contract_decorator.rb +53 -0
  14. data/lib/pact/consumer_contract/consumer_contract_writer.rb +181 -0
  15. data/lib/pact/consumer_contract/interaction_decorator.rb +40 -0
  16. data/lib/pact/consumer_contract/request_decorator.rb +88 -0
  17. data/lib/pact/consumer_contract/response_decorator.rb +47 -0
  18. data/lib/pact/mock_service/app.rb +85 -0
  19. data/lib/pact/mock_service/app_manager.rb +156 -0
  20. data/lib/pact/mock_service/cli/custom_thor.rb +74 -0
  21. data/lib/pact/mock_service/cli/pidfile.rb +99 -0
  22. data/lib/pact/mock_service/cli.rb +213 -0
  23. data/lib/pact/mock_service/client.rb +79 -0
  24. data/lib/pact/mock_service/control_server/app.rb +42 -0
  25. data/lib/pact/mock_service/control_server/delegator.rb +44 -0
  26. data/lib/pact/mock_service/control_server/index.rb +25 -0
  27. data/lib/pact/mock_service/control_server/mock_service_creator.rb +32 -0
  28. data/lib/pact/mock_service/control_server/mock_services.rb +26 -0
  29. data/lib/pact/mock_service/control_server/require_pacticipant_headers.rb +20 -0
  30. data/lib/pact/mock_service/control_server/run.rb +73 -0
  31. data/lib/pact/mock_service/errors.rb +9 -0
  32. data/lib/pact/mock_service/interaction_decorator.rb +49 -0
  33. data/lib/pact/mock_service/interactions/actual_interactions.rb +36 -0
  34. data/lib/pact/mock_service/interactions/candidate_interactions.rb +15 -0
  35. data/lib/pact/mock_service/interactions/expected_interactions.rb +18 -0
  36. data/lib/pact/mock_service/interactions/interaction_diff_message.rb +45 -0
  37. data/lib/pact/mock_service/interactions/interaction_mismatch.rb +74 -0
  38. data/lib/pact/mock_service/interactions/interactions_filter.rb +66 -0
  39. data/lib/pact/mock_service/interactions/verification.rb +52 -0
  40. data/lib/pact/mock_service/interactions/verified_interactions.rb +20 -0
  41. data/lib/pact/mock_service/logger.rb +40 -0
  42. data/lib/pact/mock_service/request_decorator.rb +36 -0
  43. data/lib/pact/mock_service/request_handlers/base_administration_request_handler.rb +42 -0
  44. data/lib/pact/mock_service/request_handlers/base_request_handler.rb +30 -0
  45. data/lib/pact/mock_service/request_handlers/index_get.rb +23 -0
  46. data/lib/pact/mock_service/request_handlers/interaction_delete.rb +38 -0
  47. data/lib/pact/mock_service/request_handlers/interaction_post.rb +43 -0
  48. data/lib/pact/mock_service/request_handlers/interaction_replay.rb +191 -0
  49. data/lib/pact/mock_service/request_handlers/interactions_put.rb +44 -0
  50. data/lib/pact/mock_service/request_handlers/log_get.rb +27 -0
  51. data/lib/pact/mock_service/request_handlers/missing_interactions_get.rb +33 -0
  52. data/lib/pact/mock_service/request_handlers/options.rb +64 -0
  53. data/lib/pact/mock_service/request_handlers/pact_post.rb +38 -0
  54. data/lib/pact/mock_service/request_handlers/session_delete.rb +32 -0
  55. data/lib/pact/mock_service/request_handlers/verification_get.rb +74 -0
  56. data/lib/pact/mock_service/request_handlers.rb +42 -0
  57. data/lib/pact/mock_service/response_decorator.rb +31 -0
  58. data/lib/pact/mock_service/run.rb +125 -0
  59. data/lib/pact/mock_service/server/respawn.rb +20 -0
  60. data/lib/pact/mock_service/server/spawn.rb +37 -0
  61. data/lib/pact/mock_service/server/wait_for_server_up.rb +44 -0
  62. data/lib/pact/mock_service/server/webrick_request_monkeypatch.rb +15 -0
  63. data/lib/pact/mock_service/session.rb +96 -0
  64. data/lib/pact/mock_service/spawn.rb +86 -0
  65. data/lib/pact/mock_service/version.rb +5 -0
  66. data/lib/pact/mock_service.rb +2 -0
  67. data/lib/pact/stub_service/cli.rb +71 -0
  68. data/lib/pact/support/expand_file_list.rb +26 -0
  69. metadata +399 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 389cb49c6c55261c53a8a9ca82269a6d5fedc605bbac90617bcd32a3092797fa
4
+ data.tar.gz: d6371224e6f765e2d65e9379d7565572443d43f76dc46de7c506ec1dd79a6ec0
5
+ SHA512:
6
+ metadata.gz: 1eb75677718db4217779bcf3e17a2392e5be253e49ab4baa4375c9b90faebaa2c38cc478af0bdc236c89a58129035c59bfe98eea95adac8c2cac6795326f56fc
7
+ data.tar.gz: 66cb8f97740fb469638070e2c2c141efe8e82f60af6d9397338d4115dae0b309415e086a18eb9b362d71d9c7ec749ab5422f80064fdb1a17da65fc8c7fd0ff89
data/CHANGELOG.md ADDED
@@ -0,0 +1,494 @@
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
+
37
+ <a name="v3.6.1"></a>
38
+ ### v3.6.1 (2020-04-22)
39
+
40
+
41
+ #### Bug Fixes
42
+
43
+ * fix Ruby 2.7 kwargs warning (#122) ([4a46c21](/../../commit/4a46c21))
44
+
45
+
46
+ <a name="v3.6.0"></a>
47
+ ### v3.6.0 (2020-03-14)
48
+
49
+
50
+ #### Features
51
+
52
+ * add 'Access-Control-Allow-Headers' = true to cors response headers (#121) ([61bd9d1](/../../commit/61bd9d1))
53
+
54
+
55
+ <a name="v3.5.0"></a>
56
+ ### v3.5.0 (2020-01-17)
57
+
58
+
59
+ #### Features
60
+
61
+ * add token, username and password options to stub service (#118) ([76236d8](/../../commit/76236d8))
62
+
63
+
64
+ <a name="v3.3.1"></a>
65
+ ### v3.3.1 (2020-01-16)
66
+
67
+
68
+ #### Bug Fixes
69
+
70
+ * put metadata on the correct decorator ([67ef5a6](/../../commit/67ef5a6))
71
+
72
+
73
+ <a name="v3.3.0"></a>
74
+ ### v3.3.0 (2020-01-16)
75
+
76
+
77
+ #### Features
78
+
79
+ * log a warning when too many interactions are set on the mock service at once ([0ce6bef](/../../commit/0ce6bef))
80
+
81
+
82
+ <a name="v3.2.1"></a>
83
+ ### v3.2.1 (2020-01-11)
84
+
85
+
86
+ #### Bug Fixes
87
+
88
+ * remove apparently unused require for thwait ([4a08fd5](/../../commit/4a08fd5))
89
+
90
+
91
+ <a name="v3.2.0"></a>
92
+ ### v3.2.0 (2019-09-19)
93
+
94
+
95
+ #### Features
96
+
97
+ * **skip writing to pact**
98
+ * Use writable_interactions when writing to pact file ([44ea0c3](/../../commit/44ea0c3))
99
+
100
+
101
+ <a name="v3.1.0"></a>
102
+ ### v3.1.0 (2019-05-01)
103
+
104
+
105
+ #### Features
106
+
107
+ * pact-stub-service log level cli opt ([9264a87](/../../commit/9264a87))
108
+
109
+
110
+ <a name="v3.0.1"></a>
111
+ ### v3.0.1 (2019-03-08)
112
+
113
+
114
+ #### Bug Fixes
115
+
116
+ * add missing host argument to server spawn ([ee5cf90](/../../commit/ee5cf90))
117
+
118
+
119
+ <a name="v3.0.0"></a>
120
+ ### v3.0.0 (2019-02-21)
121
+
122
+
123
+ #### Features
124
+
125
+ * allow mock service host to be configured ([7e2d810](/../../commit/7e2d810))
126
+
127
+
128
+ <a name="v2.11.0"></a>
129
+ ### v2.11.0 (2018-08-28)
130
+
131
+
132
+ #### Features
133
+
134
+ * **stub-server**
135
+ * allow pacts to be loaded from a directory ([c5babe7](/../../commit/c5babe7))
136
+
137
+
138
+ <a name="v2.10.1"></a>
139
+ ### v2.10.1 (2018-08-21)
140
+
141
+
142
+ #### Bug Fixes
143
+
144
+ * ensure specified value of --pact-specification-version is written in pact file ([bb93b0d](/../../commit/bb93b0d))
145
+
146
+
147
+ <a name="v2.10.0"></a>
148
+ ### v2.10.0 (2018-08-07)
149
+
150
+
151
+ #### Features
152
+
153
+ * use Pact::Error subclass instead of RuntimeErrors ([a15dd3e](/../../commit/a15dd3e))
154
+
155
+
156
+ <a name="v2.9.8"></a>
157
+ ### v2.9.8 (2018-07-23)
158
+
159
+
160
+ #### Bug Fixes
161
+
162
+ * require pact_specification_version when spawning mock service through app manager ([efdba96](/../../commit/efdba96))
163
+
164
+
165
+ <a name="v2.9.6"></a>
166
+ ### v2.9.6 (2018-07-23)
167
+
168
+
169
+ #### Bug Fixes
170
+
171
+ * use dummy pact specification version for stub server ([3337f6d](/../../commit/3337f6d))
172
+ * pass the pact specification version from the control server to the mock server ([b585092](/../../commit/b585092))
173
+
174
+
175
+ <a name="v2.9.4"></a>
176
+ ### v2.9.4 (2018-07-23)
177
+
178
+
179
+ #### Bug Fixes
180
+
181
+ * parse expected interactions with configured pact specification version ([1b960bf](/../../commit/1b960bf))
182
+
183
+
184
+ <a name="v2.9.3"></a>
185
+ ### v2.9.3 (2018-07-13)
186
+
187
+
188
+ #### Bug Fixes
189
+
190
+ * set $stdout.sync = true ([f37c8f8](/../../commit/f37c8f8))
191
+
192
+
193
+ <a name="v2.9.2"></a>
194
+ ### v2.9.2 (2018-07-12)
195
+
196
+
197
+ #### Bug Fixes
198
+
199
+ * send webrick startup and shutdown messages to stdout instead of stderr ([908089e](/../../commit/908089e))
200
+
201
+
202
+ <a name="v2.9.1"></a>
203
+ ### v2.9.1 (2018-07-04)
204
+
205
+
206
+ #### Bug Fixes
207
+
208
+ * return Access-Control-Allow-Headers=* for OPTIONS requests with no Access-Control-Request-Headers ([855fd83](/../../commit/855fd83))
209
+
210
+
211
+ <a name="v2.9.0"></a>
212
+ ### v2.9.0 (2018-06-15)
213
+
214
+
215
+ #### Features
216
+
217
+ * allow --log-level to be specified in the CLI ([cf84a34](/../../commit/cf84a34))
218
+
219
+
220
+ <a name="v2.8.1"></a>
221
+ ### v2.8.1 (2018-06-01)
222
+
223
+
224
+ #### Bug Fixes
225
+
226
+ * revert bind webrick of consumer server to 0.0.0.0 f1e858e306cd45b72472dad0f213cc7657821adc ([f2ebb6a](/../../commit/f2ebb6a))
227
+
228
+
229
+ <a name="v2.7.1"></a>
230
+ ### v2.7.1 (2018-05-09)
231
+
232
+
233
+ #### Bug Fixes
234
+
235
+ * ensure underscored headers are maintained ([0724701](/../../commit/0724701))
236
+
237
+
238
+ <a name="v2.7.0"></a>
239
+ ### v2.7.0 (2018-05-04)
240
+
241
+
242
+ #### Features
243
+
244
+ * allow pact-stub-server to read pact from an http uri ([5cce3b2](/../../commit/5cce3b2))
245
+
246
+
247
+ <a name="v2.6.4"></a>
248
+ ### v2.6.4 (2018-02-22)
249
+
250
+ #### Features
251
+
252
+ * allow output streams and consumer contract writer to be passed in to Pact::ConsumerContractWriter ([1856f21](/../../commit/1856f21))
253
+
254
+
255
+ #### Bug Fixes
256
+
257
+ * correctly handle reading locked pact file on windows ([2d14562](/../../commit/2d14562))
258
+
259
+
260
+ <a name="v2.6.3"></a>
261
+ ### v2.6.3 (2017-12-18)
262
+
263
+ #### Bug Fixes
264
+
265
+ * **pact-stub-service**
266
+ * ensure all interactions loaded when loading multiple pacts ([4c0d698](/../../commit/4c0d698))
267
+
268
+ <a name="v2.6.1"></a>
269
+ ### 2.6.1 (2017-11-17)
270
+ * 141988f - fix: don't blow up if Access-Control-Request-Headers is not present in OPTIONS request (Beth Skurrie, Fri Nov 17 09:53:29 2017 +1100)
271
+
272
+ ### 2.6.0 (2017-11-07)
273
+ * cad84fd - feat(monkeypatch): allow a monkeypatch file to be loaded before starting the mock service (Beth Skurrie, Tue Nov 7 13:30:05 2017 +1100)
274
+
275
+ ### 2.5.4 (2017-10-30)
276
+ * 799b822 - fix: change rack-test to development dependency (Beth Skurrie, Mon Oct 30 10:05:11 2017 +1100)
277
+
278
+ ### 2.5.3 (2017-10-30)
279
+ * 9ad0d10 - fix: read existing pact file before truncating it (Beth Skurrie, Mon Oct 30 09:43:42 2017 +1100)
280
+
281
+ ### 2.5.2 (2017-10-30)
282
+ * 12f02b4 - fix: avoid corrupting pact file when writing to it (Beth Skurrie, Mon Oct 30 08:31:15 2017 +1100)
283
+
284
+ ### 2.5.0 (2017-10-28)
285
+ * bc15e21 - feat(pact-stub-service): handle case where multiple responses match (Beth Skurrie, Sat Oct 28 09:15:55 2017 +1100)
286
+
287
+ ### 2.4.0 (2017-10-13)
288
+ * 56bd683 - feat(stub): add pact-stub-service CLI (Beth Skurrie, Fri Oct 13 08:20:49 2017 +1100)
289
+
290
+ ### 2.3.0 (2017-10-04)
291
+ * 79cbdc9 - feat: add example script showing usage (Beth Skurrie, Wed Oct 4 13:42:06 2017 +1100)
292
+ * 873d9ee - feat: only write pact on shutdown of mock service if pact has not already been written (Beth Skurrie, Wed Oct 4 13:41:01 2017 +1100)
293
+ * d3c6067 - feat(cli): add --pact-file-write-mode to cli and remove --unique-pact-file-names (Beth Skurrie, Wed Oct 4 08:01:25 2017 +1100)
294
+ * 476ae5c - feat: only include backtrace in error response for standard errors, not for pact::error (Beth Skurrie, Tue Oct 3 16:40:06 2017 +1100)
295
+ * a76dc7e - feat: add 'merge' pactfile_write_mode (Beth Skurrie, Tue Oct 3 10:13:36 2017 +1100)
296
+ * d0d82f2 - feat: use file locking to ensure pact file isn't corrupted when running multiple mock services in parallel (Beth Skurrie, Mon Oct 2 08:32:34 2017 +1100)
297
+
298
+ ### 2.2.0 (2017-09-30)
299
+ * 3949e3d - feat(cli): add --unique-pact-file-names option (Beth Skurrie, Thu Sep 28 11:16:22 2017 +1000)
300
+
301
+ ### 2.1.0 (12 May 2017)
302
+ * 5b89d95 - Updated location of pact specification version in pact to metadata.pactSpecification.version. As per issue #137 (Beth Skurrie, Fri May 12 11:03:54 2017 +1000)
303
+ * b85ad94 - Update mock service interaction decorator to use providerState between the consumer DSL and the mock service, just to avoid any further confusion! (Beth Skurrie, Fri May 12 08:41:56 2017 +1000)
304
+
305
+ ### 2.0.1 (11 May 2017)
306
+ * 2c106b9 - Fix serialisation of request in pact for pact spec 2. (Beth Skurrie, Thu May 11 09:32:43 2017 +1000)
307
+
308
+ ### 2.0.0 (12 Apr 2017)
309
+ * 74bd80e - Bumping pact-support version to ~> 1.0 (Beth Skurrie, Wed Apr 12 15:10:49 2017 +1000)
310
+
311
+ ### 1.2.0 (4 Apr 2017)
312
+ * b2e9f46 - Updated pact-support gem dependency as an excuse to put out a new version so can rebuild pact-mock-service-npm. (Beth Skurrie, Tue Apr 4 15:56:12 2017 +1000)
313
+
314
+ ### 1.1.0 (4 Apr 2017)
315
+ * dc5331b - Silence zip command in rake package task (Beth Skurrie, Tue Apr 4 10:29:10 2017 +1000)
316
+
317
+ ### 1.0.0 (3 Apr 2017)
318
+ * 18b98c0 - Included request matching rules in pact file (Matt Baumgartner, Wed Feb 15 16:20:50 2017 -0500)
319
+
320
+ ### 0.12.1 (11 Jan 2017)
321
+ * a0fbb02 - Upgrade Traveling Ruby to work on ruby 2.2.x (Matt Fellows, Tue Jan 10 22:57:32 2017 +1100)
322
+
323
+ ### 0.12.0 (22 Nov 2016)
324
+ * 2fa1a58 - Skip SSL test on Travis for now (Bethany Skurrie, Tue Nov 22 10:26:41 2016 +1100)
325
+ * 22a7d1d - Attempting to cleanup failing test (Bobby Earl, Mon Oct 24 16:00:05 2016 -0400)
326
+ * 43e779f - Added support for sslcert + sslkey to server.rb (Bobby Earl, Mon Oct 24 15:20:33 2016 -0400)
327
+ * d1ab8ff - Added intergration test and updated README.md (Bobby Earl, Fri Oct 21 11:29:00 2016 -0400)
328
+ * ae0a06c - Allow passing in an ssl certificate / key to use instead of having one generated. (Blackbaud-JonathanBell, Fri Oct 21 10:52:53 2016 -0400)
329
+
330
+ ### 0.11.0 (14 Nov 2016)
331
+ * 8b32ea9 - Upgrading pact-support version (Beth Skurrie, Mon Nov 14 10:04:22 2016 +1100)
332
+
333
+ ### 0.10.2 (13 Aug 2016)
334
+ * 9352017 - Update .travis.yml (Beth Skurrie, Mon Aug 8 18:06:41 2016 +1000)
335
+ * f719415 - use ssl when checking if https server is up (Valeriy Kassenbaev, Thu Aug 4 01:37:50 2016 +0300)
336
+
337
+ ### 0.10.1 (27 Jun 2016)
338
+ * a9fff79 - Add release instructions (Sergei Matheson, Mon Jun 27 10:47:12 2016 +1000)
339
+ * 28c11e7 - Clarify that pact-mock_service will only work with ruby >= 2.0 (Sergei Matheson, Mon Jun 27 10:27:12 2016 +1000)
340
+
341
+ ### 0.10.0 (10 June 2016)
342
+ * 9ebcd9e - Only write pact file when there are interactions (Robin Daugherty, Thu Jun 16 16:13:57 2016 -0400)
343
+
344
+ ### 0.9.0 (26 May 2016)
345
+ * 28ab905 - Merge pull request #46 from reevoo/order_interactions_by_provider_state (Sergei Matheson, Thu May 26 14:52:08 2016 +1000)
346
+ * d58507c - Add ability to record interactions in alphabetical order. Order key: description + response.status + provider_state Default order: chronological (as it was before) (Alex Malkov, Mon May 23 11:52:39 2016 +0100)
347
+ * 739d111 - Merge pull request #48 from mefellows/readline-fix (Sergei Matheson, Mon May 16 10:53:01 2016 +1000)
348
+ * fe5ea69 - Added -rreadline flag to ruby CLI execution wrapper (Matt Fellows, Sun May 15 13:31:45 2016 +1000)
349
+ * 0dfb431 - Sort by description, status and provider state (Alex Malkov, Wed May 4 00:00:21 2016 +0100)
350
+ * 9ff8337 - Order interactions within the contract by provider state. (Alex Malkov, Tue May 3 22:13:53 2016 +0100)
351
+ * 2f22f7e - Update to ruby 2.3.1 in travis (Sergei Matheson, Tue May 3 10:46:46 2016 +1000)
352
+
353
+ ### 0.8.2 (19 April 2016)
354
+ * e392333 - Merge pull request #45 from aaronrenner/ar-fix-almost-duplicate-error-web-response (Beth Skurrie, Tue Apr 19 09:53:01 2016 +1000)
355
+ * 6fbcce2 - Fixed invalid Rack response on AlmostDuplicateInteractionError (Aaron Renner, Mon Apr 18 14:08:19 2016 -0600)
356
+ * 2cdce52 - Merge pull request #44 from sebdiem/sebdiem/add_host_option (Sergei Matheson, Tue Mar 29 09:23:35 2016 +1100)
357
+ * a76a321 - add host option for control server (Sébastien Diemer, Sun Mar 27 23:25:19 2016 +0200)
358
+ * aadbb8d - Merge pull request #43 from taiki45/find-available-port-option (Sergei Matheson, Mon Mar 21 09:35:40 2016 +1100)
359
+ * 98c9233 - remove --pact-dir from the windows bat file #41 (Ron Holshausen, Fri Mar 18 11:42:22 2016 +1100)
360
+ * f4c2fa5 - Fix timing issue on server test (Taiki Ono, Thu Mar 17 17:24:22 2016 +0900)
361
+ * 0655161 - Format code (Taiki Ono, Thu Mar 17 00:19:45 2016 +0900)
362
+ * fbea6d4 - Support find_available_port option (Taiki Ono, Wed Mar 16 19:12:36 2016 +0900)
363
+ * e72b0cd - WEBrick expects port as Integer (Taiki Ono, Wed Feb 24 19:16:57 2016 +0900)
364
+ * 9580c41 - Merge pull request #42 from taiki45/update-travis-ci-setting (Sergei Matheson, Wed Mar 16 19:59:08 2016 +1100)
365
+ * 01b90e0 - Update Travis CI setting with new Rubies (Taiki Ono, Sun Mar 13 21:19:43 2016 +0900)
366
+
367
+
368
+ ### 0.8.1 (25 February 2016)
369
+ * ffa37f8 - Merge pull request #40 from taiki45/add-option-not-to-write-pact-file (Beth Skurrie, Thu Feb 25 09:33:30 2016 +1100)
370
+ * 1cb2fa8 - Add option not to write pact file (Taiki Ono, Tue Feb 23 18:18:28 2016 +0900)
371
+ * 34b2b84 - Update README.md (Beth Skurrie, Tue Jan 19 14:17:21 2016 +1100)
372
+ * f8c92e4 - Update README.md (Beth Skurrie, Tue Jan 19 13:44:22 2016 +1100)
373
+ * 2012733 - Merge pull request #36 from Trunkplatform/cors_patch (Sergei Matheson, Wed Jan 13 14:16:29 2016 +1100)
374
+ * 8847938 - Added spec for PATCH method in the CORS allow methods (Sergei Matheson, Wed Jan 13 14:14:33 2016 +1100)
375
+ * 567714d - allowing PATCH method in the CORS handler (Evgeny Dudin, Tue Jan 12 12:20:52 2016 +1100)
376
+ * 56c7a51 - Update README.md (Beth Skurrie, Tue Jan 12 10:28:56 2016 +1100)
377
+ * 29380ed - Merge pull request #36 from davesmith00000/improved-usage-readme (Beth Skurrie, Tue Jan 12 10:22:04 2016 +1100)
378
+ * ef2da6c - Added a README example of using the pack-mock-server as a stub. (Dave Smith, Tue Jan 5 11:56:45 2016 +0000)
379
+
380
+ ### 0.8.0 (30 November 2015)
381
+
382
+ * 96dc58b - Adds DELETE session endpoint (George Papas & Matt Fielding, Fri Nov 27 16:45:13 2015 +1100)
383
+
384
+ ### 0.7.2 (7 October 2015)
385
+
386
+ * 24a092d - Updated pact-support gem (Beth Skurrie, Wed Oct 7 20:39:08 2015 +1100)
387
+
388
+ ### 0.7.1 (27 August 2015)
389
+
390
+ * 5d1a150 - fixing wrapper to work with both symlinked and non-symlinked files, like when being used in node (Michel Boudreau, Thu Aug 27 12:06:38 2015 +1000)
391
+
392
+ ### 0.7.0 (10 July 2015)
393
+
394
+ * 418b3a9 - Upgrading pact-support gem (Beth Skurrie, Fri Jul 10 13:11:13 2015 +1000)
395
+
396
+ ### 0.6.0 (6 July 2015)
397
+
398
+ * fadbbd5 - Added a CLI option to alter binding address (Andrew Browne, Mon Jul 6 10:36:21 2015 +1000)
399
+
400
+ ### 0.5.5 (25 May 2015)
401
+
402
+ * 3b2ec14 - Produce a valid rack response on interaction post error (David Heath, Fri May 22 16:42:03 2015 +0100)
403
+ * 9e3cb8b - Allow webrick_options to be passed in to Pact::MockService::Run to silence the start up and shut down logs if necessary (Beth Skurrie, Fri May 15 17:28:55 2015 +1000)
404
+
405
+ ### 0.5.4 (13 May 2015)
406
+
407
+ * 7d016be - Fix failed merge which broke windows wrapper (Anthony Damtsis, Wed May 13 11:13:25 2015 +1000)
408
+
409
+ ### 0.5.3 (12 May 2015)
410
+
411
+ * afef174 - Move non-windows ruby back to 2.1 to avoid version conflicts with windows (Anthony Damtsis, Tue May 12 16:12:31 2015 +1000)
412
+ * 22d10f8 - Default pact-dir for windows mock service included in wrapper. (Anthony Damtsis, Fri May 8 16:58:49 2015 +1000)
413
+
414
+ ### 0.5.2 (23 Apr 2015)
415
+
416
+ * 718d1a6 - Fixing path (André Allavena, Thu Apr 23 12:55:26 2015 +1000)
417
+
418
+ ### 0.5.1 (23 Mar 2015)
419
+
420
+ * 9b3127c - Fixing a path issue as %~dp0 resolves the path the bat is running from (Neil Campbell, Mon Mar 23 09:44:48 2015 +1100)
421
+ * 2199b0b - Added task to create win32 standalone package (Beth Skurrie, Fri Mar 20 16:32:04 2015 +1100)
422
+
423
+ ### 0.5.0 (20 Mar 2015)
424
+
425
+ * ddc8c1a - Upgrade pact-support to ~>0.4.0 (Beth Skurrie, Fri Mar 20 14:53:00 2015 +1100)
426
+
427
+ ### 0.4.2 (3 Mar 2015)
428
+
429
+ * 4c0e48b - Fixed bug where pact file was being cleared before being merged (Beth Skurrie, Tue Mar 3 17:27:02 2015 +1100)
430
+ * 661321a - Stop log/pact.log from being created automatically https://github.com/bethesque/pact-mock_service/issues/15 (Beth Skurrie, Tue Mar 3 08:45:15 2015 +1100)
431
+
432
+ ### 0.4.1 (13 Feb 2015)
433
+
434
+ * 7be9338 - Fixed broken require that stopped restart working (Beth Skurrie, Wed Feb 25 13:55:32 2015 +1100)
435
+
436
+ ### 0.4.0 (13 Feb 2015)
437
+
438
+ * 73ddd98 - Added option to AppManager to set the pact_specification_version (Beth Skurrie, Fri Feb 13 17:41:42 2015 +1100)
439
+ * e4a7405 - Make pactSpecificationVersion in pact file dynamic. (Beth Skurrie, Fri Feb 13 17:20:28 2015 +1100)
440
+ * ed9c550 - Create --pact-specification-version option to toggle between v1 and v2 serialization (Beth Skurrie, Fri Feb 13 16:56:30 2015 +1100)
441
+
442
+ ### 0.3.0 (4 Feb 2015)
443
+
444
+ * 60869be - Refactor - moving classes from Pact::Consumer module into Pact::MockService module. (Beth Skurrie, Wed Feb 4 19:28:54 2015 +1100)
445
+ * 4ada4f0 - Added endpoint for PUT /interactions. Allow javascript client to set up all interactions at once and avoid callback hell. (Beth Skurrie, Thu Jan 29 21:48:00 2015 +1100)
446
+ * a329f49 - Add X-Pact-Mock-Service-Location header to all responses from the MockService (Beth Skurrie, Sun Jan 25 09:00:20 2015 +1100)
447
+
448
+ ### 0.2.4 (24 Jan 2015)
449
+
450
+ * b14050e - Add --ssl option for control server (Beth, Sat Jan 24 22:14:14 2015 +1100)
451
+ * a9821fd - Add --cors option to control command (Beth, Sat Jan 24 21:51:40 2015 +1100)
452
+ * 16d62c8 - Added endpoint to check if server is up and running without causing an error (Beth, Thu Jan 8 14:33:26 2015 +1100)
453
+ * f93ff1f - Added restart for control and mock service (Beth, Thu Jan 8 14:02:19 2015 +1100)
454
+ * 54b2cb8 - Added control server to allow mock servers to be dynamically set up (Beth, Wed Jan 7 08:24:19 2015 +1100)
455
+
456
+ ### 0.2.3 (21 Jan 2015)
457
+
458
+ * 560671e - Add support for using Pact::Terms in the path (Beth, Wed Jan 21 07:42:10 2015 +1100)
459
+ * 4324a97 - Renamed --cors-enabled to --cors (Beth, Wed Jan 21 07:28:34 2015 +1100)
460
+ * 5f5ee7e - Set Access-Control-Allow-Origin header to the the request Origin when populated. (Beth, Tue Jan 13 16:03:37 2015 +1100)
461
+
462
+ ### 0.2.3.rc2 (13 Jan 2015)
463
+
464
+ * daf0696 - Added --consumer and --provider options to CLI. Automatically write pact if both options are given at startup. (Beth, Mon Jan 5 20:48:47 2015 +1100)
465
+ * 351c44e - Write pact on shutdown (Beth, Mon Jan 5 17:17:24 2015 +1100)
466
+ * e206c9f - Adding cross domain headers (André Allavena, Tue Dec 23 18:01:46 2014 +1000)
467
+
468
+ ### 0.2.3.rc1 (3 Jan 2015)
469
+
470
+ * afd9cf3 - Removed awesome print gem dependency. (Beth, Sat Jan 3 16:49:40 2015 +1100)
471
+ * 5ae2c12 - Added rake task to package pact-mock-service as a standalone executable using Travelling Ruby. (Beth, Sat Jan 3 16:14:20 2015 +1100)
472
+ * b238f2a - Added message to indicate which part of the interactions differ when an interaction with the same description and provider state, but different request/response is added. https://github.com/realestate-com-au/pact/issues/18 (Beth, Sat Jan 3 14:20:36 2015 +1100)
473
+ * cf38365 - Moved check for 'almost duplicate' interaction to when the interaction is set up. If it occurs during replay, the error does not get shown to the user. https://github.com/bethesque/pact-mock_service/issues/1 (Beth, Sat Jan 3 11:10:47 2015 +1100)
474
+ * 1da9a74 - Added --pact-dir to CLI. Make --pact-dir and --log dir if they do not already exist. (Beth, Sat Jan 3 09:07:03 2015 +1100)
475
+ * 4a2a9a2 - Added handler for SIGTERM to shut down mock service. (Beth, Fri Jan 2 12:07:29 2015 +1100)
476
+ * 57c1a14 - Added support to run the mock service on SSL. Important for browser-based consumers. (Tal Rotbart, Wed Dec 31 09:43:52 2014 +1100)
477
+
478
+ ### 0.2.2 (29 October 2014)
479
+
480
+ * 515ed14 - Added feature tests for mock service to show how it should respond under different circumstances. (Beth, Wed Oct 29 09:21:15 2014 +1100)
481
+ * de6f670 - Added missing require for interaction decorator. (Beth, Wed Oct 29 09:19:27 2014 +1100)
482
+
483
+ ### 0.2.1 (24 October 2014)
484
+
485
+ * a4cf177 - Reifying the request headers, query and body when serializing pact. This allows Pact::Term to be used in the request without breaking verification for non-ruby providers that can't deserialise the Ruby specific serialisation of Pact::Terms. (Beth, Fri Oct 24 15:27:18 2014 +1100)
486
+
487
+ ### 0.2.0 (24 October 2014)
488
+
489
+ * d071e2c - Added field to /pact request body to specify the pact directory (Beth, Fri Oct 24 09:22:06 2014 +1100)
490
+
491
+ ### 0.1.0 (22 October 2014)
492
+
493
+ * 62caf8e - Removed Gemfile.lock from git (bethesque, Wed Oct 22 13:07:54 2014 +1100)
494
+ * 5b4d54e - Moved JSON serialisation code into decorators. Serialisation between DSL and mock service is different from serialisation to the pact file. (bethesque, Wed Oct 22 13:07:00 2014 +1100)
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pact.gemspec
4
+ gemspec
5
+
6
+ if ENV['X_PACT_DEVELOPMENT']
7
+ gem 'pact-support', path: '../pact-support'
8
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 James Fraser, Sergei Matheson, Brent Snook, Ronald Holshausen, Beth Skurrie
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,137 @@
1
+
2
+ # Pact Mock and Stub Service
3
+
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
+
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
+
8
+ The mock service provides the following endpoints:
9
+
10
+ * DELETE /interactions - clear previously mocked interactions
11
+ * POST /interactions - set up an expected interaction
12
+ * PUT /interactions - clear and set up multiple expected interactions in one call
13
+ * GET /interactions/verification - determine whether the expected interactions have taken place
14
+ * POST /pact - write the pact file
15
+ * GET / - the healthcheck endpoint
16
+
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
+
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-dev Google group][pact-dev].
20
+
21
+ ## Installation
22
+
23
+ ### Without Ruby
24
+
25
+ Use the Pact standalone [executables][executables].
26
+
27
+ ### With Ruby
28
+
29
+ Use the [pact][pact] gem if you would like the full Pact DSL, mock service and verification functionality in your ruby project.
30
+
31
+ Otherwise:
32
+
33
+ $ gem install pact-mock_service
34
+ $ pact-mock-service --consumer Foo --provider Bar --port 1234
35
+
36
+ Or add `gem "pact-mock_service"` to your Gemfile then run:
37
+
38
+ $ bundle install
39
+ $ bundle exec pact-mock-service --consumer Foo --provider Bar --port 1234
40
+
41
+ Run `pact-mock-service help` for command line options.
42
+
43
+ ## Mock Service Usage
44
+
45
+ Each mock service process is designed to mock only ONE provider for ONE consumer. To mock multiple providers, you will need to start a process for each provider. The lifecycle of a mock service instance during a test suite execution is as follows:
46
+
47
+ * _Before suite:_ start mock service
48
+ * _Before each test:_ clear interactions from previous test
49
+ * _During test:_ set up interactions, execute interactions
50
+ * _After each test:_ verify interactions
51
+ * _After suite:_ write pact file, stop mock service
52
+
53
+ Each mock service instance can only handle one test process/thread at a time. If you wish to run multiple test threads in parallel, you will need to start each mock service instance on a different port, and set the `--pact-file-write-mode` to `merge` (see usage notes below).
54
+
55
+ ```
56
+ Usage:
57
+ pact-mock-service service
58
+
59
+ Options:
60
+ [--consumer=CONSUMER] # Consumer name
61
+ [--provider=PROVIDER] # Provider name
62
+ -p, [--port=PORT] # Port on which to run the service
63
+ -h, [--host=HOST] # Host on which to bind the service
64
+ # Default: localhost
65
+ -d, [--pact-dir=PACT_DIR] # Directory to which the pacts will be written
66
+ -m, [--pact-file-write-mode=PACT_FILE_WRITE_MODE] # `overwrite` or `merge`. Use `merge` when running multiple mock service instances in parallel for the same consumer/provider pair. 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.
67
+ # Default: overwrite
68
+ -i, [--pact-specification-version=PACT_SPECIFICATION_VERSION] # The pact specification version to use when writing the pact
69
+ # Default: 2
70
+ -l, [--log=LOG] # File to which to log output
71
+ -o, [--cors=CORS] # Support browser security in tests by responding to OPTIONS requests and adding CORS headers to mocked responses
72
+ [--ssl], [--no-ssl] # Use a self-signed SSL cert to run the service over HTTPS
73
+ [--sslcert=SSLCERT] # Specify the path to the SSL cert to use when running the service over HTTPS
74
+ [--sslkey=SSLKEY] # Specify the path to the SSL key to use when running the service over HTTPS
75
+
76
+ Start a mock service. If the consumer, provider and pact-dir options are provided, the pact will be written automatically on shutdown (INT).
77
+ ```
78
+
79
+ See [script/example.sh](script/example.sh) for an executable example.
80
+
81
+ You can find more documentation for the mock service in the repository [wiki][wiki].
82
+
83
+ ### With SSL
84
+
85
+ If you need to use the mock service with HTTPS, you can use the built-in SSL mode which relies on and generates a self-signed certificate.
86
+
87
+ $ pact-mock-service --port 1234 --ssl
88
+
89
+ If you need to provide your own certificate and key, use the following syntax.
90
+
91
+ $ pact-mock-service --port 1234 --ssl --sslcert PATH_TO_CERT --sslkey PATH_TO_KEY
92
+
93
+ ### With CORS
94
+
95
+ Read the wiki page on [CORS][cors].
96
+
97
+ ## Stub Service Usage
98
+
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
+
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-dev google group and we can discuss potential enhancements.
102
+
103
+ ```
104
+ Usage:
105
+ pact-stub-service PACT_URI ...
106
+
107
+ Options:
108
+ -p, [--port=PORT] # Port on which to run the service
109
+ -h, [--host=HOST] # Host on which to bind the service
110
+ # Default: localhost
111
+ -l, [--log=LOG] # File to which to log output
112
+ -o, [--cors=CORS] # Support browser security in tests by responding to OPTIONS requests and adding CORS headers to mocked responses
113
+ [--ssl], [--no-ssl] # Use a self-signed SSL cert to run the service over HTTPS
114
+ [--sslcert=SSLCERT] # Specify the path to the SSL cert to use when running the service over HTTPS
115
+ [--sslkey=SSLKEY] # Specify the path to the SSL key to use when running the service over HTTPS
116
+
117
+ Description:
118
+ Start a stub service with the given pact file(s). Pact URIs may be local file paths or HTTP.
119
+ Include any basic auth details in the URL using the format https://USERNAME:PASSWORD@URI.
120
+ Where multiple matching interactions are found, the interactions will be sorted by
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-dev google group,
123
+ and we can discuss some potential enhancements.
124
+ Note that only versions 1 and 2 of the pact specification are currently fully supported.
125
+ Pacts using the v3 format may be used, however, any matching features added in v4 will
126
+ currently be ignored.
127
+ ```
128
+
129
+ ## Contributing
130
+
131
+ See [CONTRIBUTING.md](/CONTRIBUTING.md)
132
+
133
+ [pact]: https://github.com/realestate-com-au/pact
134
+ [executables]: https://github.com/pact-foundation/pact-ruby-standalone/releases
135
+ [pact-dev]: https://groups.google.com/forum/#!forum/pact-dev
136
+ [wiki]: https://github.com/pact-foundation/pact-mock_service/wiki
137
+ [cors]: https://github.com/pact-foundation/pact-mock_service/wiki/Using-the-mock-service-with-CORS
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pact/mock_service/cli'
3
+ Pact::MockService::CLI.start
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pact/stub_service/cli'
3
+ Pact::StubService::CLI.start