Class: Pact::MockService::RequestHandlers::VerificationGet
- Inherits:
-
BaseAdministrationRequestHandler
- Object
- BaseRequestHandler
- BaseAdministrationRequestHandler
- Pact::MockService::RequestHandlers::VerificationGet
- Defined in:
- lib/pact/mock_service/request_handlers/verification_get.rb
Defined Under Namespace
Classes: FailureMessage
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) ⇒ VerificationGet
constructor
A new instance of VerificationGet.
- #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) ⇒ VerificationGet
Returns a new instance of VerificationGet.
8 9 10 11 12 |
# File 'lib/pact/mock_service/request_handlers/verification_get.rb', line 8 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
18 19 20 |
# File 'lib/pact/mock_service/request_handlers/verification_get.rb', line 18 def request_method 'GET' end |
#request_path ⇒ Object
14 15 16 |
# File 'lib/pact/mock_service/request_handlers/verification_get.rb', line 14 def request_path '/interactions/verification' end |
#respond(env) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/pact/mock_service/request_handlers/verification_get.rb', line 22 def respond env verification = Pact::MockService::Interactions::Verification.new(expected_interactions, actual_interactions) example_desc = example_description(env) example_desc = example_desc ? " for example #{example_desc.inspect}" : '' if verification.all_matched? logger.info "Verifying - interactions matched#{example_desc}" text_response('Interactions matched') else = FailureMessage.new(verification).to_s logger.warn "Verifying - actual interactions do not match expected interactions#{example_desc}. \n#{}" logger.warn = "Actual interactions do not match expected interactions for mock #{name}.\n\n#{}See #{logger.description} for details." text_response(, 500) end end |