Sha256: 39511453b2b626a0e51f794cedf110109b27fab0a612cc6401de9f42fd8f7019

Contents?: true

Size: 1.28 KB

Versions: 12

Compression:

Stored size: 1.28 KB

Contents

require "pact_broker/webhooks/triggered_webhook"

module PactBroker
  module Webhooks
    describe TriggeredWebhook do
      let(:status) { TriggeredWebhook::STATUS_SUCCESS }

      subject { TriggeredWebhook.new(status: status) }

      describe "remaining_attempts" do
        before do
          PactBroker.configuration.webhook_retry_schedule = [1, 1, 1]
          allow(subject).to receive(:webhook_executions).and_return([double("execution")])
        end

        its(:number_of_attempts_made) { is_expected.to eq 1 }

        context "when its status is retrying" do
          let(:status) { TriggeredWebhook::STATUS_RETRYING }
          its(:number_of_attempts_remaining) { is_expected.to eq 3  }
        end

        context "when its status is not_run" do
          let(:status) { TriggeredWebhook::STATUS_NOT_RUN }
          its(:number_of_attempts_remaining) { is_expected.to eq 3  }
        end

        context "when its status is success" do
          let(:status) { TriggeredWebhook::STATUS_SUCCESS }
          its(:number_of_attempts_remaining) { is_expected.to eq 0}
        end

        context "when its status is failure" do
          let(:status) { TriggeredWebhook::STATUS_FAILURE }
          its(:number_of_attempts_remaining) { is_expected.to eq 0}
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pact_broker-2.89.1 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.89.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.88.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.87.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.86.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.85.1 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.85.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.84.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.83.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.82.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.81.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.80.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb