Sha256: 48a11eba88edf5d47bb1d598f363ca7df0020b0564b5a1b8cf58b90743254214

Contents?: true

Size: 1.08 KB

Versions: 100

Compression:

Stored size: 1.08 KB

Contents

require 'pact/provider/pact_verification'
require 'pact/provider/pact_uri'
require 'pact/shared/dsl'
require 'pact/provider/world'

module Pact
  module Provider

    module Configuration

      class PactVerification

        extend Pact::DSL

        attr_accessor :consumer_name, :pact_uri, :ref

        def initialize consumer_name, options = {}
          @consumer_name = consumer_name
          @ref = options.fetch(:ref, :head)
          @pact_uri = nil
        end

        dsl do
          def pact_uri pact_uri, options = {}
            self.pact_uri = ::Pact::Provider::PactURI.new(pact_uri, options) if pact_uri
          end
        end

        def finalize
          validate
          create_pact_verification
        end

        private

        def create_pact_verification
          verification = Pact::Provider::PactVerification.new(consumer_name, pact_uri, ref)
          Pact.provider_world.add_pact_verification verification
        end

        def validate
          raise "Please provide a pact_uri for the verification" unless pact_uri
        end

      end
    end
  end
end

Version data entries

100 entries across 100 versions & 1 rubygems

Version Path
pact-1.66.0 lib/pact/provider/configuration/pact_verification.rb
pact-1.65.3 lib/pact/provider/configuration/pact_verification.rb
pact-1.65.2 lib/pact/provider/configuration/pact_verification.rb
pact-1.65.1 lib/pact/provider/configuration/pact_verification.rb
pact-1.65.0 lib/pact/provider/configuration/pact_verification.rb
pact-1.64.0 lib/pact/provider/configuration/pact_verification.rb
pact-1.63.0 lib/pact/provider/configuration/pact_verification.rb
pact-1.62.0 lib/pact/provider/configuration/pact_verification.rb
pact-1.61.0 lib/pact/provider/configuration/pact_verification.rb
pact-1.60.0 lib/pact/provider/configuration/pact_verification.rb
pact-1.59.0 lib/pact/provider/configuration/pact_verification.rb
pact-1.58.0 lib/pact/provider/configuration/pact_verification.rb
pact-1.57.0 lib/pact/provider/configuration/pact_verification.rb
pact-1.56.0 lib/pact/provider/configuration/pact_verification.rb
pact-1.55.7 lib/pact/provider/configuration/pact_verification.rb
pact-1.55.6 lib/pact/provider/configuration/pact_verification.rb
pact-1.55.5 lib/pact/provider/configuration/pact_verification.rb
pact-1.55.4 lib/pact/provider/configuration/pact_verification.rb
pact-1.55.3 lib/pact/provider/configuration/pact_verification.rb
pact-1.55.2 lib/pact/provider/configuration/pact_verification.rb