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.31.0 test/helpers/links_helper.rb
shipit-engine-0.30.0 test/helpers/links_helper.rb
shipit-engine-0.29.0 test/helpers/links_helper.rb
shipit-engine-0.28.1 test/helpers/links_helper.rb
shipit-engine-0.28.0 test/helpers/links_helper.rb
shipit-engine-0.27.1 test/helpers/links_helper.rb
shipit-engine-0.27.0 test/helpers/links_helper.rb
shipit-engine-0.26.0 test/helpers/links_helper.rb
shipit-engine-0.25.1 test/helpers/links_helper.rb
shipit-engine-0.25.0 test/helpers/links_helper.rb
shipit-engine-0.24.0 test/helpers/links_helper.rb
shipit-engine-0.23.1 test/helpers/links_helper.rb
shipit-engine-0.23.0 test/helpers/links_helper.rb
shipit-engine-0.22.0 test/helpers/links_helper.rb
shipit-engine-0.21.0 test/helpers/links_helper.rb
shipit-engine-0.20.1 test/helpers/links_helper.rb
shipit-engine-0.20.0 test/helpers/links_helper.rb
shipit-engine-0.19.0 test/helpers/links_helper.rb
shipit-engine-0.18.1 test/helpers/links_helper.rb
shipit-engine-0.18.0 test/helpers/links_helper.rb