Sha256: 3aef569f311ad0c5b239e8663a6f4c6c931e3d4e589d0d3a6922dbd97700dd0f

Contents?: true

Size: 944 Bytes

Versions: 125

Compression:

Stored size: 944 Bytes

Contents

module Pact
  module Provider::State
    class ProviderStateProxy

      attr_reader :missing_provider_states

      def initialize
        @missing_provider_states = {}
      end

      def get name, options = {}
        unless provider_state = ProviderStates.get(name, options)
          register_missing_provider_state name, options[:for]
          raise error_message name, options[:for]
        end
        provider_state
      end

      def get_base options = {}
        ProviderStates.get_base options
      end

      private

      def error_message name, consumer
        "Could not find provider state \"#{name}\" for consumer #{consumer}"
      end

      def register_missing_provider_state name, consumer
        missing_states_for(consumer) << name unless missing_states_for(consumer).include?(name)
      end

      def missing_states_for consumer
        @missing_provider_states[consumer] ||= []
      end

    end
  end
end

Version data entries

125 entries across 125 versions & 1 rubygems

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