Class: Pact::MockService::RequestHandlers::MissingInteractionsGet
- Inherits:
-
BaseAdministrationRequestHandler
- Object
- BaseRequestHandler
- BaseAdministrationRequestHandler
- Pact::MockService::RequestHandlers::MissingInteractionsGet
- Defined in:
- lib/pact/mock_service/request_handlers/missing_interactions_get.rb
Constant Summary
Constants inherited from BaseRequestHandler
BaseRequestHandler::NOT_FOUND_RESPONSE
Constants included from Consumer::RackRequestHelper
Consumer::RackRequestHelper::REQUEST_KEYS
Instance Attribute Summary
Attributes inherited from BaseAdministrationRequestHandler
Instance Method Summary collapse
-
#initialize(name, logger, session) ⇒ MissingInteractionsGet
constructor
A new instance of MissingInteractionsGet.
- #request_method ⇒ Object
- #request_path ⇒ Object
- #respond(env) ⇒ Object
Methods inherited from BaseAdministrationRequestHandler
#has_mock_service_header?, #match?, #method_matches?, #path_matches?
Methods inherited from BaseRequestHandler
#call, #json_response, #match?, #text_response
Methods included from Consumer::RackRequestHelper
#params_hash, #request_as_hash_from
Constructor Details
#initialize(name, logger, session) ⇒ MissingInteractionsGet
Returns a new instance of MissingInteractionsGet.
10 11 12 13 14 |
# File 'lib/pact/mock_service/request_handlers/missing_interactions_get.rb', line 10 def initialize name, logger, session super name, logger @expected_interactions = session.expected_interactions @actual_interactions = session.actual_interactions end |
Instance Method Details
#request_method ⇒ Object
20 21 22 |
# File 'lib/pact/mock_service/request_handlers/missing_interactions_get.rb', line 20 def request_method 'GET' end |
#request_path ⇒ Object
16 17 18 |
# File 'lib/pact/mock_service/request_handlers/missing_interactions_get.rb', line 16 def request_path '/interactions/missing' end |
#respond(env) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/pact/mock_service/request_handlers/missing_interactions_get.rb', line 24 def respond env verification = Pact::MockService::Interactions::Verification.new(@expected_interactions, @actual_interactions) number_of_missing_interactions = verification.missing_interactions.size logger.info "Number of missing interactions for mock \"#{name}\" = #{number_of_missing_interactions}" json_response({size: number_of_missing_interactions}.to_json) end |