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:

The method only checks the presence of a rel=“prev” link. This may be extended in future versions.

Passes if the object includes pagination links in the headers

Examples:

Passes if the headers include a link to the previous page

require 'rspec-api-matchers'

headers = {'Link' => '<https://example.com/1>; rel="prev"'}
obj = OpenStruct.new headers: headers

describe 'have_page_links' do
  include RSpecApi::Matchers::PageLinks
  it { expect(obj).to have_page_links }
end

# => (rspec) 1 example, 0 failures

See Also:



27
28
29
# File 'lib/rspec-api/matchers/page_links/have_page_links.rb', line 27

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