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.32.0 lib/pact/provider/state/provider_state_proxy.rb
pact-1.31.0 lib/pact/provider/state/provider_state_proxy.rb
pact-1.30.0 lib/pact/provider/state/provider_state_proxy.rb
pact-1.29.0 lib/pact/provider/state/provider_state_proxy.rb
pact-1.28.0 lib/pact/provider/state/provider_state_proxy.rb
pact-1.28.0.rc1 lib/pact/provider/state/provider_state_proxy.rb
pact-1.27.0 lib/pact/provider/state/provider_state_proxy.rb
pact-1.26.0 lib/pact/provider/state/provider_state_proxy.rb
pact-1.25.0 lib/pact/provider/state/provider_state_proxy.rb
pact-1.24.0 lib/pact/provider/state/provider_state_proxy.rb
pact-1.23.0 lib/pact/provider/state/provider_state_proxy.rb
pact-1.22.2 lib/pact/provider/state/provider_state_proxy.rb
pact-1.22.0 lib/pact/provider/state/provider_state_proxy.rb
pact-1.21.0 lib/pact/provider/state/provider_state_proxy.rb
pact-1.20.1 lib/pact/provider/state/provider_state_proxy.rb
pact-1.20.0 lib/pact/provider/state/provider_state_proxy.rb
pact-1.19.2 lib/pact/provider/state/provider_state_proxy.rb
pact-1.19.1 lib/pact/provider/state/provider_state_proxy.rb
pact-1.19.0 lib/pact/provider/state/provider_state_proxy.rb
pact-1.18.0 lib/pact/provider/state/provider_state_proxy.rb