Module: RSpecApi::Matchers::PageLinks

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

Defined Under Namespace

Classes: Matcher

Instance Method Summary collapse

Instance Method Details

Note:

Passes if response headers include pagination links ()

Checking for the rel=“prev” is probably enough for the purpose. See tools.ietf.org/html/rfc5988#page-6 for Link specification.

For more examples check have_page_links_spec.rb.

Examples:


# Passes if the headers include a link to the previous page
headers = {'Link' => '<https://example.com/1>; rel="prev"'}
expect(OpenStruct.new headers: headers).to have_page_links


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

def have_page_links
  RSpecApi::Matchers::PageLinks::Matcher.new
end