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.79.1 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.79.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.78.1 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.78.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.77.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.76.2 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.76.1 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.76.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.75.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.74.1 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.74.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.73.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.72.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.71.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.70.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.69.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.68.1 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.68.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.67.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb
pact_broker-2.66.0 spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb