Class: Pact::MockService::RequestHandlers::InteractionReplay

Inherits:
BaseRequestHandler show all
Includes:
Pact::Matchers, PrettyGenerate
Defined in:
lib/pact/mock_service/request_handlers/interaction_replay.rb

Constant Summary

Constants inherited from BaseRequestHandler

BaseRequestHandler::NOT_FOUND_RESPONSE

Constants included from Consumer::RackRequestHelper

Consumer::RackRequestHelper::REQUEST_KEYS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PrettyGenerate

#pretty_generate

Methods inherited from BaseRequestHandler

#call, #json_response, #text_response

Methods included from Consumer::RackRequestHelper

#params_hash, #request_as_hash_from

Constructor Details

#initialize(name, logger, session, cors_enabled = false, stub = false) ⇒ InteractionReplay

Returns a new instance of InteractionReplay.



30
31
32
33
34
35
36
37
38
# File 'lib/pact/mock_service/request_handlers/interaction_replay.rb', line 30

def initialize name, logger, session, cors_enabled = false, stub = false
  @name = name
  @logger = logger
  @expected_interactions = session.expected_interactions
  @actual_interactions = session.actual_interactions
  @verified_interactions = session.verified_interactions
  @cors_enabled = cors_enabled
  @multiple_interactions_handler = stub ? HandleMultipleInteractionsFoundForStub : HandleMultipleInteractionsFound
end

Instance Attribute Details

#actual_interactionsObject

Returns the value of attribute actual_interactions.



28
29
30
# File 'lib/pact/mock_service/request_handlers/interaction_replay.rb', line 28

def actual_interactions
  @actual_interactions
end

#expected_interactionsObject

Returns the value of attribute expected_interactions.



28
29
30
# File 'lib/pact/mock_service/request_handlers/interaction_replay.rb', line 28

def expected_interactions
  @expected_interactions
end

#loggerObject

Returns the value of attribute logger.



28
29
30
# File 'lib/pact/mock_service/request_handlers/interaction_replay.rb', line 28

def logger
  @logger
end

#multiple_interactions_handlerObject

Returns the value of attribute multiple_interactions_handler.



28
29
30
# File 'lib/pact/mock_service/request_handlers/interaction_replay.rb', line 28

def multiple_interactions_handler
  @multiple_interactions_handler
end

#nameObject

Returns the value of attribute name.



28
29
30
# File 'lib/pact/mock_service/request_handlers/interaction_replay.rb', line 28

def name
  @name
end

#verified_interactionsObject

Returns the value of attribute verified_interactions.



28
29
30
# File 'lib/pact/mock_service/request_handlers/interaction_replay.rb', line 28

def verified_interactions
  @verified_interactions
end

Instance Method Details

#match?(env) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/pact/mock_service/request_handlers/interaction_replay.rb', line 40

def match? env
  true # default handler
end

#respond(env) ⇒ Object



44
45
46
# File 'lib/pact/mock_service/request_handlers/interaction_replay.rb', line 44

def respond env
  find_response request_as_hash_from(env)
end