Sha256: 251bca296907c8dc40bc6640222f1403aacc2435c5d1041da145735d01293736

Contents?: true

Size: 1.05 KB

Versions: 8

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'
require 'pact_broker/domain/webhook'

module PactBroker

  module Domain

    describe Webhook do

      let(:consumer) { Pacticipant.new(name: 'Consumer')}
      let(:provider) { Pacticipant.new(name: 'Provider')}
      let(:request) { instance_double(PactBroker::Domain::WebhookRequest, execute: nil)}
      let(:options) { double('options') }
      subject { Webhook.new(request: request, consumer: consumer, provider: provider,) }

      describe "description" do
        it "returns a description of the webhook" do
          expect(subject.description).to eq "A webhook for the pact between Consumer and Provider"
        end
      end

      describe "execute" do

        it "executes the request" do
          expect(request).to receive(:execute).with(options)
          subject.execute options
        end

        it "logs before and after" do
          allow(PactBroker.logger).to receive(:info)
          expect(PactBroker.logger).to receive(:info).with(/Executing/)
          subject.execute options
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pact_broker-2.8.0.beta.5 spec/lib/pact_broker/domain/webhook_spec.rb
pact_broker-2.8.0.beta.4 spec/lib/pact_broker/domain/webhook_spec.rb
pact_broker-2.7.0.beta.3 spec/lib/pact_broker/domain/webhook_spec.rb
pact_broker-2.7.0.beta.2 spec/lib/pact_broker/domain/webhook_spec.rb
pact_broker-2.7.0.beta.1 spec/lib/pact_broker/domain/webhook_spec.rb
pact_broker-2.6.0 spec/lib/pact_broker/domain/webhook_spec.rb
pact_broker-2.5.1 spec/lib/pact_broker/domain/webhook_spec.rb
pact_broker-2.5.0 spec/lib/pact_broker/domain/webhook_spec.rb