diff --git a/lib/pact_broker/api/resources/verification.rb b/lib/pact_broker/api/resources/verification.rb index bd4ed4590..d550be927 100644 --- a/lib/pact_broker/api/resources/verification.rb +++ b/lib/pact_broker/api/resources/verification.rb @@ -24,7 +24,12 @@ def allowed_methods end def resource_exists? - !!verification + if identifier_from_path[:verification_number] == "all" + set_json_error_message("To see all the verifications for a pact, use the Matrix page") + false + else + !!verification + end end def to_json diff --git a/spec/lib/pact_broker/api/resources/verification_spec.rb b/spec/lib/pact_broker/api/resources/verification_spec.rb new file mode 100644 index 000000000..ffb0f2a45 --- /dev/null +++ b/spec/lib/pact_broker/api/resources/verification_spec.rb @@ -0,0 +1,18 @@ +require 'pact_broker/api/resources/verification' + +module PactBroker + module Api + module Resources + describe Verification do + context "when someone tries to get all the verifications for a pact" do + subject { get("/pacts/provider/Bar/consumer/Foo/pact-version/1/verification-results/all") } + + it "tells them to use the matrix" do + expect(subject.status).to eq 404 + expect(subject.body).to include "Matrix" + end + end + end + end + end +end