diff --git a/lib/pact_broker/webhooks/status.rb b/lib/pact_broker/webhooks/status.rb index c367e3f0a..b107d0a25 100644 --- a/lib/pact_broker/webhooks/status.rb +++ b/lib/pact_broker/webhooks/status.rb @@ -13,7 +13,7 @@ def to_s def to_sym return :none if webhooks.empty? - return :not_run if latest_triggered_webhooks.empty? + return :not_run if latest_triggered_webhooks.empty? || latest_triggered_webhooks.all?{|w| w.status == "not_run"} if latest_triggered_webhooks.any?{|w| w.status == "retrying" } return :retrying end diff --git a/spec/lib/pact_broker/webhooks/status_spec.rb b/spec/lib/pact_broker/webhooks/status_spec.rb index 251505ed0..a2a9dc4cf 100644 --- a/spec/lib/pact_broker/webhooks/status_spec.rb +++ b/spec/lib/pact_broker/webhooks/status_spec.rb @@ -23,6 +23,12 @@ module Webhooks its(:to_sym) { is_expected.to eq :not_run } end + context "when all the triggered_webhooks are not_run" do + let(:status_1) { TriggeredWebhook::STATUS_NOT_RUN } + let(:status_2) { TriggeredWebhook::STATUS_NOT_RUN } + its(:to_sym) { is_expected.to eq :not_run } + end + context "when the most recent triggered webhooks are successful" do its(:to_sym) { is_expected.to eq :success } end