From 0af0691016d34767ac269445ea6b4f7f4a3d734d Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Thu, 9 Nov 2023 14:45:33 +1100 Subject: [PATCH] fix: assert provider retrieved successfully before using link Fixes: https://github.com/pact-foundation/pact-ruby/issues/296 --- lib/pact/hal/entity.rb | 4 ++++ lib/pact/provider/verification_results/publish.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pact/hal/entity.rb b/lib/pact/hal/entity.rb index 52523f04..33490a17 100644 --- a/lib/pact/hal/entity.rb +++ b/lib/pact/hal/entity.rb @@ -23,6 +23,10 @@ def get(key, *args) _link(key).get(*args) end + def get!(key, *args) + _link(key).get!(*args) + end + def post(key, *args) _link(key).post(*args) end diff --git a/lib/pact/provider/verification_results/publish.rb b/lib/pact/provider/verification_results/publish.rb index 59bb47e5..671131a8 100644 --- a/lib/pact/provider/verification_results/publish.rb +++ b/lib/pact/provider/verification_results/publish.rb @@ -135,7 +135,7 @@ def provider_name end def provider_entity - @provider_entity ||= pact_entity.get(PROVIDER_RELATION) + @provider_entity ||= pact_entity.get!(PROVIDER_RELATION) end end end