Sha256: 2b1b0c04c29e64894e358162b8e78e7bdb1eefcd87ab7223d286663cae3f1dd3

Contents?: true

Size: 1.03 KB

Versions: 12

Compression:

Stored size: 1.03 KB

Contents

module Pact
  module Provider::State
    class ProviderStateManager

      attr_reader :provider_state_name, :consumer

      def initialize provider_state_name, consumer
        @provider_state_name = provider_state_name
        @consumer = consumer
      end

      def set_up_provider_state
        get_global_base_provider_state.set_up
        get_consumer_base_provider_state.set_up
        if provider_state_name
          get_provider_state.set_up
        end
      end

      def tear_down_provider_state
        if provider_state_name
          get_provider_state.tear_down
        end
        get_consumer_base_provider_state.tear_down
        get_global_base_provider_state.tear_down
      end

      def get_provider_state
        Pact.world.provider_states.get(provider_state_name, :for => consumer)
      end

      def get_consumer_base_provider_state
        Pact.world.provider_states.get_base(:for => consumer)
      end

      def get_global_base_provider_state
        Pact.world.provider_states.get_base
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pact-1.1.1 lib/pact/provider/state/provider_state_manager.rb
pact-1.1.0 lib/pact/provider/state/provider_state_manager.rb
pact-1.1.0.rc5 lib/pact/provider/state/provider_state_manager.rb
pact-1.1.0.rc4 lib/pact/provider/state/provider_state_manager.rb
pact-1.1.0.rc3 lib/pact/provider/state/provider_state_manager.rb
pact-1.0.39 lib/pact/provider/state/provider_state_manager.rb
pact-1.1.0.rc2 lib/pact/provider/state/provider_state_manager.rb
pact-1.0.38 lib/pact/provider/state/provider_state_manager.rb
pact-1.1.0.rc1 lib/pact/provider/state/provider_state_manager.rb
pact-1.0.37 lib/pact/provider/state/provider_state_manager.rb
pact-1.0.36 lib/pact/provider/state/provider_state_manager.rb
pact-1.0.35 lib/pact/provider/state/provider_state_manager.rb