pact_broker-client 1.32.0 → 1.37.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release_gem.yml +1 -0
- data/.github/workflows/test.yml +23 -0
- data/CHANGELOG.md +48 -0
- data/README.md +15 -3
- data/Rakefile +2 -0
- data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +331 -8
- data/lib/pact_broker/client.rb +1 -1
- data/lib/pact_broker/client/backports.rb +13 -0
- data/lib/pact_broker/client/cli/broker.rb +73 -28
- data/lib/pact_broker/client/cli/can_i_deploy_long_desc.txt +18 -9
- data/lib/pact_broker/client/cli/custom_thor.rb +9 -12
- data/lib/pact_broker/client/git.rb +43 -22
- data/lib/pact_broker/client/hal/entity.rb +27 -3
- data/lib/pact_broker/client/hal/http_client.rb +4 -0
- data/lib/pact_broker/client/hal/links.rb +39 -0
- data/lib/pact_broker/client/hal_client_methods.rb +11 -0
- data/lib/pact_broker/client/hash_refinements.rb +19 -0
- data/lib/pact_broker/client/matrix.rb +2 -1
- data/lib/pact_broker/client/matrix/text_formatter.rb +46 -11
- data/lib/pact_broker/client/publish_pacts.rb +93 -14
- data/lib/pact_broker/client/tasks/publication_task.rb +37 -6
- data/lib/pact_broker/client/version.rb +1 -1
- data/lib/pact_broker/client/versions/record_deployment.rb +109 -0
- data/pact-broker-client.gemspec +2 -0
- data/script/publish-pact.sh +7 -1
- data/script/trigger-release.sh +1 -1
- data/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb +13 -2
- data/spec/lib/pact_broker/client/cli/broker_publish_spec.rb +108 -12
- data/spec/lib/pact_broker/client/git_spec.rb +39 -2
- data/spec/lib/pact_broker/client/hal/entity_spec.rb +4 -3
- data/spec/lib/pact_broker/client/matrix/text_formatter_spec.rb +29 -4
- data/spec/lib/pact_broker/client/publish_pacts_spec.rb +119 -7
- data/spec/lib/pact_broker/client/tasks/publication_task_spec.rb +88 -10
- data/spec/lib/pact_broker/client/versions/describe_spec.rb +0 -1
- data/spec/lib/pact_broker/client/versions/record_deployment_spec.rb +82 -0
- data/spec/pacts/pact_broker_client-pact_broker.json +335 -8
- data/spec/service_providers/pact_broker_client_create_version_spec.rb +89 -0
- data/spec/service_providers/pact_broker_client_matrix_spec.rb +4 -0
- data/spec/service_providers/pact_broker_client_versions_spec.rb +1 -2
- data/spec/service_providers/record_deployment_spec.rb +219 -0
- data/spec/support/matrix.json +6 -1
- data/spec/support/matrix.txt +3 -3
- data/spec/support/matrix_error.txt +3 -3
- data/spec/support/matrix_with_results.txt +10 -0
- data/tasks/pact.rake +2 -0
- metadata +44 -4
- data/.travis.yml +0 -11
@@ -186,6 +186,112 @@
|
|
186
186
|
}
|
187
187
|
}
|
188
188
|
},
|
189
|
+
{
|
190
|
+
"description": "a request for the index resource",
|
191
|
+
"providerState": "the pb:pacticipant-version relation exists in the index resource",
|
192
|
+
"request": {
|
193
|
+
"method": "get",
|
194
|
+
"path": "/",
|
195
|
+
"headers": {
|
196
|
+
"Accept": "application/hal+json"
|
197
|
+
}
|
198
|
+
},
|
199
|
+
"response": {
|
200
|
+
"status": 200,
|
201
|
+
"headers": {
|
202
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
203
|
+
},
|
204
|
+
"body": {
|
205
|
+
"_links": {
|
206
|
+
"pb:pacticipant-version": {
|
207
|
+
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-INDEX-PB-PACTICIPANT-VERSION-{pacticipant}-{version}"
|
208
|
+
}
|
209
|
+
}
|
210
|
+
},
|
211
|
+
"matchingRules": {
|
212
|
+
"$.body._links.pb:pacticipant-version.href": {
|
213
|
+
"match": "regex",
|
214
|
+
"regex": "http:\\/\\/.*{pacticipant}.*{version}"
|
215
|
+
}
|
216
|
+
}
|
217
|
+
}
|
218
|
+
},
|
219
|
+
{
|
220
|
+
"description": "a request to create a pacticipant version",
|
221
|
+
"providerState": "version 26f353580936ad3b9baddb17b00e84f33c69e7cb of pacticipant Foo does not exist",
|
222
|
+
"request": {
|
223
|
+
"method": "put",
|
224
|
+
"path": "/HAL-REL-PLACEHOLDER-INDEX-PB-PACTICIPANT-VERSION-Foo-26f353580936ad3b9baddb17b00e84f33c69e7cb",
|
225
|
+
"headers": {
|
226
|
+
"Content-Type": "application/json",
|
227
|
+
"Accept": "application/hal+json"
|
228
|
+
},
|
229
|
+
"body": {
|
230
|
+
"branch": "main",
|
231
|
+
"buildUrl": "http://my-ci/builds/1"
|
232
|
+
}
|
233
|
+
},
|
234
|
+
"response": {
|
235
|
+
"status": 201,
|
236
|
+
"headers": {
|
237
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
238
|
+
},
|
239
|
+
"body": {
|
240
|
+
"number": "26f353580936ad3b9baddb17b00e84f33c69e7cb",
|
241
|
+
"branch": "main",
|
242
|
+
"buildUrl": "http://my-ci/builds/1",
|
243
|
+
"_links": {
|
244
|
+
"self": {
|
245
|
+
"href": "http://localhost:1234/some-url"
|
246
|
+
}
|
247
|
+
}
|
248
|
+
},
|
249
|
+
"matchingRules": {
|
250
|
+
"$.body._links.self.href": {
|
251
|
+
"match": "regex",
|
252
|
+
"regex": "http:\\/\\/.*"
|
253
|
+
}
|
254
|
+
}
|
255
|
+
}
|
256
|
+
},
|
257
|
+
{
|
258
|
+
"description": "a request to create a pacticipant version",
|
259
|
+
"providerState": "version 26f353580936ad3b9baddb17b00e84f33c69e7cb of pacticipant Foo does exist",
|
260
|
+
"request": {
|
261
|
+
"method": "put",
|
262
|
+
"path": "/HAL-REL-PLACEHOLDER-INDEX-PB-PACTICIPANT-VERSION-Foo-26f353580936ad3b9baddb17b00e84f33c69e7cb",
|
263
|
+
"headers": {
|
264
|
+
"Content-Type": "application/json",
|
265
|
+
"Accept": "application/hal+json"
|
266
|
+
},
|
267
|
+
"body": {
|
268
|
+
"branch": "main",
|
269
|
+
"buildUrl": "http://my-ci/builds/1"
|
270
|
+
}
|
271
|
+
},
|
272
|
+
"response": {
|
273
|
+
"status": 200,
|
274
|
+
"headers": {
|
275
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
276
|
+
},
|
277
|
+
"body": {
|
278
|
+
"number": "26f353580936ad3b9baddb17b00e84f33c69e7cb",
|
279
|
+
"branch": "main",
|
280
|
+
"buildUrl": "http://my-ci/builds/1",
|
281
|
+
"_links": {
|
282
|
+
"self": {
|
283
|
+
"href": "http://localhost:1234/some-url"
|
284
|
+
}
|
285
|
+
}
|
286
|
+
},
|
287
|
+
"matchingRules": {
|
288
|
+
"$.body._links.self.href": {
|
289
|
+
"match": "regex",
|
290
|
+
"regex": "http:\\/\\/.*"
|
291
|
+
}
|
292
|
+
}
|
293
|
+
}
|
294
|
+
},
|
189
295
|
{
|
190
296
|
"description": "a request for the compatibility matrix for Foo version 1.2.3 and Bar version 4.5.6",
|
191
297
|
"providerState": "the pact for Foo version 1.2.3 has been verified by Bar version 4.5.6",
|
@@ -221,7 +327,12 @@
|
|
221
327
|
},
|
222
328
|
"verificationResult": {
|
223
329
|
"verifiedAt": "2017-10-10T12:49:04+11:00",
|
224
|
-
"success": true
|
330
|
+
"success": true,
|
331
|
+
"_links": {
|
332
|
+
"self": {
|
333
|
+
"href": "http://result"
|
334
|
+
}
|
335
|
+
}
|
225
336
|
},
|
226
337
|
"pact": {
|
227
338
|
"createdAt": "2017-10-10T12:49:04+11:00"
|
@@ -271,7 +382,12 @@
|
|
271
382
|
},
|
272
383
|
"verificationResult": {
|
273
384
|
"verifiedAt": "2017-10-10T12:49:04+11:00",
|
274
|
-
"success": true
|
385
|
+
"success": true,
|
386
|
+
"_links": {
|
387
|
+
"self": {
|
388
|
+
"href": "http://result"
|
389
|
+
}
|
390
|
+
}
|
275
391
|
},
|
276
392
|
"pact": {
|
277
393
|
"createdAt": "2017-10-10T12:49:04+11:00"
|
@@ -321,7 +437,12 @@
|
|
321
437
|
},
|
322
438
|
"verificationResult": {
|
323
439
|
"verifiedAt": "2017-10-10T12:49:04+11:00",
|
324
|
-
"success": true
|
440
|
+
"success": true,
|
441
|
+
"_links": {
|
442
|
+
"self": {
|
443
|
+
"href": "http://result"
|
444
|
+
}
|
445
|
+
}
|
325
446
|
},
|
326
447
|
"pact": {
|
327
448
|
"createdAt": "2017-10-10T12:49:04+11:00"
|
@@ -418,7 +539,12 @@
|
|
418
539
|
},
|
419
540
|
"verificationResult": {
|
420
541
|
"verifiedAt": "2017-10-10T12:49:04+11:00",
|
421
|
-
"success": true
|
542
|
+
"success": true,
|
543
|
+
"_links": {
|
544
|
+
"self": {
|
545
|
+
"href": "http://result"
|
546
|
+
}
|
547
|
+
}
|
422
548
|
},
|
423
549
|
"pact": {
|
424
550
|
"createdAt": "2017-10-10T12:49:04+11:00"
|
@@ -439,7 +565,12 @@
|
|
439
565
|
},
|
440
566
|
"verificationResult": {
|
441
567
|
"verifiedAt": "2017-10-10T12:49:04+11:00",
|
442
|
-
"success": true
|
568
|
+
"success": true,
|
569
|
+
"_links": {
|
570
|
+
"self": {
|
571
|
+
"href": "http://result"
|
572
|
+
}
|
573
|
+
}
|
443
574
|
},
|
444
575
|
"pact": {
|
445
576
|
"createdAt": "2017-10-10T12:49:04+11:00"
|
@@ -492,7 +623,12 @@
|
|
492
623
|
},
|
493
624
|
"verificationResult": {
|
494
625
|
"verifiedAt": "2017-10-10T12:49:04+11:00",
|
495
|
-
"success": true
|
626
|
+
"success": true,
|
627
|
+
"_links": {
|
628
|
+
"self": {
|
629
|
+
"href": "http://result"
|
630
|
+
}
|
631
|
+
}
|
496
632
|
},
|
497
633
|
"pact": {
|
498
634
|
"createdAt": "2017-10-10T12:49:04+11:00"
|
@@ -542,7 +678,12 @@
|
|
542
678
|
},
|
543
679
|
"verificationResult": {
|
544
680
|
"verifiedAt": "2017-10-10T12:49:04+11:00",
|
545
|
-
"success": true
|
681
|
+
"success": true,
|
682
|
+
"_links": {
|
683
|
+
"self": {
|
684
|
+
"href": "http://result"
|
685
|
+
}
|
686
|
+
}
|
546
687
|
},
|
547
688
|
"pact": {
|
548
689
|
"createdAt": "2017-10-10T12:49:04+11:00"
|
@@ -592,7 +733,12 @@
|
|
592
733
|
},
|
593
734
|
"verificationResult": {
|
594
735
|
"verifiedAt": "2017-10-10T12:49:04+11:00",
|
595
|
-
"success": true
|
736
|
+
"success": true,
|
737
|
+
"_links": {
|
738
|
+
"self": {
|
739
|
+
"href": "http://result"
|
740
|
+
}
|
741
|
+
}
|
596
742
|
},
|
597
743
|
"pact": {
|
598
744
|
"createdAt": "2017-10-10T12:49:04+11:00"
|
@@ -1404,6 +1550,187 @@
|
|
1404
1550
|
}
|
1405
1551
|
}
|
1406
1552
|
},
|
1553
|
+
{
|
1554
|
+
"description": "a request for the index resource",
|
1555
|
+
"providerState": "the pb:pacticipant-version and pb:environments relations exist in the index resource",
|
1556
|
+
"request": {
|
1557
|
+
"method": "GET",
|
1558
|
+
"path": "/",
|
1559
|
+
"headers": {
|
1560
|
+
"Accept": "application/hal+json"
|
1561
|
+
}
|
1562
|
+
},
|
1563
|
+
"response": {
|
1564
|
+
"status": 200,
|
1565
|
+
"headers": {
|
1566
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1567
|
+
},
|
1568
|
+
"body": {
|
1569
|
+
"_links": {
|
1570
|
+
"pb:pacticipant-version": {
|
1571
|
+
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-{pacticipant}-{version}"
|
1572
|
+
},
|
1573
|
+
"pb:environments": {
|
1574
|
+
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-ENVIRONMENTS"
|
1575
|
+
}
|
1576
|
+
}
|
1577
|
+
},
|
1578
|
+
"matchingRules": {
|
1579
|
+
"$.body._links.pb:pacticipant-version.href": {
|
1580
|
+
"match": "regex",
|
1581
|
+
"regex": "http:\\/\\/.*{pacticipant}.*{version}"
|
1582
|
+
},
|
1583
|
+
"$.body._links.pb:environments.href": {
|
1584
|
+
"match": "regex",
|
1585
|
+
"regex": "http:\\/\\/.*"
|
1586
|
+
}
|
1587
|
+
}
|
1588
|
+
}
|
1589
|
+
},
|
1590
|
+
{
|
1591
|
+
"description": "a request for a pacticipant version",
|
1592
|
+
"providerState": "version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with a test environment available for deployment",
|
1593
|
+
"request": {
|
1594
|
+
"method": "GET",
|
1595
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
1596
|
+
"headers": {
|
1597
|
+
"Accept": "application/hal+json"
|
1598
|
+
}
|
1599
|
+
},
|
1600
|
+
"response": {
|
1601
|
+
"status": 200,
|
1602
|
+
"headers": {
|
1603
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1604
|
+
},
|
1605
|
+
"body": {
|
1606
|
+
"_links": {
|
1607
|
+
"pb:record-deployment": [
|
1608
|
+
{
|
1609
|
+
"name": "test",
|
1610
|
+
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-RECORD-DEPLOYMENT-FOO-5556B8149BF8BAC76BC30F50A8A2DD4C22C85F30-TEST"
|
1611
|
+
}
|
1612
|
+
]
|
1613
|
+
}
|
1614
|
+
},
|
1615
|
+
"matchingRules": {
|
1616
|
+
"$.body._links.pb:record-deployment[0].href": {
|
1617
|
+
"match": "regex",
|
1618
|
+
"regex": "http:\\/\\/.*"
|
1619
|
+
}
|
1620
|
+
}
|
1621
|
+
}
|
1622
|
+
},
|
1623
|
+
{
|
1624
|
+
"description": "a request to record a deployment",
|
1625
|
+
"providerState": "version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with a test environment available for deployment",
|
1626
|
+
"request": {
|
1627
|
+
"method": "POST",
|
1628
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-RECORD-DEPLOYMENT-FOO-5556B8149BF8BAC76BC30F50A8A2DD4C22C85F30-TEST",
|
1629
|
+
"headers": {
|
1630
|
+
"Content-Type": "application/json",
|
1631
|
+
"Accept": "application/hal+json"
|
1632
|
+
},
|
1633
|
+
"body": {
|
1634
|
+
"replacedPreviousDeployedVersion": true
|
1635
|
+
}
|
1636
|
+
},
|
1637
|
+
"response": {
|
1638
|
+
"status": 201,
|
1639
|
+
"headers": {
|
1640
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1641
|
+
},
|
1642
|
+
"body": {
|
1643
|
+
"replacedPreviousDeployedVersion": true
|
1644
|
+
}
|
1645
|
+
}
|
1646
|
+
},
|
1647
|
+
{
|
1648
|
+
"description": "a request for a pacticipant version",
|
1649
|
+
"providerState": "version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo does not exist",
|
1650
|
+
"request": {
|
1651
|
+
"method": "GET",
|
1652
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
1653
|
+
"headers": {
|
1654
|
+
"Accept": "application/hal+json"
|
1655
|
+
}
|
1656
|
+
},
|
1657
|
+
"response": {
|
1658
|
+
"status": 404,
|
1659
|
+
"headers": {
|
1660
|
+
}
|
1661
|
+
}
|
1662
|
+
},
|
1663
|
+
{
|
1664
|
+
"description": "a request for a pacticipant version",
|
1665
|
+
"providerState": "version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with 2 environments that aren't test available for deployment",
|
1666
|
+
"request": {
|
1667
|
+
"method": "GET",
|
1668
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
1669
|
+
"headers": {
|
1670
|
+
"Accept": "application/hal+json"
|
1671
|
+
}
|
1672
|
+
},
|
1673
|
+
"response": {
|
1674
|
+
"status": 200,
|
1675
|
+
"headers": {
|
1676
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1677
|
+
},
|
1678
|
+
"body": {
|
1679
|
+
"_links": {
|
1680
|
+
"pb:record-deployment": [
|
1681
|
+
{
|
1682
|
+
"name": "prod",
|
1683
|
+
"href": "href"
|
1684
|
+
},
|
1685
|
+
{
|
1686
|
+
"name": "dev",
|
1687
|
+
"href": "href"
|
1688
|
+
}
|
1689
|
+
]
|
1690
|
+
}
|
1691
|
+
},
|
1692
|
+
"matchingRules": {
|
1693
|
+
"$.body._links.pb:record-deployment[0]": {
|
1694
|
+
"match": "type"
|
1695
|
+
},
|
1696
|
+
"$.body._links.pb:record-deployment[1]": {
|
1697
|
+
"match": "type"
|
1698
|
+
}
|
1699
|
+
}
|
1700
|
+
}
|
1701
|
+
},
|
1702
|
+
{
|
1703
|
+
"description": "a request for the environments",
|
1704
|
+
"providerState": "an environment with name test exists",
|
1705
|
+
"request": {
|
1706
|
+
"method": "GET",
|
1707
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-ENVIRONMENTS",
|
1708
|
+
"headers": {
|
1709
|
+
"Accept": "application/hal+json"
|
1710
|
+
}
|
1711
|
+
},
|
1712
|
+
"response": {
|
1713
|
+
"status": 200,
|
1714
|
+
"headers": {
|
1715
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1716
|
+
},
|
1717
|
+
"body": {
|
1718
|
+
"_links": {
|
1719
|
+
"pb:environments": [
|
1720
|
+
{
|
1721
|
+
"name": "test",
|
1722
|
+
"href": "href"
|
1723
|
+
}
|
1724
|
+
]
|
1725
|
+
}
|
1726
|
+
},
|
1727
|
+
"matchingRules": {
|
1728
|
+
"$.body._links.pb:environments[0].href": {
|
1729
|
+
"match": "type"
|
1730
|
+
}
|
1731
|
+
}
|
1732
|
+
}
|
1733
|
+
},
|
1407
1734
|
{
|
1408
1735
|
"description": "a request to create a webhook with a JSON body for a consumer and provider",
|
1409
1736
|
"providerState": "the 'Pricing Service' and 'Condor' already exist in the pact-broker",
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require_relative 'pact_helper'
|
2
|
+
require 'pact_broker/client'
|
3
|
+
require 'pact_broker/client/publish_pacts'
|
4
|
+
|
5
|
+
describe PactBroker::Client::Versions, pact: true do
|
6
|
+
|
7
|
+
include_context "pact broker"
|
8
|
+
|
9
|
+
|
10
|
+
describe "creating a pacticipant version" do
|
11
|
+
before do
|
12
|
+
allow(publish_pacts).to receive(:consumer_names).and_return(["Foo"])
|
13
|
+
allow($stdout).to receive(:puts)
|
14
|
+
end
|
15
|
+
let(:version_path) { "/HAL-REL-PLACEHOLDER-INDEX-PB-PACTICIPANT-VERSION-{pacticipant}-{version}" }
|
16
|
+
let(:version_url) { pact_broker.mock_service_base_url + version_path }
|
17
|
+
let(:number) { "26f353580936ad3b9baddb17b00e84f33c69e7cb" }
|
18
|
+
let(:branch) { "main" }
|
19
|
+
let(:build_url) { "http://my-ci/builds/1" }
|
20
|
+
let(:consumer_version_params) { { number: number, branch: branch, build_url: build_url } }
|
21
|
+
let(:publish_pacts) { PactBroker::Client::PublishPacts.new(pact_broker.mock_service_base_url, ["some-pact.json"], consumer_version_params, {}) }
|
22
|
+
let(:provider_state) { "version #{number} of pacticipant Foo does not exist" }
|
23
|
+
let(:expected_response_status) { 201 }
|
24
|
+
|
25
|
+
subject { publish_pacts.send(:create_consumer_versions) }
|
26
|
+
|
27
|
+
before do
|
28
|
+
pact_broker
|
29
|
+
.given("the pb:pacticipant-version relation exists in the index resource")
|
30
|
+
.upon_receiving("a request for the index resource")
|
31
|
+
.with(
|
32
|
+
method: :get,
|
33
|
+
path: '/',
|
34
|
+
headers: get_request_headers).
|
35
|
+
will_respond_with(
|
36
|
+
status: 200,
|
37
|
+
headers: pact_broker_response_headers,
|
38
|
+
body: {
|
39
|
+
_links: {
|
40
|
+
:'pb:pacticipant-version' => {
|
41
|
+
href: Pact.term(version_url, /http:\/\/.*{pacticipant}.*{version}/)
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
)
|
46
|
+
|
47
|
+
pact_broker
|
48
|
+
.given(provider_state)
|
49
|
+
.upon_receiving("a request to create a pacticipant version")
|
50
|
+
.with(
|
51
|
+
method: :put,
|
52
|
+
path: "/HAL-REL-PLACEHOLDER-INDEX-PB-PACTICIPANT-VERSION-Foo-#{number}",
|
53
|
+
headers: put_request_headers,
|
54
|
+
body: {
|
55
|
+
branch: branch,
|
56
|
+
buildUrl: build_url
|
57
|
+
}).
|
58
|
+
will_respond_with(
|
59
|
+
status: expected_response_status,
|
60
|
+
headers: pact_broker_response_headers,
|
61
|
+
body: {
|
62
|
+
number: number,
|
63
|
+
branch: branch,
|
64
|
+
buildUrl: build_url,
|
65
|
+
_links: {
|
66
|
+
self: {
|
67
|
+
href: Pact.term('http://localhost:1234/some-url', %r{http://.*})
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
context "when the version does not already exist" do
|
75
|
+
it "returns true" do
|
76
|
+
expect(subject).to be true
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context "when the version does exist" do
|
81
|
+
let(:provider_state) { "version #{number} of pacticipant Foo does exist" }
|
82
|
+
let(:expected_response_status) { 200 }
|
83
|
+
|
84
|
+
it "returns true" do
|
85
|
+
expect(subject).to be true
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|