Sha256: 35c4145f11310ccd77f859dc9d8c5a2f60c02a14ec995dcbc1c0f3d8a322c17e

Contents?: true

Size: 1.22 KB

Versions: 12

Compression:

Stored size: 1.22 KB

Contents

require "spec_helper"
require "pact_broker/build_http_options"

module PactBroker
  describe BuildHttpOptions do

    subject { PactBroker::BuildHttpOptions.call(url) }

    context "default http options" do
      before do
        PactBroker.configuration.disable_ssl_verification = false
      end

      describe "when given an insecure URL" do
        let(:url) { "http://example.org/insecure" }
        
        it "should provide an empty configuration object" do
          expect(subject).to eq({})
        end
        
      end
      
      describe "when given a secure URL" do
        let(:url) { "https://example.org/secure" }
        
        it "should validate the full certificate chain" do
          expect(subject).to include({:use_ssl => true, :verify_mode => 1})
        end
        
      end
    end
    
    context "disable_ssl_verification is set to true" do
      before do
        PactBroker.configuration.disable_ssl_verification = true
      end
      
      let(:url) { "https://example.org/secure" }
      
      describe "when given a secure URL" do
        it "should not validate certificates" do
          expect(subject).to include({:use_ssl => true, :verify_mode => 0})
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pact_broker-2.89.1 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.89.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.88.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.87.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.86.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.85.1 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.85.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.84.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.83.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.82.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.81.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.80.0 spec/lib/pact_broker/build_http_options_spec.rb