Sha256: 584fd4342910a44ebc0fbf6545f98a40f7dc47109d93d9632b4bb4d48fe71948
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
require 'pact_broker/domain/webhook_request' require 'faraday' # 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 def wait_for_server_to_start Faraday.new(url: "https://localhost:4444", ssl: {verify: false}) do |builder| builder.request :retry, max: 20, interval: 0.5, exceptions: [StandardError] builder.adapter :net_http end.get end before(:all) do @pipe = IO.popen("bundle exec ruby spec/support/ssl_webhook_server.rb") wait_for_server_to_start end let(:td) { TestDataBuilder.new } 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({ show_response: true }) } 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pact_broker-2.32.0 | spec/integration/webhooks/certificate_spec.rb |