Class: Pact::MockService::RequestHandlers::InteractionReplay
- Inherits:
-
BaseRequestHandler
- Object
- BaseRequestHandler
- Pact::MockService::RequestHandlers::InteractionReplay
- 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
-
#actual_interactions ⇒ Object
Returns the value of attribute actual_interactions.
-
#expected_interactions ⇒ Object
Returns the value of attribute expected_interactions.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#multiple_interactions_handler ⇒ Object
Returns the value of attribute multiple_interactions_handler.
-
#name ⇒ Object
Returns the value of attribute name.
-
#verified_interactions ⇒ Object
Returns the value of attribute verified_interactions.
Instance Method Summary collapse
-
#initialize(name, logger, session, cors_enabled = false, stub = false) ⇒ InteractionReplay
constructor
A new instance of InteractionReplay.
- #match?(env) ⇒ Boolean
- #respond(env) ⇒ Object
Methods included from PrettyGenerate
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_interactions ⇒ Object
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_interactions ⇒ Object
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 |
#logger ⇒ Object
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_handler ⇒ Object
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 |
#name ⇒ Object
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_interactions ⇒ Object
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
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 |