pact_broker-client 1.49.0 → 1.51.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +2 -2
- data/CHANGELOG.md +30 -0
- data/README.md +661 -230
- data/doc/CAN_I_DEPLOY_USAGE_WITH_TAGS.md +107 -0
- data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +77 -80
- data/example/scripts/verify-changed-pact.sh +30 -0
- data/lib/pact_broker/client/cli/can_i_deploy_long_desc.txt +13 -98
- data/lib/pact_broker/client/cli/environment_commands.rb +1 -1
- data/lib/pact_broker/client/cli/matrix_commands.rb +2 -2
- data/lib/pact_broker/client/cli/webhook_commands.rb +5 -0
- data/lib/pact_broker/client/matrix/abbreviate_version_number.rb +27 -5
- data/lib/pact_broker/client/publish_pacts.rb +5 -6
- data/lib/pact_broker/client/publish_pacts_the_old_way.rb +4 -49
- data/lib/pact_broker/client/version.rb +1 -1
- data/pact-broker-client.gemspec +1 -1
- data/script/publish-pact.sh +1 -1
- data/script/update-cli-usage-in-readme.rb +152 -0
- data/spec/lib/pact_broker/client/matrix/abbreviate_version_number_spec.rb +42 -0
- data/spec/lib/pact_broker/client/publish_pacts_the_old_way_spec.rb +3 -74
- data/spec/pacts/pact_broker_client-pact_broker.json +106 -106
- data/spec/readme_spec.rb +16 -0
- data/spec/service_providers/publish_pacts_spec.rb +3 -6
- metadata +12 -10
- data/doc/markdown/Pact Broker Client - Pact Broker.md +0 -582
- data/doc/markdown/README.md +0 -3
- data/script/generate-cli-usage.sh +0 -20
- data/spec/service_providers/pact_broker_client_create_version_spec.rb +0 -89
data/doc/markdown/README.md
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
echo '### publish'
|
2
|
-
echo ''
|
3
|
-
echo '```'
|
4
|
-
echo "$(bundle exec bin/pact-broker help publish)"
|
5
|
-
echo '```'
|
6
|
-
echo ''
|
7
|
-
echo '### create-version-tag'
|
8
|
-
echo ''
|
9
|
-
echo '```'
|
10
|
-
echo "$(bundle exec bin/pact-broker help create-version-tag)"
|
11
|
-
echo '```'
|
12
|
-
echo ''
|
13
|
-
echo '### can-i-deploy'
|
14
|
-
echo ''
|
15
|
-
echo '*This feature is in beta release, and backwards compatibility is NOT guaranteed.*'
|
16
|
-
echo 'You will need the latest version of the Pact Broker for this feature to work.'
|
17
|
-
echo ''
|
18
|
-
echo '```'
|
19
|
-
echo "$(bundle exec bin/pact-broker help can-i-deploy)"
|
20
|
-
echo '```'
|
@@ -1,89 +0,0 @@
|
|
1
|
-
require_relative 'pact_helper'
|
2
|
-
require 'pact_broker/client'
|
3
|
-
require 'pact_broker/client/publish_pacts_the_old_way'
|
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_the_old_way).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_the_old_way) { PactBroker::Client::PublishPactsTheOldWay.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_the_old_way.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
|