Sha256: 3db7a2a9219e907792ab11cd376a2c6b62515dd49fea9867df31868e74f2423d
Contents?: true
Size: 644 Bytes
Versions: 2
Compression:
Stored size: 644 Bytes
Contents
module Pacto module Validators class ResponseStatusValidator def initialize(app) @app = app end def call(env) expected_status = env[:contract].response.status actual_status = env[:actual_response].status env[:validation_results].concat self.class.validate(expected_status, actual_status) @app.call env end def self.validate(expected_status, actual_status) errors = [] if expected_status != actual_status errors << "Invalid status: expected #{expected_status} but got #{actual_status}" end errors end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pacto-0.3.1 | lib/pacto/validators/response_status_validator.rb |
pacto-0.3.0 | lib/pacto/validators/response_status_validator.rb |