Skip to content

Commit bea5951

Browse files
committed
feat: show more helpful error message when someone tries to get /all verifications for a pact
1 parent c1a76f5 commit bea5951

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

lib/pact_broker/api/resources/verification.rb

+6-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ def allowed_methods
2424
end
2525

2626
def resource_exists?
27-
!!verification
27+
if identifier_from_path[:verification_number] == "all"
28+
set_json_error_message("To see all the verifications for a pact, use the Matrix page")
29+
false
30+
else
31+
!!verification
32+
end
2833
end
2934

3035
def to_json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
require 'pact_broker/api/resources/verification'
2+
3+
module PactBroker
4+
module Api
5+
module Resources
6+
describe Verification do
7+
context "when someone tries to get all the verifications for a pact" do
8+
subject { get("/pacts/provider/Bar/consumer/Foo/pact-version/1/verification-results/all") }
9+
10+
it "tells them to use the matrix" do
11+
expect(subject.status).to eq 404
12+
expect(subject.body).to include "Matrix"
13+
end
14+
end
15+
end
16+
end
17+
end
18+
end

0 commit comments

Comments
 (0)