Sha256: 5f823d7ac52cb66e179c20e1004b39af861705ad769742b791d40df9a0ce2fe0

Contents?: true

Size: 1.22 KB

Versions: 96

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

96 entries across 96 versions & 1 rubygems

Version Path
pact_broker-2.23.3 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.23.2 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.23.1 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.23.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.22.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.21.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.20.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.19.2 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.19.1 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.19.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.18.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.17.1 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.17.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.16.1 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.16.0 spec/lib/pact_broker/build_http_options_spec.rb
pact_broker-2.15.0 spec/lib/pact_broker/build_http_options_spec.rb