Sha256: 7c58d27c0b0349c6079a9114dd065d37ee23a0d1093062edd2b4dc1ceb993cfa

Contents?: true

Size: 1.02 KB

Versions: 22

Compression:

Stored size: 1.02 KB

Contents

require 'pact/provider/state/provider_state_proxy'

module Pact

  def self.provider_world
    @world ||= Pact::Provider::World.new
  end

  # internal api, for testing only
  def self.clear_provider_world
    @world = nil
  end

  module Provider
    class World

      attr_accessor :pact_sources

      def provider_states
        @provider_states_proxy ||= Pact::Provider::State::ProviderStateProxy.new
      end

      def add_pact_verification verification
        pact_verifications << verification
      end

      def pact_verifications
        @pact_verifications ||= []
      end

      def pact_urls
        (pact_verifications.collect(&:uri) + pact_uris_from_pact_uri_sources).compact
      end

      def add_pact_uri_source pact_uri_source
        pact_uri_sources << pact_uri_source
      end

      private

      def pact_uri_sources
        @pact_uri_sources ||= []
      end

      def pact_uris_from_pact_uri_sources
        pact_uri_sources.collect{| pact_uri_source| pact_uri_source.call }.flatten
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
pact-1.42.2 lib/pact/provider/world.rb
pact-1.42.1 lib/pact/provider/world.rb
pact-1.42.0 lib/pact/provider/world.rb
pact-1.41.2 lib/pact/provider/world.rb
pact-1.41.1 lib/pact/provider/world.rb
pact-1.41.0 lib/pact/provider/world.rb
pact-1.40.0 lib/pact/provider/world.rb
pact-1.39.0 lib/pact/provider/world.rb
pact-1.38.0 lib/pact/provider/world.rb
pact-1.37.0 lib/pact/provider/world.rb
pact-1.36.2 lib/pact/provider/world.rb
pact-1.36.0 lib/pact/provider/world.rb
pact-1.34.0 lib/pact/provider/world.rb
pact-1.33.2 lib/pact/provider/world.rb
pact-1.33.1 lib/pact/provider/world.rb
pact-1.33.0 lib/pact/provider/world.rb
pact-1.32.0 lib/pact/provider/world.rb
pact-1.31.0 lib/pact/provider/world.rb
pact-1.30.0 lib/pact/provider/world.rb
pact-1.29.0 lib/pact/provider/world.rb