Module: RSpecApi::Matchers::Status

Included in:
RSpecApi::Matchers
Defined in:
lib/rspec-api/matchers/status/matcher.rb,
lib/rspec-api/matchers/status/have_status.rb

Defined Under Namespace

Classes: Matcher

Instance Method Summary collapse

Instance Method Details

#have_status(status) ⇒ Object

Note:

The full list of symbolic HTTP status codes is available at: git.io/YwpDnA#L542

Passes if the response has a status that matches status.

For more examples check have_headers_spec.rb.

Examples:


# Passes if the response status matches :ok
status = :ok
expect(OpenStruct.new status: status).to have_status 200


20
21
22
# File 'lib/rspec-api/matchers/status/have_status.rb', line 20

def have_status(status)
  RSpecApi::Matchers::Status::Matcher.new status
end