class RSpecApib::Element::HttpResponse
Represents a http response in api-elements (api-elements.readthedocs.io/en/latest/)
Private Class Methods
attributes_schema()
click to toggle source
# File lib/rspec_apib/elements/http_response.rb, line 31 def self.attributes_schema { href: "TemplatedHref" } end
Public Instance Methods
matches?(response, options: {})
click to toggle source
Indicates if the incoming request matches the method, path and path vars @param [::RSpecApib::Request] The incoming request - normalized @return [Boolean] true if matches else false rubocop:disable Lint/UnusedMethodArgument
# File lib/rspec_apib/elements/http_response.rb, line 11 def matches?(response, options: {}) matches_status?(response) && matches_content_type?(response) end
status()
click to toggle source
# File lib/rspec_apib/elements/http_response.rb, line 16 def status attributes["statusCode"] end
Private Instance Methods
matches_content_type?(response)
click to toggle source
# File lib/rspec_apib/elements/http_response.rb, line 26 def matches_content_type?(response) expected_content_type = content_type expected_content_type.nil? || (expected_content_type == response.content_type) end
matches_status?(response)
click to toggle source
# File lib/rspec_apib/elements/http_response.rb, line 22 def matches_status?(response) response.status == attributes["statusCode"] end