Skip to content

Commit

Permalink
fix: show webhook status as not_run when all triggered webhooks are n…
Browse files Browse the repository at this point in the history
…ot_run
  • Loading branch information
bethesque committed Oct 6, 2017
1 parent 50aa520 commit 2d014b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pact_broker/webhooks/status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions spec/lib/pact_broker/webhooks/status_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2d014b2

Please sign in to comment.