Sha256: 1cb6a0f0e2b5c2b20ce66ab918189d37965c848e4ca7a8e82c63796a416da74a

Contents?: true

Size: 976 Bytes

Versions: 15

Compression:

Stored size: 976 Bytes

Contents

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

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
            self.pact_uri = 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.configuration.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

15 entries across 15 versions & 1 rubygems

Version Path
pact-1.4.0 lib/pact/provider/configuration/pact_verification.rb
pact-1.4.0.rc4 lib/pact/provider/configuration/pact_verification.rb
pact-1.4.0.rc3 lib/pact/provider/configuration/pact_verification.rb
pact-1.4.0.rc2 lib/pact/provider/configuration/pact_verification.rb
pact-1.3.3 lib/pact/provider/configuration/pact_verification.rb
pact-1.3.2 lib/pact/provider/configuration/pact_verification.rb
pact-1.3.1 lib/pact/provider/configuration/pact_verification.rb
pact-1.3.0 lib/pact/provider/configuration/pact_verification.rb
pact-1.2.1.rc2 lib/pact/provider/configuration/pact_verification.rb
pact-1.2.1.rc1 lib/pact/provider/configuration/pact_verification.rb
pact-1.1.1 lib/pact/provider/configuration/pact_verification.rb
pact-1.1.0 lib/pact/provider/configuration/pact_verification.rb
pact-1.1.0.rc5 lib/pact/provider/configuration/pact_verification.rb
pact-1.1.0.rc4 lib/pact/provider/configuration/pact_verification.rb
pact-1.1.0.rc3 lib/pact/provider/configuration/pact_verification.rb