module RSpecApi::Matchers::Status
Public Instance Methods
have_status(status)
click to toggle source
Passes if the object has a status that matches status
.
@param [Symbol or Integer] status The expected status code
@example Passes if the response status matches :ok
require 'rspec-api-matchers' obj = OpenStruct.new status: 200 describe 'have_status' do include RSpecApi::Matchers::Status it { expect(obj).to have_status :ok } end # => (rspec) 1 example, 0 failures
@see git.io/YwpDnA#L542 List of symbolic HTTP status codes
@see git.io/Gvb-nQ have_headers_spec.rb for more examples
# File lib/rspec-api/matchers/status/have_status.rb, line 25 def have_status(status) RSpecApi::Matchers::Status::Matcher.new status end