Sha256: 4c583ac1ab9780dd0681951391c93a87d4ebba84fc0ebe5a5eea324e5c6fd836

Contents?: true

Size: 497 Bytes

Versions: 3

Compression:

Stored size: 497 Bytes

Contents

# -*- encoding : utf-8 -*-
module Pacto
  module Cops
    class ResponseStatusCop
      def self.investigate(_request, response, contract)
        expected_status = contract.response.status
        actual_status = response.status
        errors = []
        if expected_status != actual_status
          errors << "Invalid status: expected #{expected_status} but got #{actual_status}"
        end
        errors
      end
    end
  end
end

Pacto::Cops.register_cop Pacto::Cops::ResponseStatusCop

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pacto-0.4.0.rc3 lib/pacto/cops/response_status_cop.rb
pacto-0.4.0.rc2 lib/pacto/cops/response_status_cop.rb
pacto-0.4.0.rc1 lib/pacto/cops/response_status_cop.rb