Module: RSpecApi::Expectations::Response::Status

Included in:
RSpecApi::Expectations::Response
Defined in:
lib/rspec-api/expectations/status.rb,
lib/rspec-api/expectations/status/code.rb

Overview

Creates an example group for expectations on the HTTP status code of the last API request and runs it to verify that it matches status.

Defined Under Namespace

Modules: Code

Instance Method Summary collapse

Instance Method Details

#expect_status(response, expectations = {}) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/rspec-api/expectations/status.rb', line 9

def expect_status(response, expectations = {})
  context 'responds with a status code that' do
    extend Code

    expect_status_code response, expectations
  end if expectations.any?
end