Sha256: a40cba0c1a41e3cf481003fec076d596885cff3943aef51e11784beaa450df1e

Contents?: true

Size: 364 Bytes

Versions: 20

Compression:

Stored size: 364 Bytes

Contents

# frozen_string_literal: true

require 'uri'

RSpec::Matchers.define :have_query_param do |key|
  match do |url|
    query_params_from(url)[key].present?
  end

  def query_params_from(url)
    Hash[query_for(url).split('&').map { |xxx| xxx.split('=', 2) }]
  end

  def uri_for(url)
    URI.parse(url)
  end

  def query_for(url)
    uri_for(url).query
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
saml-kit-1.3.0 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.2.0 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.1.0 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.31 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.30 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.29 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.28 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.27 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.26 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.25 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.24 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.23 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.22 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.21 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.20 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.19 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.18 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.17 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.16 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.15 lib/saml/kit/rspec/have_query_param.rb