Module: RSpecApi::Requests

Includes:
RespondWith
Defined in:
lib/rspec-api/requests.rb,
lib/rspec-api/requests/valid.rb,
lib/rspec-api/requests/pending.rb,
lib/rspec-api/requests/version.rb

Overview

Provides the respond_with method to RSpec Example groups, useful to make requests to web APIs and verify their expectations:

To have these matchers available inside of an RSpec describe block, include that block inside a block with the :rspec_api metadata, or explicitly include the RSpecApi::Requests module.

Examples:

Tag a describe block as :rspec_api:

describe "Artists", rspec_api: true do
  describe 'GET /artists', rspec_api_requests: {...}
    ... # here you can write `respond_with :ok`
  end
end

Explicitly include the RSpecApi::Responses module

describe "Artists" do
  include RSpecApi::Requests
  describe 'GET /artists', rspec_api_requests: {...}
    ... # here you can write `respond_with :ok`
  end
end

Defined Under Namespace

Modules: Pending, Valid

Constant Summary collapse

VERSION =
'0.7.2'

Method Summary

Methods included from RespondWith

#respond_with

Methods included from RSpecApi::RespondWith::Request

#request

Methods included from RSpecApi::RespondWith::Valid

#valid?

Methods included from RSpecApi::RespondWith::Metadata

#rspec_api_params