Sha256: 92f8a35dd57fff0db6b6f6e86098ffde2103ffb14362c624edad3889a1958f58

Contents?: true

Size: 1.28 KB

Versions: 112

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

112 entries across 112 versions & 1 rubygems

Version Path
pact_broker-2.52.1 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.52.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.51.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.50.1 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.50.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.49.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.48.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.47.1 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.47.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.46.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.45.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.44.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.43.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.42.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.41.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.40.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.39.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.38.1 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.38.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.37.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb