Sha256: cf18c1f91cb615a32542c17bb807b8c6c2e86d5d5c5d615ea57e9d8210b1aded

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

Contents

require 'pact_broker/domain/webhook_request'
# certificates and key generated by script/generate-certificates-for-webooks-certificate-spec.rb

describe "executing a webhook to a server with a self signed certificate" do
  let(:td) { TestDataBuilder.new }
  before(:all) do
    @pipe = IO.popen("bundle exec ruby spec/support/ssl_webhook_server.rb")
    sleep 3
  end

  let(:webhook_request) do
    PactBroker::Domain::WebhookRequest.new(
      method: 'get',
      url: 'https://localhost:4444/')
  end

  let(:pact) { td.create_pact_with_hierarchy.and_return(:pact) }

  subject { webhook_request.execute({}) }

  context "without the correct cacert" do
    it "fails" do
      expect(subject.success?).to be false
    end
  end

  context "with the correct cacert" do
    let!(:certificate) do
      td.create_certificate(path: 'spec/fixtures/certificates/cacert.pem')
    end

    it "succeeds" do
      puts subject.error unless subject.success?
      expect(subject.success?).to be true
    end
  end

  after(:all) do
    Process.kill 'KILL', @pipe.pid
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pact_broker-2.27.6 spec/integration/webhooks/certificate_spec.rb
pact_broker-2.27.5 spec/integration/webhooks/certificate_spec.rb
pact_broker-2.27.4 spec/integration/webhooks/certificate_spec.rb
pact_broker-2.27.3 spec/integration/webhooks/certificate_spec.rb
pact_broker-2.27.2 spec/integration/webhooks/certificate_spec.rb
pact_broker-2.27.0 spec/integration/webhooks/certificate_spec.rb
pact_broker-2.26.1 spec/integration/webhooks/certificate_spec.rb
pact_broker-2.26.0 spec/integration/webhooks/certificate_spec.rb
pact_broker-2.25.0 spec/integration/webhooks/certificate_spec.rb