Sha256: 4d698f1d9fa4f96bb535104c4a38ee00dbab49641b2abb0a8a819c1fc7857928

Contents?: true

Size: 490 Bytes

Versions: 68

Compression:

Stored size: 490 Bytes

Contents

module LinksHelper
  LINKS_PATTERN = /\<(.*?)\>; rel="(\w+)"/

  def assert_link(rel, url)
    assert_includes response_links, rel
    assert_equal url, response_links[rel], %(rel="#{rel}" is incorrect)
  end

  def assert_no_link(rel)
    assert_nil response_links[rel], %(expected rel="#{rel}" to be nil)
  end

  private

  def response_links
    @response_links ||= begin
      links = response.headers['Link'].to_s
      links.scan(LINKS_PATTERN).map(&:reverse).to_h
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
shipit-engine-0.17.0 test/helpers/links_helper.rb
shipit-engine-0.16.0 test/helpers/links_helper.rb
shipit-engine-0.15.0 test/helpers/links_helper.rb
shipit-engine-0.14.0 test/helpers/links_helper.rb
shipit-engine-0.13.0 test/helpers/links_helper.rb
shipit-engine-0.12.1 test/helpers/links_helper.rb
shipit-engine-0.12.0 test/helpers/links_helper.rb
shipit-engine-0.11.0 test/helpers/links_helper.rb
shipit-engine-0.10.0 test/helpers/links_helper.rb
shipit-engine-0.9.0 test/helpers/links_helper.rb
shipit-engine-0.8.9 test/helpers/links_helper.rb
shipit-engine-0.8.8 test/helpers/links_helper.rb
shipit-engine-0.8.7 test/helpers/links_helper.rb
shipit-engine-0.8.6 test/helpers/links_helper.rb
shipit-engine-0.8.5 test/helpers/links_helper.rb
shipit-engine-0.8.4 test/helpers/links_helper.rb
shipit-engine-0.8.3 test/helpers/links_helper.rb
shipit-engine-0.8.2 test/helpers/links_helper.rb
shipit-engine-0.8.1 test/helpers/links_helper.rb
shipit-engine-0.8.0 test/helpers/links_helper.rb